Software architecture recovery improves file grouping with adaptive semantic neighborhoods
ASNER: Software Architecture Recovery with Adaptive Semantic Neighborhoods and Evidence-Grounded Refinement
Software Engineering
Summary
Understanding how a large software project is organized into parts can be tricky, especially when files that do similar jobs might not really belong to the same section. The authors created ASNER, a new way to group files by looking closely at how responsible each file is, adapting to the size and details of the project, and carefully checking uncertain cases with evidence. They tested ASNER on various programming languages and projects, and it worked better than past methods. ASNER also helps other tools find code parts more accurately by giving them a clearer idea of the software's structure.
What this means in practice
- •For software engineering teams: Improve software maintenance by automatically identifying accurate architectural components from source files in large codebases.
- •For software tooling developers: Enhance code localization tools by providing better architectural context to locate functions, modules, and files within repositories.
Authors
Wenhao Wang, Zhi Jin, Jia Li, Dongming Jin, Heng Tian, Yingtao Fang, Wenguang Ye, Tiankuo Zhao
Abstract
Automated software architecture recovery provides architectural context for software engineering and repository-level LLM agents. Existing methods combine structural and semantic signals, but functional relatedness does not necessarily imply shared architectural responsibility. Fixed thresholds or Top-K neighborhoods also ignore repository scale and local similarity distributions, introducing errors that propagate through clustering. Unconstrained LLM refinement may further alter correct assignments without sufficient evidence. We propose ASNER (Adaptive Semantic Neighborhoods and Evidence-Grounded Refinement for Software Architecture Recovery), based on responsibility-aware, project-adaptive relation modeling and evidence-grounded boundary verification. ASNER derives structured file responsibilities with an LLM, constructs semantic neighborhoods that adapt to repository scale and local similarity distributions, and augments a static dependency graph with selected semantic relations and weak directory cues. Community detection recovers the component backbone. A Responsibility-Ownership-Aware (ROA) Agent then examines uncertain boundary files using project-level responsibilities and traceable code evidence, changing assignments only when supported. Experiments on 12 open-source projects spanning C, C++, Java, and Python show that ASNER achieves the best macro-average on all five metrics on the common benchmark, improving ARI and c2c@66 over GAER-GAT by 19.5% and 32.9%, respectively. A downstream evaluation shows that ASNER-guided LocAgent improves file-, module-, and function-level code localization, demonstrating the value of its architectural context for repository-level software engineering tasks.