# CodeChain: Towards Modular Code Generation Through Chain of Self-revisions with Representative Sub-modules

**Authors:** Hung Le, Hailin Chen, Amrita Saha, Akash Gokul, Doyen Sahoo, Shafiq Joty  
**arXiv:** [2310.08992](https://arxiv.org/abs/2310.08992)  
**Date:** 2023-10-13  
**Summary page:** https://www.summarizepaper.com/en/paper/2310.08992v1/

## Key points

- Authors: Hung Le, Hailin Chen, Amrita Saha, Akash Gokul, Doyen Sahoo, Shafiq Joty
- Introduces CodeChain framework for Large Language Models (LLMs) to generate modularized code for complex programming tasks
- Operates by guiding LLMs through self-revisions to encourage modularized code generation
- Enhances modularity and correctness in generated solutions by using chain-of-thought prompts and extracting representative sub-modules
- Demonstrated effectiveness across various LLM models and benchmarks
- Ablation studies provide insights contributing to CodeChain's success

## Summary

, , , , 


In their paper titled "CodeChain: Towards Modular Code Generation Through Chain of Self-revisions with Representative Sub-modules," authors Hung Le, Hailin Chen, Amrita Saha, Akash Gokul, Doyen Sahoo, and Shafiq Joty introduce the CodeChain framework as a solution to the challenge faced by Large Language Models (LLMs) in generating modularized code for complex programming tasks. The framework operates by guiding LLMs through a series of self-revisions to encourage the generation of modularized code. By prompting the LLM to generate modular codes using chain-of-thought prompts and extracting representative sub-modules for reuse, CodeChain significantly enhances both modularity and correctness in generated solutions. The results demonstrate its effectiveness across various LLM models and benchmarks. Comprehensive ablation studies provide valuable insights that contribute to CodeChain's success. Overall, CodeChain presents a novel approach towards addressing the limitations of LLMs in generating modularized code for complex programming tasks.
