cs.AIMar 28, 2026

AstraAI: LLMs, Retrieval, and AST-Guided Assistance for HPC Codebases

Authors: Mahesh Natarajan, Xiaoye Li, Weiqun Zhang

Organizations: Applied Mathematics and Computational Research Division, Lawrence Berkeley National Laboratory, Berkeley, CA 94720, USA

Abstract

We present AstraAI, a command-line interface (CLI) coding framework for high-performance computing (HPC) software development. AstraAI operates directly within a Linux terminal and integrates large language models (LLMs) with Retrieval-Augmented Generation (RAG) and Abstract Syntax Tree (AST)-based structural analysis to enable context-aware code generation for complex scientific codebases. The central idea is to construct a high-fidelity prompt that is passed to the LLM for inference. This prompt augments the user request with relevant code snippets retrieved from the underlying framework codebase via RAG and structural context extracted from AST analysis, providing the model with precise information about relevant functions, data structures, and overall code organization. The framework is designed to perform scoped modifications to source code while preserving structural consistency with the surrounding code. AstraAI supports both locally hosted models from Hugging Face and API-based frontier models accessible via the American Science Cloud, enabling flexible deployment across HPC environments. The system generates code that aligns with existing project structures and programming patterns. We demonstrate AstraAI on representative HPC code generation tasks within AMReX, a DOE-supported HPC software infrastructure for exascale applications.

Figures & tables

Explore similar work

CardsList
  1. An Agentic Evaluation Framework for AI-Generated Scientific Code in PETSc

    Mar 16, 2026Hong Zhang, Barry Smith, Satish Balay +4High-Performance ComputingCode Generation

  2. Retrieval-Augmented Generation for Scientific Code Understanding

    Sep 10, 2026Aaron Nobile, Andreas Adelmann, Mohsen SadrRetrieval-Augmented GenerationLLM Grounding

  3. CodegenBench: Can LLMs Write Efficient Code Across Architectures?

    Jun 1, 2026Jie Li, Wenzhao Wu, Junqi Hu +5High-Performance ComputingCode Generation