Applying RLAIF for Code Generation with API-usage in Lightweight LLMs
On the map: LLM reasoning → Reasoning for agents, planning and code
Abstract (arXiv)
Reinforcement Learning from AI Feedback (RLAIF) has demonstrated significant potential across various domains, including mitigating harm in LLM outputs, enhancing text summarization, and mathematical reasoning. This paper introduces an RLAIF framework for improving the code generation abilities of lightweight (<1B parameters) LLMs. We specifically focus on code generation tasks that require writing appropriate API calls, which is challenging due to the well-known issue of hallucination in LLMs. Our framework extracts AI feedback from a larger LLM (e.g., GPT-3.5) through a specialized prompting strategy and uses this data to train a reward model towards better alignment from smaller LLMs. We run our experiments on the Gorilla dataset and meticulously assess the quality of the model-generated code across various metrics, including AST, ROUGE, and Code-BLEU, and develop a pipeline to compute its executability rate accurately. Our approach significantly enhances the fine-tuned LLM baseline's performance, achieving a 4.5% improvement in executability rate. Notably, a smaller LLM model (780M parameters) trained with RLAIF surpasses a much larger fine-tuned baseline with 7B parameters, achieving a 1.0% higher code executability rate.
Key facts. Cited by 10 papers in the map (data through 7 Oct 2026). Placed in Reasoning for agents, planning and code, one of 17 directions in LLM reasoning. Builds on 23 of its 35 references that are in the map. First posted on arXiv 28 Jun 2024.
Builds on
23 of 35 references.
Closest ancestors · 1
Same direction, newest first
Other references · 22
- 2020Language Models are Few-Shot Learnerscited by 32,199
- 2022Training language models to follow instructions with human feedbackcited by 15,712
- 2017Proximal Policy Optimization Algorithmscited by 14,441
- 2023LLaMA: Open and Efficient Foundation Language Modelscited by 13,958
- 2022PaLM: Scaling Language Modeling with Pathwayscited by 5,304
- 2023Toolformer: Language Models Can Teach Themselves to Use Toolscited by 4,072
- 2021Program Synthesis with Large Language Modelscited by 3,509
- 2022Constitutional AI: Harmlessness from AI Feedbackcited by 2,950
- 2023ToolLLM: Facilitating Large Language Models to Master 16000+ Real-world APIscited by 1,880
- 2021WebGPT: Browser-assisted question-answering with human feedbackcited by 1,722
- 2023Gorilla: Large Language Model Connected with Massive APIscited by 1,302
- 2021Measuring Coding Challenge Competence With APPScited by 879
10 more
- 2017Seq2SQL: Generating Structured Queries from Natural Language using Reinforcement Learningcited by 679
- 2019CodeSearchNet Challenge: Evaluating the State of Semantic Code Searchcited by 638
- 2023WizardMath: Empowering Mathematical Reasoning for Large Language Models via Reinforced Evol-Instructcited by 618
- 2023RLAIF vs. RLHF: Scaling Reinforcement Learning from Human Feedback with AI Feedbackcited by 615
- 2020CodeBLEU: a Method for Automatic Evaluation of Code Synthesiscited by 468
- 2023ToolkenGPT: Augmenting Frozen Language Models with Massive Tools via Tool Embeddingscited by 238
- 2020IntelliCode Compose: Code Generation Using Transformercited by 225
- 2023HuatuoGPT, towards Taming Language Model to Be a Doctorcited by 211
- 2022XLCoST: A Benchmark Dataset for Cross-lingual Code Intelligencecited by 54
- 2023Synthetic Imitation Edit Feedback for Factual Alignment in Clinical Summarizationcited by 5
Built on by
Citing papers per year: 2024: 3; 2025: 4; 2026: 3.
10 papers.
- 2024Enhancing Code LLMs with Reinforcement Learning in Code Generation: A Surveycited by 82
- 2025A Comprehensive Survey of Reward Models: Taxonomy, Applications, Challenges, and Futurecited by 53
- 2024Learning to Summarize from LLM-generated Feedbackcited by 24
- 2025Sailing by the Stars: A Survey on Reward Models and Learning Strategies for Learning from Rewardscited by 14
- 2024The Road to Artificial SuperIntelligence: A Comprehensive Survey of Superalignmentcited by 11
- 2026RLHFless: Serverless Computing for Efficient RLHFcited by 1
- 2026Delulu: A Verified Multi-Lingual Benchmark for Code Hallucination Detection in Fill-in-the-Middle Taskscited by 1
- 2025Benchmarking Web API Integration Code Generationcited by 0
- 2025Lifecycle-Aware code generation: Leveraging Software Engineering Phases in LLMscited by 0
- 2026Mitigating Errors in LLM-Generated Web API Invocations via Retrieval-Augmented Generation and Constrained Decodingcited by 0
- 2026Mitigating Errors in LLM-Generated Web API Invocations via Retrieval-Augmented Generation and Constrained Decoding7 Jul 2026
- 2026Delulu: A Verified Multi-Lingual Benchmark for Code Hallucination Detection in Fill-in-the-Middle Tasks7 May 2026
- 2026RLHFless: Serverless Computing for Efficient RLHF26 Feb 2026
- 2025Lifecycle-Aware code generation: Leveraging Software Engineering Phases in LLMs28 Oct 2025
- 2025Benchmarking Web API Integration Code Generation24 Sep 2025
- 2025Sailing by the Stars: A Survey on Reward Models and Learning Strategies for Learning from Rewards5 May 2025
- 2025A Comprehensive Survey of Reward Models: Taxonomy, Applications, Challenges, and Future12 Apr 2025
- 2024Enhancing Code LLMs with Reinforcement Learning in Code Generation: A Survey29 Dec 2024
- 2024The Road to Artificial SuperIntelligence: A Comprehensive Survey of Superalignment21 Dec 2024
- 2024Learning to Summarize from LLM-generated Feedback17 Oct 2024
Similar, not cited
Close in wording, no citation either way
- 2024RLEF: Grounding Code LLMs in Execution Feedback with Reinforcement Learning
- 2025ACE-RLHF: Automated Code Evaluation and Socratic Feedback Generation Tool using Large Language Models and Reinforcement Learning with Human Feedback
- 2024RLSF: Fine-tuning LLMs via Symbolic Feedback
- 2026Performance, Efficiency and Collapse -- Advantages and Challenges in Offline Post-training of Code LLMs
- 2025R1-Code-Interpreter: LLMs Reason with Code via Supervised and Multi-stage Reinforcement Learning
- 2026Efficient Post-training of LLMs for Code Generation With Offline Reinforcement Learning
- 2024TeaMs-RL: Teaching LLMs to Generate Better Instruction Datasets via Reinforcement Learning
- 2024A Critical Evaluation of AI Feedback for Aligning Large Language Models