arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2603.27423cs.AIcs.SE
收藏

AstraAI:基于LLM、检索与AST引导的HPC代码库辅助系统

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

Mahesh Natarajan, Xiaoye Li, Weiqun Zhang

AI总结:

AstraAI通过整合LLM、RAG和AST分析,实现对复杂科学代码库的上下文感知代码生成,支持HPC环境中的代码修改与结构保持。

摘要:

我们提出了AstraAI,一个用于高性能计算软件开发的命令行编程框架。AstraAI直接在Linux终端运行,整合大型语言模型(LLMs)与检索增强生成(RAG)和基于抽象语法树(AST)的结构分析,以实现对复杂科学代码库的上下文感知代码生成。核心思想是构建一个高保真提示,传递给LLM进行推理。该提示通过RAG从底层框架代码库中检索相关代码片段,并通过AST分析提取结构上下文,为模型提供关于相关函数、数据结构和整体代码组织的精确信息。该框架设计用于在源代码中执行作用域修改,同时保持与周围代码的结构一致性。AstraAI支持本地托管的Hugging Face模型和通过美国科学云访问的API前沿模型,实现HPC环境中的灵活部署。系统生成的代码与现有项目结构和编程模式相一致。我们在AMReX中展示了AstraAI在代表性HPC代码生成任务中的应用,AMReX是受美国能源部支持的用于exascale应用的HPC软件基础设施。

英文摘要:

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.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑