The understanding of large-scale scientific software poses significant challenges due to its diverse codebase, extensive code length, and target computing architectures. The emergence of generative AI, specifically large language models (LLMs), provides novel pathways for understanding such complex scientific codes. This paper presents S3LLM, an LLM-based framework designed to enable the examination of source code, code metadata, and summarized information in conjunction with textual technical reports in an interactive, conversational manner through a user-friendly interface. S3LLM leverages open-source LLaMA-2 models to enhance code analysis through the automatic transformation of natural language queries into domain-specific language (DSL) queries. Specifically, it translates these queries into Feature Query Language (FQL), enabling efficient scanning and parsing of entire code repositories. In addition, S3LLM is equipped to handle diverse metadata types, including DOT, SQL, and customized formats. Furthermore, S3LLM incorporates retrieval augmented generation (RAG) and LangChain technologies to directly query extensive documents. S3LLM demonstrates the potential of using locally deployed open-source LLMs for the rapid understanding of large-scale scientific computing software, eliminating the need for extensive coding expertise, and thereby making the process more efficient and effective. S3LLM is available at https://github.com/ResponsibleAILab/s3llm.
翻译:大规模科学软件的理解因代码库多样、代码量庞大及目标计算架构复杂而面临显著挑战。生成式AI,特别是大型语言模型(LLM)的出现,为理解此类复杂科学代码提供了新途径。本文提出S3LLM——一种基于LLM的框架,可通过用户友好界面,以交互式对话方式联合分析源代码、代码元数据、摘要信息及文本技术报告。S3LLM利用开源LLaMA-2模型,通过将自然语言查询自动转化为领域特定语言(DSL)查询来增强代码分析能力。具体而言,它可将查询转化为特征查询语言(FQL),实现对完整代码库的高效扫描与解析。此外,S3LLM支持处理多种元数据类型,包括DOT、SQL及自定义格式。框架还整合了检索增强生成(RAG)与LangChain技术,可直接查询大规模文档资料。S3LLM展示了在本地部署开源LLM快速理解大规模科学计算软件的潜力,无需使用者具备深度编程专业知识,从而提升理解过程的效率与效能。S3LLM开源地址:https://github.com/ResponsibleAILab/s3llm