Compact Constraint Encoding for LLM Code Generation: An Empirical Study of Token Economics and Constraint Compliance
Hanzhang Tang

TL;DR
This study evaluates whether compact, structured constraint headers can reduce token usage in LLM code generation prompts without affecting constraint compliance, finding significant token savings but no impact on compliance rates.
Contribution
It demonstrates that compact constraint encoding reduces token consumption substantially without degrading constraint satisfaction across multiple models and tasks.
Findings
Compact headers cut constraint tokens by ~71%.
No significant difference in constraint satisfaction rate across encoding forms.
Model self-assessments overestimate actual compliance.
Abstract
LLMs used for code generation are typically guided by engineering constraints--technology choices, dependency restrictions, and architectural patterns--expressed in verbose natural language. We investigate whether compact, structured constraint headers can reduce prompt token consumption without degrading constraint compliance. Across six experimental rounds spanning 11 models, 16 benchmark tasks, and over 830 LLM invocations, we find that compact headers reduce constraint-portion tokens by approximately 71% and full-prompt tokens by 25--30%, replicated across three independent rounds. However, we detect no statistically significant differences in constraint satisfaction rate (CSR) across three encoding forms or four propagation modes; observed effect sizes are negligible (Cliff's < 0.01, 95% CI spanning 2.6 percentage points). This null pattern holds across two models…
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.
