paper-with-me

Papers

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

2023-10-13 · Hung Le, Hailin Chen, Amrita Saha, Akash Gokul, Doyen Sahoo, Shafiq Joty

Large Language Models (LLMs) have already become quite proficient at solving simpler programming tasks like those in HumanEval or MBPP benchmarks. However, solving more complex and competitive programming tasks is still quite challenging for these models - possibly due to their tendency to generate solutions as monolithic code blocks instead of decomposing them into logical sub-tasks and sub-modules. On the other hand, experienced programmers instinctively write modularized code with abstraction for solving complex tasks, often reusing previously developed modules. To address this gap, we propose CodeChain, a novel framework for inference that elicits modularized code generation through a chain of self-revisions, each being guided by some representative sub-modules generated in previous iterations. Concretely, CodeChain first instructs the LLM to generate modularized codes through chain-of-thought prompting. Then it applies a chain of self-revisions by iterating the two steps: 1) extracting and clustering the generated sub-modules and selecting the cluster representatives as the more generic and re-usable implementations, and 2) augmenting the original chain-of-thought prompt with these selected module-implementations and instructing the LLM to re-generate new modularized solutions. We find that by naturally encouraging the LLM to reuse the previously developed and verified sub-modules, CodeChain can significantly boost both modularity as well as correctness of the generated solutions, achieving relative pass@1 improvements of 35% on APPS and 76% on CodeContests. It is shown to be effective on both OpenAI LLMs as well as open-sourced LLMs like WizardCoder. We also conduct comprehensive ablation studies with different methods of prompting, number of clusters, model sizes, program qualities, etc., to provide useful insights that underpin CodeChain's success.

📄 PDF Abstract BibTeX arXiv:2310.08992

Code (1)

SalesforceAIResearch/CodeChain 공식 구현 pytorch

Tasks

Code GenerationHumanEvalmbpp

Similar Papers 제목 키워드 기반

AI4BayesCode: From Natural Language Descriptions to Validated Modular Stateful Bayesian Samplers

2026-05-18 · Jungang Zou, Alex Ziyu Jiang, Qixuan Chen arxiv

Coding and computation remain major bottlenecks in Markov chain Monte Carlo (MCMC) workflows, especially as modern sampling algorithms have become increasingly complex and existing probabilistic programming systems remai…

EVM-QuestBench: An Execution-Grounded Benchmark for Natural-Language Transaction Code Generation

2026-01-10 · Pei Yang, Wanyi Chen, Ke Wang, Lynn Ai 외 arxiv

Large language models are increasingly applied to various development scenarios. However, in on-chain transaction scenarios, even a minor error can cause irreversible loss for users. Existing evaluations often overlook e…

Code Generation

LayerCraft: Enhancing Text-to-Image Generation with CoT Reasoning and Layered Object Integration

2025-03-25 · Yuyao Zhang, Jinghao Li, Yu-Wing Tai

Text-to-image (T2I) generation has made remarkable progress, yet existing systems still lack intuitive control over spatial composition, object consistency, and multi-step editing. We present $\textbf{LayerCraft}$, a mod…

Image GenerationObjectPrompt EngineeringScene Generation+2

ChainReaction: Causal Chain-Guided Reasoning for Modular and Explainable Causal-Why Video Question Answering

2025-08-28 · Paritosh Parmar, Eric Peh, Basura Fernando arxiv

Existing Causal-Why Video Question Answering (VideoQA) models often struggle with higher-order reasoning, relying on opaque, monolithic pipelines that entangle video understanding, causal inference, and answer generation…

Video Question AnsweringAnswer GenerationCausal Inference

SynthAI: A Multi Agent Generative AI Framework for Automated Modular HLS Design Generation

2024-05-25 · Seyed Arash Sheikholeslam, Andre Ivanov

In this paper, we introduce SynthAI, a new method for the automated creation of High-Level Synthesis (HLS) designs. SynthAI integrates ReAct agents, Chain-of-Thought (CoT) prompting, web search technologies, and the Retr…

High-Level SynthesisRAGRetrievalRetrieval-augmented Generation