Design-Specification Tiling for ICL-based CAD Code Generation
Summary
Design-Specification Tiling (DST) is a novel in-context learning (ICL) exemplar selection strategy that significantly improves Computer-Aided Design (CAD) code generation by large language models (LLMs). Addressing the scarcity of domain-specific training data and limitations of existing similarity or diversity-based ICL methods, DST introduces "knowledge sufficiency" as a principled objective. It quantifies this sufficiency using a surrogate tiling ratio, extracting multi-granular design components via n-grams and measuring the proportion of query components covered by selected exemplars. The method demonstrates that maximizing this objective constitutes submodular maximization, providing a polynomial-time greedy algorithm with a (1-1/e)-approximation guarantee. Experiments on the Text2CAD dataset, comprising 151K samples, show DST consistently outperforms baselines across LLMs like Qwen3-30B-A3B, DeepSeek-V3, and Claude 4.5-Haiku, achieving higher Valid Syntax Rate (VSR) and Intersection over Union (IoU), and lower Chamfer Distance (CD) and Edge Chamfer Distance (ECD).
Key takeaway
For AI Scientists and Machine Learning Engineers developing domain-specific code generation systems, you should consider implementing Design-Specification Tiling (DST) for in-context learning. This approach ensures selected exemplars collectively cover complex design requirements, leading to more accurate and syntactically valid CAD code. By adopting DST, you can achieve superior performance with fewer exemplars, optimizing computational resources and improving model reliability for intricate tasks.
Key insights
Knowledge sufficiency, quantified by design-specification tiling, optimizes ICL exemplar selection for CAD code generation.
Principles
- Exemplar selection should provide sufficient task-relevant knowledge.
- Submodular maximization offers efficient approximation guarantees.
Method
DST extracts multi-granular n-gram components, calculates a tiling ratio as a knowledge sufficiency surrogate, then uses a greedy submodular maximization algorithm for exemplar selection.
In practice
- DST improves CAD code generation quality across LLMs.
- It reduces API misuse errors in LLM outputs.
- DST achieves 0.54 IoU with 3 shots on Hard tasks.
Topics
- In-Context Learning
- CAD Code Generation
- Exemplar Selection
- Submodular Optimization
- Large Language Models
- Text2CAD
Best for: Research Scientist, AI Scientist, Machine Learning Engineer
Related on AIssential
See Counsel's argued verdicts on the open AI decisions leaders are weighing →
Editorial summary, takeaway, and curation by AIssential. Original article published by cs.SE updates on arXiv.org.