AI & ML Practical Magic

An automated system generates C++ code that runs nearly 10 times faster than the best work of human performance engineers.

April 23, 2026

Original Paper

RECURSUM: Automated Code Generation for Recurrence Relations Exceeds Expert Optimization via LayeredCodegen

arXiv · 2604.18585

The Takeaway

RECURSUM uses a layered DSL to optimize recurrence relations beyond the limits of manual human tuning. The generated code achieves a 9.8x speed increase over expert-optimized versions. This proves that for specific, mathematically intense tasks, AI can now outperform the most skilled human specialists. The field has long viewed expert hand-tuning as the gold standard for performance. This result suggests that human engineers should step back and let automated compilers handle low-level hardware optimization.

From the abstract

Automated code generation can systematically exceed expert hand-optimization for recurrence relations-computational primitives ubiquitous in orthogonal polynomials, special functions, numerical integration, and molecular integral evaluation. We present RECURSUM, a Python-based domain-specific language generating optimized C++ for arbitrary recurrence relations via three backends: template metaprogramming for compile-time evaluation, a novel LayeredCodegen backend with architectural optimizations