An individual researcher has demonstrated that modern agentic LLMs can significantly optimize Rust code through continuous, iterative prompting. By providing agents with specific performance targets and allowing them to iterate until benchmarks converge, the researcher achieved cumulative speedups ranging from 2x to 32x over initial implementations.
Agentic LLM Iterations Achieve 32x Speedups in Rust Code Optimization
The process involves using specialized "Ur-Prompts" and "breakthrough" instructions that encourage models to move beyond simple hyperparameter tuning toward fundamental algorithmic reimplementation. Key constraints, such as forbidding unsafe code and preventing benchmark gaming, were implemented to ensure the resulting code remained robust and high-quality.
Tested applications included machine learning algorithms like UMAP, gradient-boosted decision trees (GBDT), and even utility libraries like templating engines and ASCII art renderers. The researcher noted that even when models were tasked with refactoring existing code to reduce lines of code, the agentic process often resulted in further performance gains. The optimized Rust crates developed through this method are intended for eventual open-source release under the MIT License.
Sources
- Writing Rust code that's fast by asking agents to make the code faster (Hacker News Frontpage, 2026-09-22)