Source-linked AI summary
When Does the Dependency Graph Help Code-to-Architecture Mapping?
Rakhshanda Jabeen, Morgan Ericsson, Jonas Nordqvist, Anna Wingkvist
TL;DR
Missing or costly code-to-architecture mappings complicate checking whether implementation matches intended modules. The paper compares graph neural encoders with a graph-free model using shared features and self-training. Across ten systems, the neural models outperform the Naive Bayes reference, with GAT having the highest reported average F1 scores.
Problem
Code-to-architecture mappings are often missing, incomplete, or expensive to maintain, although conformance checking depends on mapping source entities to intended modules.
Source: §1 · p. 1Method
The paper models file-to-module assignment as semi-supervised node classification over a directed multi-relational dependency graph and compares GCN and GAT with a graph-free MLP using shared features and self-training.
Source: §1 · p. 2Results
Across ten systems and 100 runs per system, all three neural models outperform Naive Bayes on both metrics, and GAT's system-level median macro F1 is 83.5 and micro F1 is 92.2.
Source: §7 · p. 13Takeaways & Limitations
On Chrome, GAT and GCN outperform MLP by 22 and 19 macro-F1 points, respectively, while connectivity and homophily are observationally associated with where graph advantages appear.
Source: §7 · p. 13The ten systems do not span the full range of architectures, domains, practices, or languages, and Chrome is the only industrial-scale system.
Source: §6 · p. 12
Abstract
from arXiv · showhide
Architectural technical debt arises when a system's implementation drifts from its inten ded modular decomposition, while the mapping between source files and architectural modu les is missing, incomplete, or costly to maintain manually. We formulate code-to-archite cture mapping as semi-supervised node classification over a directed multi-relational de pendency graph, with files as nodes, typed dependencies as edges, and lexical features d erived from code identifiers and directory layout. Starting from a small labeled sample, an iterative self-training procedure expands the mapping to the remaining files. We com pare a graph convolutional network (GCN), a graph attention network (GAT), and a graph-f ree multi-layer perceptron (MLP), using identical features and training procedures for t he learned models, against a Naive Bayes reference. Across 100 runs on ten open-source J ava and C/C++ systems, all three neural models outperform the reference on both F1 metri cs. GAT achieves the highest averages of system-level median macro and micro F1, at 83.5 and 92.2, respectively, whereas MLP remains competitive or superior on several systems. On Chrome, the largest system with 18,343 files, GAT and GCN exceed MLP by 22 and 19 ma cro-F1 points, respectively, and have substantially fewer persistently misclassified fil es. Connectivity and homophily are associated with where neural message passing helps, w hile multi-relational aggregation outperforms a single merged edge type on every system for both GCN and GAT. A follow-up study finds that several model rankings depend on the training seed, qualifying smaller advantages without removing the large graph benefit ob served on Chrome.
1. Introduction
Architectural technical debt reflects drift between intended design and implementation, while missing or costly code-to-architecture mappings impede conformance checking. This study evaluates semi-supervised graph-based mapping against graph-free and non-neural approaches.
1. Introduction
- Architectural technical debt is a diffuse, relational gap between intended design and implementation that becomes expensive to detect and repay as it accumulates.The introduction motivates attention to whether code changes remain consistent with module structure, but does not establish that LLM-generated code causes architectural erosion.Source: §1 · p. 1
- Automated code-to-architecture mapping supports conformance checking, which depends on mapping source entities to intended architectural modules.Such mappings are often missing, incomplete, or expensive to maintain manually.Source: §1 · p. 1
- The study frames code-to-architecture mapping as semi-supervised node classification on a directed, multi-relational dependency graph, expanding a small labeled sample through iterative self-training.GCN and GAT are compared with a graph-free MLP using the same features and training procedure to examine dependency information's contribution.Source: §1 · p. 2
- The evaluation covers ten open-source Java and C/C++ systems and examines performance, dependency information's contribution, and sensitivity to dependency modeling choices.The study extends earlier work with C/C++ systems, Word2Vec identifier features, GAT and MLP comparisons, a corrected self-training pipeline, ablations, and seed-sensitivity analysis.Source: §1 · p. 2
2. Related Work
Prior code-to-architecture mapping combines lexical evidence and dependencies through fixed rules or flattened features, while graph representation learning has largely addressed architecture recovery. This study tests graph-based mapping against a graph-free baseline under shared features and self-training.
2. Related Work
- Earlier mapping approaches combined lexical similarity and dependency proximity through manually specified rules, then learned models flattened dependencies into entity-level features [29].Olsson et al. [29] reported that 15–20% of entities must be mapped beforehand for acceptable performance.Source: §2 · p. 2
- Language-model approaches address mapping and architecture recovery, while this study represents dependency types directly through relation-specific message passing [30].The cited recovery line infers the module set, whereas mapping assumes the intended modules are given.Source: §2 · p. 2
- Graph representation learning has used dependency structure for architecture recovery, but methods such as NEGAR and GAER discover modules through clustering rather than mapping files to a fixed module set.Related work also includes contrastive recovery results.Source: §2 · p. 2
- Earlier work [14] used Java systems and a GCN-based model, but did not isolate dependency-graph contributions from node features.The present study adds an identical-feature, identical-self-training graph-free neural baseline; encoder depth, dropout, and parameter count remain possible confounders.Source: §2 · p. 3
3. Methodology
The methodology treats file-to-module mapping as semi-supervised classification using lexical features and typed dependency relations. It constructs file features and a directed dependency graph, then compares graph encoders with a graph-free baseline.
3. Methodology
- The pipeline formulates code-to-architecture mapping as semi-supervised node classification and uses a GNN encoder followed by a classification head to assign modules.Figure 1 shows relation-specific encoders whose outputs are summed, transformed into embeddings, and used to produce module probabilities for classification and pseudo-labeling.Source: §3 · p. 3, Figure 1 · p. 3
3.1. Problem Formulation
- A small labeled subset anchors the task of assigning every remaining file to one of the fixed architectural modules in a transductive setting.Features and dependency structure for all files are available during training, while labels are available only for the labeled subset.Source: §3.1 · p. 3
3.2. Graph Construction
- The graph represents files as nodes, code identifiers and directory paths as features, and typed static dependencies as separate relations.Member-level dependencies are aggregated to their enclosing files, and repeated dependencies of the same type between an ordered file pair collapse to one edge.Source: §3.2 · p. 3, §3.2.2 · p. 4
3.2.1. Node Features
- Each file's intrinsic features combine code-identifier embeddings with a binary representation of its directory path.Identifiers are normalized and represented by the L2-normalized average of their Word2Vec embeddings; directory tokens are vectorized separately.Source: §3.2.1 · pp. 3–4
3.2.2. Static Dependencies (Edges)
- The graph preserves dependency type and direction, allowing the encoders to learn separate transformations for each relation.Edges point from the file where a dependency originates to the file it refers to; aggregation direction is treated as a modeling choice.Source: §3.2.2 · p. 4
3.3. Representation Learning
The study compares relation-aware GCN and GAT encoders with a lexical-feature-only MLP. The graph models aggregate dependency-neighbor information, whereas the MLP provides a graph-free comparison.
3.3. Representation Learning
- GCN and GAT use the same node features as the MLP but aggregate information from neighboring files through relation-specific message passing.The encoders feed embeddings to a shared form of linear classification head and softmax, but differ in neighbor use, aggregation weights, depth, and parameter count.Source: §3.3 · p. 4, §3.3.1 · p. 4
3.3.1. GNN Encoders
- Each GNN layer aggregates messages by dependency type, with separate learned transformations and a propagation scheme that selects incoming, outgoing, or both directions.Each added layer extends the receptive neighborhood by one dependency hop, and self-loops preserve each file's own features, including for files without neighbors.Source: §3.3.1 · pp. 4–5
3.3.2. Multi-layer Perceptron (MLP)
- The MLP uses each file's lexical features alone, without aggregating messages from neighboring files.Performance differences are consistent with a contribution from dependency information, but do not isolate graph aggregation alone because GAT adds parameters.Source: §3.3.2 · p. 5
3.4. Iterative Learning Framework
The framework applies a shared iterative self-training procedure across graph and graph-free encoders, expanding an initial labeled set with confident predictions. GCN and GAT use dependency-graph messages, while the MLP uses node features alone.
3.4. Iterative Learning Framework
- GCN and GAT aggregate messages from neighboring files using the dependency graph, whereas the MLP uses node features alone.All three encoders use the same self-training procedure and shared classification head.Source: §3.4 · p. 5
- Each encoder produces a file embedding that the shared classification head maps to probabilities over architectural modules.The highest module probability is the model’s confidence in its prediction for that file.Source: §3.4 · p. 5
- After warm-up on labeled files, the procedure promotes confident unlabeled predictions and revises disagreeing pseudo-labels above the confidence threshold.Ground-truth seed labels remain fixed; training continues on labeled and mapped files until no new confident files are found or the round limit is reached.Source: §3.4 · p. 5
4. Experiments
The experiments describe the benchmark systems, model and baseline configurations, and the metrics used to evaluate code-to-architecture mapping. They use existing ground-truth mappings and fixed splits for the comparisons.
4.1. Benchmark Systems
- The benchmark comprises ten Java and C/C++ systems with existing ground-truth mappings; Table 2 reports system properties, including files, modules, and typed dependencies.The mappings draw on prior benchmark sources, including expert-validated Bash and Chrome mappings and industry-partner mappings for HDF and HDC.Source: §4.1 · pp. 5–6, Table 2 · p. 6
- File-level dependency homophily counts ordered file pairs with dependencies once, while edge counts include distinct source, target, and dependency-type triples.Homophily is calculated on the merged directed graph; reported average degree counts typed edges.Source: §4.1 · p. 6
4.2. Experimental Configuration
- Neural models share a self-training schedule and feature setup, but differ in encoder depth, parameterization, and dropout use.GCN and GAT use two message-passing layers; the MLP uses one hidden layer, and only the graph encoders apply dropout.Source: §4.2 · p. 6
- Each run starts with 5% of files labeled, bounded between 30 and 200 before adding representatives for any missing modules, then uses up to four self-training rounds.The first 100 fixed splits are used, with confidence above 0.95 required to add pseudo-labels; a separate exploratory follow-up varies training seeds on selected comparisons.Source: §4.2 · p. 6
4.3. Baseline: Naive Bayes
- The reference is NBAttract, a semi-supervised Naive Bayes mapper that combines code text with module-level structural sentences.The study extends and re-implements NBA for C/C++ as well as Java, and notes that the Python adaptation is not claimed numerically equivalent to the original Java/Weka implementation.Source: §4.3 · pp. 6–7
4.4. Performance Evaluation
- Macro-F1 exposes performance on smaller modules in an imbalanced benchmark, while micro-F1 equals accuracy for this single-label exhaustive task.Macro-F1 averages per-module scores over modules represented in the evaluated ground-truth subset; micro-F1 includes all predictions.Source: §4.4 · p. 7
5. Results
Across ten systems, all three learned neural models outperform NBACDA, but no learned model dominates every system. Graph benefits and design-choice effects vary by system, and several rankings depend on training seed.
RQ1. Overall Effectiveness of C2A Mapping
- On Chrome, GAT and GCN exceed MLP by 21.8 and 19.0 macro-F1 points, respectively, but Chrome is the only large-scale system, so size generalization is unresolved.MLP has the highest macro F1 on A.UML, SH-3D, HDF, and HDC, while GAT leads on Chrome; the largest-system result alone cannot establish whether the graph advantage generalizes with size.Source: RQ1. Overall Effectiveness of C2A… · p. 7
- GAT achieves the highest system-level median averages—83.5 macro F1 and 92.2 micro F1—while all three neural methods outperform NBACDA on both metrics across all ten systems.GAT leads on six systems for macro F1 and eight for micro F1; MLP remains competitive or leads on several systems.Source: RQ1. Overall Effectiveness of C2A… · pp. 7, 9, Table 3 · p. 8
- Macro F1 varies more than micro F1, especially in small systems: HDC’s macro-F1 interquartile ranges are 13–14 points, versus about 8 points for micro F1.Variability is associated with the initial labeled-file count and, in some systems, connectivity; small modules can amplify changes in the labeled set.Source: RQ1. Overall Effectiveness of C2A… · p. 8, Figure 2 · p. 8
RQ2. Contribution of the Dependency Graph
- Sparse connectivity alone does not determine where message passing helps; low homophily is associated with GCN underperforming MLP on SH-3D and T.Mates, but the evidence establishes no encoder-selection rule.GAT is more competitive than GCN on those low-homophily systems, while both GNNs significantly underperform MLP on HDF.Source: RQ2. Contribution of the Dependency… · p. 9, RQ3. Sensitivity to Design Choices · p. 10
- On Chrome, 1,913 of 18,342 evaluated files are persistently wrong under MLP (10.4%), versus 213 under GCN (1.2%) and 204 under GAT (1.1%).Across the other nine systems, all three models’ pooled per-file error distributions concentrate near low error rates.Source: RQ2. Contribution of the Dependency… · p. 9, Figure 3 · p. 9
RQ3. Sensitivity to Design Choices
- Both GAT and GCN significantly outperform their merged-edge variants on every system and both metrics, with median macro-F1 gains ranging from 6.6 to 40.2 points for GAT and 8.1 to 32.7 for GCN.The multi-relational encoders have more parameters, so the comparison does not isolate relation typing from added capacity.Source: Figure 4 · p. 10, RQ3. Sensitivity to Design Choices · p. 10
- Two-layer depth and edge direction have system-dependent effects: two GAT layers benefit several systems, while reversed aggregation improves macro F1 on A.UML and Lucene.On Chrome, reversing GAT aggregation reduces persistently wrong files from 204 to 103 even as median macro F1 falls by 4.3 points; aggregate F1 and persistent-error counts can move differently.Source: RQ3. Sensitivity to Design Choices · pp. 10–11
- With fixed labeled splits, macro-F1 rankings change across seeds on several comparisons, but GAT’s Chrome advantage over MLP wins all 50 split-seed combinations by about 22.6 points.The adjusted interval for that Chrome comparison is [19.1, 26.6]; the follow-up supports the Lucene and Chrome advantages but qualifies closer rankings on SH-3D, T.Mates, and HDC.Source: RQ3. Sensitivity to Design Choices · pp. 11–12, Table 7 · p. 12
6. Threats to Validity
The validity of the findings is bounded by the benchmark scope, transductive setup, static dependency extraction, and choices in data, features, and comparisons.
External Validity
- Ten systems do not span the full range of architectures, domains, practices, or languages; Chromium alone represents industrial scale, and AI-generated code is unrepresented.Scalability observations therefore rest on one system, and results for systems primarily consisting of AI-generated code remain unknown.Source: §6 · p. 12
Internal Validity
- The transductive graph must be rebuilt and the model retrained after files or dependencies change, while static analysis can miss runtime edges or add imprecise ones.This makes the approach more suitable for periodic analyses than commit-time updates, and extraction errors can affect predictions.Source: §6 · p. 12
- Ground-truth mappings may be misaligned with analyzed versions or build configurations, and ambiguous or drifted file assignments can mislead training and evaluation.An incorrect assignment in the shared mapping can provide misleading supervision and penalize an architecturally plausible prediction.Source: §6 · p. 12
Construct Validity
- File-level evaluation requires one module label per file, so the models cannot represent files that implement multiple concerns or belong to multiple modules.The analysis follows the granularity of available ground-truth mappings.Source: §6 · p. 12
Internal Validity
- The primary experiment reuses labeled sets and seeds, confounding their contributions to variability; the crossed follow-up is exploratory, and tested deterministic controls do not establish universal repeatability.The follow-up covers ten splits and five seeds, with comparisons selected after the main experiment.Source: §6 · p. 12
Construct Validity
- Pseudo-label selection uses a fixed threshold based on softmax concentration rather than mapping quality, although evaluation covers the complete test set.This prevents models that pseudo-label fewer files from being evaluated on an easier subset.Source: §6 · pp. 12–13
- Folder hierarchies that closely match reference modules can make performance optimistic because paths partially reveal target assignments.This is a concern where directory structure aligns strongly with the reference decomposition.Source: §6 · p. 13
Internal Validity
- Encoder depth, dropout, and parameter count differ, so multi-relational advantages cannot be attributed solely to graph structure or relation typing; significance also depends on the comparison family.The NBA baseline is an adapted implementation rather than a numerically verified reproduction; persistent-error counts also depend on the threshold and test-set appearances.Source: §6 · p. 13
7. Conclusion
The study compares graph and graph-free semi-supervised mapping models across ten systems. Neural models outperform the Naive Bayes reference, with a pronounced Chrome result, while seed-dependent rankings qualify smaller advantages.
7. Conclusion
- Across ten systems and 100 runs per system, all three neural models outperform Naive Bayes on both metrics; GAT has the highest system-level median macro F1 (83.5) and micro F1 (92.2).MLP remains competitive or superior on several systems.Source: §7 · p. 13
- On Chrome, the benchmark’s largest system at 18,343 files, GAT and GCN outperform MLP by 22 and 19 macro-F1 points, respectively.MLP persistently misclassifies 10.4% of files observed in a test set, compared with 1.2% for GCN and 1.1% for GAT.Source: §7 · p. 13
- Separate transformations per dependency relation outperform a merged edge type on every system, while depth and direction have more system-dependent effects.Two GAT layers benefit several systems but are not uniformly preferable; reversal improves macro F1 on A.UML and Lucene, while on Chrome it lowers macro F1 but reduces persistent errors.Source: §7 · p. 13
- The crossed seed study supports the large graph advantage on Chrome and reversal advantage on Lucene, but several other rankings vary with training seed.Average advantages are not guarantees for an individual labeled set or training run.Source: §7 · p. 13
- The authors identify relation-type attention, finer-grained architectural information, and separating identifier from path features as directions for clarifying dependency information’s contribution.The proposed relation attention would address conflicting evidence; the current GAT already learns separate neighbor-attention parameters per relation.Source: §7 · p. 13
CRediT authorship contribution statement
The contribution statement assigns conceptualization to Rakhshanda Jabeen and Morgan Ericsson, software work to Jabeen and Ericsson, and supervision to Ericsson, Jonas Nordqvist, and Anna Wingkvist.
CRediT authorship contribution statement
- Jabeen led methodology, investigation, software, and the original draft; Ericsson reviewed software and writing, while Nordqvist and Wingkvist contributed supervision and writing review.Jabeen and Ericsson share conceptualization; Ericsson, Nordqvist, and Wingkvist share supervision.Source: CRediT authorship contribution statement · p. 13
Declaration of use of AI-assisted technologies
The authors report using AI tools to review the manuscript and experiment source code, then manually applying outputs and fixing code issues.
Declaration of use of AI-assisted technologies
- AI-tool outputs were used for manual manuscript updates and source-code fixes, with the authors taking responsibility for the manuscript and reproduction-package code.Source: Declaration of use of AI-assisted… · p. 13
Funding
Rakhshanda Jabeen received Knowledge Foundation-supported graduate-school funding, and the foundation had no role in the study or publication process.
- Rakhshanda Jabeen was supported by the Industrial Graduate School “Data Intensive Applications,” funded by the Knowledge Foundation, Sweden, under grant 20190336.Source: Funding · p. 13
- The Knowledge Foundation had no role in study design or in collecting, analyzing, or interpreting data.Source: Funding · p. 13
- The Knowledge Foundation had no role in manuscript preparation or the decision to submit the article for publication.Source: Funding · p. 13