Large Language Model Guided Self-Debugging Code Generation
Abstract
Automated code generation is gaining significant importance in intelligent computer programming and system deployment. However, current approaches often face challenges in computational efficiency and lack robust mechanisms for code parsing and error correction. In this work, we propose a novel framework, PyCapsule, with a simple yet effective two-agent pipeline and efficient self-debugging modules for Python code generation. PyCapsule features sophisticated prompt inference, iterative error handling, and case testing, ensuring high generation stability, safety, and correctness. Empirically, PyCapsule achieves up to 5.7% improvement of success rate on HumanEval, 10.3% on HumanEval-ET, and 24.4% on BigCodeBench compared to the state-of-art methods. We also observe a decrease in normalized success rate given more self-debugging attempts, potentially affected by limited and noisy error feedback in retention. PyCapsule demonstrates broader impacts on advancing lightweight and efficient code generation for artificial intelligence systems.
Community
๐ Think, Code, Debug, Repeat: PyCapsule's Human-Inspired Approach to Code Generation
Novel two-agent LLM framework that outperforms 32B models using just 7B parameters
Achieves SOTA with 96.5% accuracy on HumanEval and 25% improvement on BigCodeBench
Uses up to 3x fewer API calls than existing frameworks while maintaining higher accuracy
Introduces intelligent error handling and self-debugging capabilities
๐ก Why it matters:
While Large Language Models have revolutionized code generation, PyCapsule demonstrates that the future of AI-assisted programming isn't just about scaling up models. Our specialized modules - like intelligent error message processing and signature conversion - consistently enhance LLM performance without requiring additional computational resources. This hybrid approach shows that thoughtfully designed deterministic components can significantly boost AI capabilities while reducing resource usage. PyCapsule achieves state-of-the-art performance not through larger models or complex multi-agent systems, but through smart integration of focused, reliable software modules with LLM capabilities.
The beauty of this approach is that while LLM capabilities may vary, these specialized modules will always provide consistent, reliable support, making code generation more robust and efficient. PyCapsule points to a future where AI and traditional software engineering principles work in harmony, each amplifying the other's strengths.
This is an automated message from the Librarian Bot. I found the following papers similar to this paper.
The following papers were recommended by the Semantic Scholar API
- Revisit Self-Debugging with Self-Generated Tests for Code Generation (2025)
- Guided Code Generation with LLMs: A Multi-Agent Framework for Complex Code Tasks (2025)
- MAGE: A Multi-Agent Engine for Automated RTL Code Generation (2024)
- Leveraging Metamemory Mechanisms for Enhanced Data-Free Code Generation in LLMs (2025)
- GLLM: Self-Corrective G-Code Generation using Large Language Models with User Feedback (2025)
- AlphaVerus: Bootstrapping Formally Verified Code Generation through Self-Improving Translation and Treefinement (2024)
- The Impact of Prompt Programming on Function-Level Code Generation (2024)
Please give a thumbs up to this comment if you found it helpful!
If you want recommendations for any Paper on Hugging Face checkout this Space
You can directly ask Librarian Bot for paper recommendations by tagging it in a comment:
@librarian-bot
recommend
Models citing this paper 0
No model linking this paper
Datasets citing this paper 0
No dataset linking this paper
Spaces citing this paper 0
No Space linking this paper