Large Language Models (LLMs) have demonstrated remarkable potential in code generation. The integration of Chain of Thought (CoT) reasoning can further boost their performance. However, current CoT methods often require manual writing or LLMs with over 100 billion parameters to generate, impeding their applicability in resource-constrained scenarios. In this study, we investigate lightweight Language Models (<inline-formula><tex-math notation="LaTeX">$\ell$</tex-math><alternatives><mml:math><mml:mi>ℓ</mml:mi></mml:math><inline-graphic xlink:href="zhou-ieq1-3440503.gif"/></alternatives></inline-formula>LMs), which are defined to have fewer than 10 billion parameters. Empirically, we find that most <inline-formula><tex-math notation="LaTeX">$\ell$</tex-math><alternatives><mml:math><mml:mi>ℓ</mml:mi></mml:math><inline-graphic xlink:href="zhou-ieq2-3440503.gif"/></alternatives></inline-formula>LMs cannot generate high-quality CoTs when prompted by the few-shot method, but can take advantage of high-quality CoTs generated elsewhere to improve their performance in code generation. Based on these findings, we design a novel approach <monospace>COTTON</monospace> which can leverage <inline-formula><tex-math notation="LaTeX">$\ell$</tex-math><alternatives><mml:math><mml:mi>ℓ</mml:mi></mml:math><inline-graphic xlink:href="zhou-ieq3-3440503.gif"/></alternatives></inline-formula>LMs to automatically generate CoTs for code generation. We synthesize new datasets and conduct extensive experiments on various benchmarks. The results show that the CoTs generated by <monospace>COTTON</monospace> outperform the baselines in terms of automated and human evaluation metrics. In particular, the CoTs generated by <monospace>COTTON</monospace> boost various <inline-formula><tex-math notation="LaTeX">$\ell$</tex-math><alternatives><mml:math><mml:mi>ℓ</mml:mi></mml:math><inline-graphic xlink:href="zhou-ieq4-3440503.gif"/></alternatives></inline-formula>LMs to achieve higher performance gains than those generated by LLMs such as ChatGLM (130B), and are competitive with those generated by Gemini and gpt-3.5-turbo. The results also reveal that <monospace>COTTON</monospace> not only improves the performance of <inline-formula><tex-math notation="LaTeX">$\ell$</tex-math><alternatives><mml:math><mml:mi>ℓ</mml:mi></mml:math><inline-graphic xlink:href="zhou-ieq5-3440503.gif"/></alternatives></inline-formula>LMs, but also enhances the performance of LLMs. Our study showcases the potential of <inline-formula><tex-math notation="LaTeX">$\ell$</tex-math><alternatives><mml:math><mml:mi>ℓ</mml:mi></mml:math><inline-graphic xlink:href="zhou-ieq6-3440503.gif"/></alternatives></inline-formula>LMs in software engineering applications.
Paper
References (100)
Scroll for more · 38 remaining