arXiv:2601.11688cs.SEcs.AI2026-01被引 1

用大模型分层解析数据手册与代码的对应关系,提升嵌入式系统可追溯性。

SpecMap: Hierarchical LLM Agent for Datasheet-to-Code Traceability Link Recovery in Systems Engineering

  • 分三步缩小匹配范围:先分析仓库结构,再估文件相关性,最后对符号精细对齐。
  • 在多个开源项目上实现73.3%的文件级映射准确率,显著优于传统方法。
  • 适合嵌入式系统开发、合规验证与自动化测试等场景,节省大量计算资源。

在嵌入式系统中,建立数据手册与代码实现之间的精确可追溯性仍是系统工程中的核心挑战,尤其对于低层软件,手动将规格文档与大型代码库匹配已不可行。现有可追溯性链接恢复方法主要依赖词汇相似性和信息检索技术,难以捕捉嵌入式软件中常见的语义、结构和符号层面的关系。本文提出一种分层的数据手册到代码映射方法,利用大语言模型进行语义分析,并显式构建多抽象层级的可追溯流程。该方法不直接进行规格到代码的匹配,而是通过仓库级结构推断、文件级相关性估计和细粒度符号级对齐逐步缩小搜索空间。该方法不仅覆盖函数,还显式处理宏、结构体、常量、配置参数和寄存器定义等系统级C/C++代码常见元素。我们在多个开源嵌入式系统仓库上使用人工标注的基准数据进行了评估。实验结果表明,相比传统基于信息检索的基线,本方法在文件映射准确率上提升显著,最高达73.3%。同时,总LLM token消耗降低84%,端到端运行时间减少约80%。该方法支持对大型嵌入式软件系统的自动化分析,可应用于系统感知机器学习模型的训练数据生成、标准合规性验证及大规模规格覆盖率分析。

原文摘要 · Abstract (English)

Establishing precise traceability between embedded systems datasheets and their corresponding code implementations remains a fundamental challenge in systems engineering, particularly for low-level software where manual mapping between specification documents and large code repositories is infeasible. Existing Traceability Link Recovery approaches primarily rely on lexical similarity and information retrieval techniques, which struggle to capture the semantic, structural, and symbol level relationships prevalent in embedded systems software. We present a hierarchical datasheet-to-code mapping methodology that employs large language models for semantic analysis while explicitly structuring the traceability process across multiple abstraction levels. Rather than performing direct specification-to-code matching, the proposed approach progressively narrows the search space through repository-level structure inference, file-level relevance estimation, and fine-grained symbollevel alignment. The method extends beyond function-centric mapping by explicitly covering macros, structs, constants, configuration parameters, and register definitions commonly found in systems-level C/C++ codebases. We evaluate the approach on multiple open-source embedded systems repositories using manually curated datasheet-to-code ground truth. Experimental results show substantial improvements over traditional information-retrieval-based baselines, achieving up to 73.3% file mapping accuracy. We significantly reduce computational overhead, lowering total LLM token consumption by 84% and end-to-end runtime by approximately 80%. This methodology supports automated analysis of large embedded software systems and enables downstream applications such as training data generation for systems-aware machine learning models, standards compliance verification, and large-scale specification coverage analysis.

系统工程代码可追溯性大模型应用嵌入式系统

Thank you to arXiv for use of its open access interoperability. PaperDance 不是 arXiv 官方产品;中文卡片由大模型生成,请以原文为准。