Divide-and-Conquer Meets Consensus: Unleashing the Power of Functions in Code Generation
Meta info.
- Authors: Jingchang Chen, Hongxuan Tang, Zheng Chu, Qianglong Chen, Zekun Wang, Ming Liu, Bing Qin
- Paper: https://openreview.net/pdf?id=cFqAANINgW
- Affiliation: Harbin Institute of Technology
- Published: September 26, 2024
- Code: https://github.com/cometeme/funcoder
- Conference: NeurIPS2024
TL; DR
Divide-and-Conquer ์ ๋ต์ ๊ธฐ๋ฅ์ ํฉ์(functional consensus)๋ฅผ ์ ๋ชฉํ CodeGen framework FUNCODER ์ ์




Background
LLM ๋ฑ์ฅ์ผ๋ก codegen ์ฑ๋ฅ์ด ํฌ๊ฒ ๋ฐ์ ๋ ๊ฑด ๋ง์ง๋ง, requirements๊ฐ ๋ณต์กํ programming์ ์ฌ์ ํ ๋์ ๊ณผ์
Problem States
codegen ๊ณผ์ ์ step์ ๋๋๊ฑฐ๋ pipeline ๋ฐฉ์์ ์ ์ฉํ๊ฒ ๋๋ฉด ๋ณต์ก์ฑ์ด ์ฆ๋๋๊ณ (์๋จ๊ณ ์ค๋ฅ ์คํจ์ ๋ค๋ก ์ ํ), LLM ์์กด์ฑ์ด ๋๊ณ (๋ณดํต ๋ชจ๋ธ ์ฌ์ด์ฆ์ ์์กด), LLM์ด ์์ฑํ Testcase๋ฅผ ํ์ฉํ self-testing์ ์ ๋ขฐ์ฑ ์ ํ ๋ฑ ๋ฌธ์ ๊ฐ ์ฐ์ฌ
- research question: ๋ณต์ก๋ ๋๊ณ self-testing์ ์ ๋ขฐ๋๋ฅผ ๋์ด๋ ๋ฐฉํฅ์ผ๋ก codegen์ (์์ ๋ชจ๋ธ์์ ๋) ํจ์จ์ ์ผ๋ก ํ๋ ๋ฐฉ๋ฒ ๊ณ ์
Suggestions
FUNCODER
- Divide-and-Conquer: ๋ณต์ก์ฑ ๊ฐ์ ํจ๊ณผ ๊ธฐ๋
- Divide: ๋ณต์กํ ๋ฌธ์ (froot)๋ฅผ ํ์ ํจ์(fi)๋ก ์ฌ๊ท์ ์ผ๋ก ๋ถํด, ๊ณ์ธต์ ์์กด์ฑ ํธ๋ฆฌ ์์ฑ(T)
- Conquer: ๊ฐ ํจ์๋ ๋ ๋ฆฝ์ ์ผ๋ก ํ๊ณ ๋์ค์ ์ต์ข ํ๋ก๊ทธ๋จ์ผ๋ก ํฉ์ฑ. T์ leaf๋ถํฐ bottom up ๋ฐฉ์์ผ๋ก ํ์ํ์ฌ ํฉ์ฑ์ ๋ฐ๋ณตํ์ฌ f*cur ๊ตฌํ
- functional consensus: ์ค๋ฅ ์ ํ ๋ฐฉ์ง ๊ธฐ๋
- ํ๋ณด ํจ์๋ฅผ ์ฌ๋ฌ๊ฐ ์ํ๋ง(nํ ์์ฑ) > ํ๋ก๊ทธ๋จ ๋์ ์ ์ฌ์ฑ ์ธก์ (๋ค์ํ ์ ๋ ฅ์ ๋ํ ์ถ๋ ฅ ๊ฒฐ๊ณผ ๋น๊ต) > ์ ์ฌ์ฑ ๊ธฐ๋ฐ ํฉ์ ํจ์(๊ฐ์ฅ ์ผ๊ด๋ ๋์์ ๋ณด์ด๋ ํ๋ณด) ์ ํ
- ์์ฑ ์ฝ๋ ์ ๋ขฐ์ฑ ํฅ์ ํจ๊ณผ
- self-testingํ๋ฉด ํ ์คํธ ์ผ์ด์ค ์์ฒด์ ์ ๋ขฐ์ฑ ๋ณด์ฅ ์ ๋๋ ๋ฌธ์ ์ ๋ํด, ํ ์คํธ ์ผ์ด์ค๋ฅผ ๋ช ์์ ์ผ๋ก ๋ง๋ค์ง ์๊ณ ํจ์๋ฅผ ์ฌ๋ฌ๊ฐ ๋ง๋ค๊ณ ๊ฐ๊ฐ์ ์ถ๋ ฅ์ ์ง์ ๋น๊ตํ๋ ๋ฐฉ์์ผ๋ก ์ฐํ
- LLM ํฌ๊ธฐ์ ์๊ด์์ด codegen ์ฑ๋ฅ์ ํฅ์์ํค๋ ๋ฐ ํจ๊ณผ์ ์ด๋ผ๋ ๊ฒฐ๋ก
- ํ ํฐ ์ฌ์ฉ๋๋ ๊ธฐ์กด ๋ฐฉ์์ด๋ ๋น์ทํ๋ค๊ณ .
Effects
FUNCODER๊ฐ LLM ๊ธฐ๋ฐ ์ฝ๋ ์์ฑ์ ํจ์จ์ฑ๊ณผ ํ์ง์ ํฅ์์ํค๋ ๋ฐ ํฌ๊ฒ ๊ธฐ์ฌํ๋ค.
- backbone: GPT-3.5-turbo, GPT-4 ๋ฑ
- ์ฝ๋ ์์ฑ (HumanEval, MBPP, xCodeEval) Result:
- ๊ธฐ์กด ๋๋น ํ๊ท HumanEval +9.8%, MBPP +3.3%, xCodeEval +10.4% ํฅ์
- funcoder-StableCode3b:ย HumanEval ๊ธฐ์ค GPT-4 ์ฑ๋ฅ์ ์ฝ 97.7%์ ๊ทผ์ (vanilla GPT-3.5์ ์ฝ 118.6%์ ์๋์ ์ฑ๋ฅ)
- ์ ํ์ฑ ํ๊ฐ์์ functional consensus๊ฐ self-testing๋ณด๋ค ์ฐ์ (์ ๋ขฐ์ฑ ํฅ์)
- ์ํ ์ถ๋ก (MATH) Result:
- funcoder-GPT-4: SOTA Cumulative Reasoning ๋๋น +(6.0, 8.3%), PoT(vanilla program-aided baseline) ๋๋น +(10.0, 14.7%)
- funcoder-GPT-3.5-turbo: SOTA Cumulative Reasoning ๋๋น +(6.2, 11.1%), PoT ๋๋น +(13.0, 31.7%)
- Divide-and-Conquer๊ฐ ๋๋ฉ์ธ๋ณ๋ก ํน์ ๋ผ์ ๊ฐ MATH ์ฃผ์ ์ ํ์ํ ํน์ ์ง์์ ๋ฐ์ํ๊ธฐ ๋๋ฌธ์ ์ฑ๋ฅ ๋์ด๋๋ฏ
Personal note. ํจ๊ณผ๊ฐ ์ข์๊ฑด ๋ฌผ๋ก ์ด๊ณ ์์ ๋ชจ๋ธ์์ ์ฑ๋ฅ ํฅ์๋ ์ธ์์ ์ด๊ณ ๊ทธ๋ฆผ๋ค์ด ๋ถ๋ช ํด์ ๊ทธ๋ฐ์ง ๋ ผ๋ฌธ๋ ๋๊ฒ ๊น๋ํ๊ฒ ์ฐ์ฌ์๋ค์.