AI
New Method Improves AI's Ability to Generate CAD Code by Selecting Better Examples
Researchers propose a technique that strategically picks training examples to help language models generate more accurate computer-aided design code.
Large language models show promise for generating code in specialized domains like computer-aided design (CAD), but they struggle when training data is limited. A new approach published on arXiv tackles this challenge by focusing on how examples are selected when teaching these models.
The Problem with Current Methods#
Most techniques for improving model performance rely on picking examples based on similarity to the target task or selecting diverse examples. However, CAD design specifications are inherently complex—they combine multiple functional requirements, geometric constraints, and design elements that interact with one another. Existing selection strategies often pick examples that seem relevant individually but end up duplicating information, failing to cover the full range of requirements a model needs to understand.
Introducing Design-Specification Tiling#
The researchers propose Design-Specification Tiling (DST), which reframes the problem around "knowledge sufficiency"—the goal of selecting a minimal set of examples that collectively address all the components of a design specification. Rather than measuring similarity or diversity alone, DST breaks down design specifications into smaller, interconnected parts and tracks which requirements the selected examples actually cover.
The team formulated this selection process as an optimization problem and developed a greedy algorithm that runs in polynomial time while guaranteeing performance within a $(1-1/e)$ factor of the optimal solution—a standard approximation bound in computer science.
Empirical Results and Implications#
Extensive testing across multiple language models showed that DST substantially outperforms existing exemplar selection strategies for CAD code generation. The results underscore that effective in-context learning for specialized tasks depends not just on individual example quality, but on ensuring collective coverage of all the distinct requirements embedded in a design problem. This insight has broader relevance for domain-specific code generation across other technical fields.

