Introduction
As domain-specific architectures (DSAs) like NVIDIA GPUs and Google TPUs proliferate to meet the demands of modern AI, the software layer supporting them has become a critical bottleneck. These chips require highly optimized libraries written in architecture-specific programming languages (ASPLs) such as CUDA, Pallas, or STeP. Developing these libraries is traditionally a manual, labor-intensive process requiring rare expertise in both high-level machine learning algorithms and low-level hardware constraints.
Furthermore, LLMs face a "cold start" problem with new hardware: because these languages and architectures are often proprietary or nascent, they do not exist in the models' training corpora. This research introduces an Adaptive Self-improvement Agentic System designed to bridge this gap, allowing LLMs to "self-evolve" into expert programmers for specialized hardware through iterative trial-and-error and curriculum-based learning.
The Challenge: Expertise Gaps and Data Scarcity
Standard LLM coding assistants rely on vast amounts of open-source code. When tasked with writing for a new DSA, they fail for two primary reasons:
- The Cold Start Problem: There is virtually no existing code for the LLM to have learned from during pre-training.
- Global Constraints: ASPLs often utilize "affine type" systems or strict dataflow constraints (e.g., preventing variable reuse) that require global reasoning, a known weakness for autoregressive models.
To address these, the researchers asked whether an agentic system could learn to write code for a language it has never seen, using only a set of basic primitives and its own execution feedback.
The Adaptive Self-improvement Framework
The proposed system functions through a continuous feedback loop that mimics the way a human expert learns a new language: by solving increasingly difficult problems and reflecting on successful solutions.
Agentic Organization and Structural IR
Instead of a single prompt, the system employs a multi-agent architecture:
- The Proposer: Responsible for generating the initial logic and code structure.
- The Guardian: Acts as a global linter, specifically checking for affine type constraints and dataflow errors that the Proposer might overlook.
To improve reasoning efficiency, the system uses a Structural Intermediate Representation (IR) based on YAML. This format condenses the logic, reduces token consumption, and forces the LLM to focus on the semantics of the program rather than getting bogged down in the nuances of syntax.
The Self-Improvement Loop
The core of the system is a five-stage iterative process:
- Parallel Sampling: The system generates multiple candidate solutions for a set of tasks.
- Verification: Solutions are executed and tested for functional correctness against a gold-standard PyTorch reference.
- Filtering & De-duplication: Successful solutions are analyzed via Abstract Syntax Tree (AST) to group identical logic, selecting the most concise versions for the knowledge base.
- Stratification: Tasks are ranked by difficulty based on their success rates during sampling.
- Adaptive Selection: The system selects "hard-earned experiences"—successful solutions to difficult tasks—to serve as few-shot demonstrations for the next, more complex iteration. This creates a self-generated curriculum.
Benchmarking on STeP
The system was evaluated using a new benchmark for STeP (Streaming Tensor Programs), an emerging ASPL for next-generation dataflow architectures. The benchmark consists of 26 tasks across eight critical operator groups, including Matrix Multiplication, FlashAttention variants, and Mixture-of-Experts (MoE) routers. Because STeP code does not exist in the training data of current LLMs, it provides a rigorous test of zero-shot reasoning and self-improvement capabilities.
Key Results and Insights
The research yielded several significant findings:
- Performance Multiplier: The system achieved up to a 3.9× performance boost in Pass@n metrics compared to a standard, non-agentic LLM baseline.
- High Task Completion: The system successfully solved up to 96% of the tasks in the STeP benchmark.
- The Value of Difficulty: A key insight was that using successful solutions from difficult tasks as demonstrations was significantly more effective than using easy ones. This "hard-earned experience" provides the model with better heuristics for navigating complex constraints.
- Model Agnostic Success: The framework proved effective across various state-of-the-art models, including Claude 3.5 Sonnet, GPT-4o, and Llama 3.1-405B. Notably, the system allowed Claude 3.5 to outperform the more computationally expensive OpenAI-o1 on several specialized tasks.
Conclusion and Future Work
The Adaptive Self-improvement Agentic System demonstrates that LLMs can overcome the lack of domain-specific training data by leveraging structured feedback and self-curated curricula. While the system currently relies on a functional verifier (like PyTorch) and human-defined primitives, it represents a major step toward autonomous software engineering for specialized hardware. Future research will focus on automating the discovery of these primitives and optimizing the selection of experiences as the system's "memory" grows beyond the context window limits of current models.
Summary updated