TreeCoder: Systematic Exploration and Optimisation of Decoding and Constraints for LLM Code Generation
Henrijs Princis, Arindam Sharma, Cristina David

TL;DR
TreeCoder introduces a flexible framework for optimizing decoding strategies and constraints in LLM code generation, significantly improving accuracy by enforcing correctness and structure during decoding.
Contribution
It presents the first systematic approach to explore and tune decoding strategies and constraints as first-class components in LLM code generation.
Findings
TreeCoder improves accuracy on MBPP and SQL-Spider benchmarks.
It outperforms baseline models like CodeLlama, Mistral, and DeepSeek.
Systematic tuning leads to consistent performance gains.
Abstract
Large language models (LLMs) have shown remarkable ability to generate code, yet their outputs often violate syntactic or semantic constraints when guided only through natural language prompts. We introduce TreeCoder, the most general and flexible framework to date for exploring decoding strategies, constraints, and hyperparameters in LLMs, and use it in code generation to enforce correctness and structure during decoding rather than relying on prompt engineering. TreeCoder represents decoding as a tree search over candidate programs, where both decoding strategies and constraint functions - such as style, syntax, execution - are treated as first-class, optimisable components. This design enables systematic exploration and automatic tuning of decoding configurations using standard optimisation techniques. Experiments on the MBPP (Python) and SQL-Spider benchmarks show that TreeCoder…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
