Agentic SLMs beat larger LLMs in sustainable radio astronomy code optimization
Researchers enhance small models to match LLMs while using far less energy for LOFAR telescope upgrades.
The LOFAR radio telescope upgrade requires a 40-fold increase in computational throughput, yet the community is committed to not expanding its energy budget. Traditional code optimization and porting to hardware accelerators become daunting tasks across a massive codebase. Researchers therefore turned to AI-driven optimization, but found that large language models (LLMs) are themselves energy-intensive. Their solution: enhance small language models (SLMs) with agentic techniques. They introduce a multi-sampling generation strategy that produces multiple candidate code variants per prompt, and a compiler feedback loop that feeds compilation results back into the model for iterative refinement. This allows SLMs to match or exceed the code quality of larger single-shot LLMs while using a fraction of the energy.
The approach is generic and extensible—it can incorporate retrieval-augmented generation (RAG) as well as static and dynamic analysis tools. In tests, all enhanced SLMs showed consistent improvements from compiler feedback, and multi-sampling often closed the gap with larger models. This work demonstrates that sustainable AI can enable high-performance scientific computing without sacrificing optimization quality. For the LOFAR upgrade, such AI assistance could significantly accelerate developer productivity and help meet the 40x compute target within strict energy constraints, offering a template for other large-scale scientific projects.
- Multi-sampling generation allows SLMs to produce multiple code variants and select the best, matching larger LLMs' output quality.
- Compiler feedback loop iteratively improves SLM-generated code without extra training, consistently boosting performance across models.
- The framework is generic: can incorporate RAG, static/dynamic analysis tools, and targets the LOFAR telescope's 40x compute upgrade without energy increases.
Why It Matters
Sustainable AI-driven code optimization enables massive scientific compute gains without skyrocketing energy use, a template for green high-performance computing.