




















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 consistently improves accuracy across open-source models such as CodeLlama, Mistral and DeepSeek, often outperforming their unconstrained baselines by considerable margins.
| Comments: | 30 pages, 9 figures, 13 tables |
| Subjects: | Machine Learning (cs.LG) |
| Cite as: | arXiv:2511.22277 [cs.LG] |
| (or arXiv:2511.22277v2 [cs.LG] for this version) | |
| https://doi.org/10.48550/arXiv.2511.22277 arXiv-issued DOI via DataCite |
From: Henrijs Princis Mr [view email]
[v1]
Thu, 27 Nov 2025 09:59:39 UTC (1,101 KB)
[v2]
Fri, 24 Apr 2026 08:52:17 UTC (1,119 KB)
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。