Agent-based Defect Pattern Tagger (ADPT)
- Agent-based Defect Pattern Tagger (ADPT) is a system that uses specialized agents, LVLMs, and semantic pattern matching to convert raw artifacts into standardized defect tags.
- It orchestrates multi-phase processes including encoding, candidate generation, annotation, and self-questioning refinement to improve defect classification accuracy.
- Building on prior research, ADPT integrates rule-based, graph-aware, and adaptive memory approaches to provide structured, actionable defect insights across various domains.
Searching arXiv for the cited ADPT-related papers and closely related source frameworks. Agent-based Defect Pattern Tagger (ADPT) denotes an agentic approach to defect labeling in which specialized agents convert raw artifacts into standardized defect tags, often accompanied by confidence estimates, rationales, validation decisions, or repair suggestions. The name is introduced explicitly for category-level structural defect annotation using Large Vision-LLMs (LVLMs), semantic pattern matching, and iterative self-questioning refinement (Jiang et al., 1 Oct 2025). In adjacent software-engineering literature, ADPT is also used as a target architecture distilled from function-level just-in-time defect prediction and repair, context-adaptive requirements defect prediction, LLM-integration defect localization, and defect-impact analysis for deep learning libraries, while earlier work on review classification and AST-level repair-pattern detection provides important methodological antecedents for pattern induction and tagging (Ni et al., 2022, Unterbusch et al., 5 Jan 2026, Tan et al., 9 Jan 2026, Gao et al., 14 Jan 2026, Mangnoesing et al., 2020, Madeiral et al., 2018).
1. Conceptual scope and lineage
ADPT is grounded in the idea that defect tagging is not merely a flat classification problem. In the structural-inspection setting, the pipeline begins with raw images, produces concise defect-oriented descriptions, aligns them to predefined categories, and then re-verifies the label through Self-Questioning Refinement (SQR) before final routing (Jiang et al., 1 Oct 2025). In function-level software analysis, the same general objective appears as a tighter coupling of defect identification, multiclass defect categorization, and repair, with the core input represented as a clean/buggy/fixed triple over function bodies rather than a coarse commit label (Ni et al., 2022). In requirements engineering, defectiveness is framed as context-dependent rather than intrinsic to a text fragment, which motivates an adaptive memory of validated examples and explanations (Unterbusch et al., 5 Jan 2026). In LLM-integrated and deep-learning-library software, defect tagging is entangled with cross-layer reasoning over prompts, APIs, configurations, runtime artifacts, and downstream trigger conditions (Tan et al., 9 Jan 2026, Gao et al., 14 Jan 2026).
Earlier work establishes two important precedents. First, review mining shows that defect-related tags can be learned as lexico-semantic patterns through genetic programming and then applied as actionable labels such as defect reports and improvement requests (Mangnoesing et al., 2020). Second, automated repair-pattern detection demonstrates that patch tags can be defined as predicates over AST edit scripts and local code context, enabling systematic identification of repair idioms such as Missing Null-Check, Wrong Reference, and Conditional Block variants (Madeiral et al., 2018). Together, these lines of work suggest that ADPT is best understood not as a single model family but as a recurrent orchestration principle: represent the artifact in a domain-appropriate form, infer candidate defect patterns, validate them, and preserve structured evidence.
2. Agentic architecture and control flow
The canonical ADPT implementation for structural inspection is organized into four phases: encoding, generation, annotating, and refinement. Its sub-agents are the Orchestrator, Visual Analyst, Semantic Matcher, Refiner/Evaluator, and Storage Manager. The image is resized and normalized, encoded as Base64 inside a JSON payload, described by an LVLM, mapped to a defect category by semantic matching, and then re-examined by SQR; samples flagged as Incorrect or Uncertain are routed to an uncertain folder rather than finalized (Jiang et al., 1 Oct 2025).
Software-oriented ADPT designs preserve the same separation of concerns but alter the agents and state. The CompDefect-derived blueprint uses an Ingestion Agent, Feature Extraction Agent, Tagging Agent, Repair Agent, Evaluation Agent, and Orchestrator Agent. The online workflow is explicitly defined as: identify hunks, extract functions modified by each hunk, filter non-single-statement or out-of-scope changes, retrieve the previous function body, classify the clean/buggy pair, and attempt repair if the predicted class is non-clean and confidence is sufficient (Ni et al., 2022). The requirements-engineering variant replaces repair with human adaptation: Predictor Agent, Explainer Agent, Human Validator, Memory/Curator Agent, and optional Policy Agent operate in a feedback loop where validated examples and explanations are appended to memory and later reused as few-shot exemplars (Unterbusch et al., 5 Jan 2026).
The LLM-integration variant emphasizes heterogeneous evidence and causal validation. Its agents are Orchestrator, Knowledge Graph Builder, Evidence Miner / Analyzer, Candidate Ranker, Context-aware Validator, and Pattern Tagger. The pipeline constructs a repository-level code knowledge graph with LLM-aware annotations, mines three evidence sources, fuses and ranks candidates, applies counterfactual validation, and only then emits defect tags with confidence and remediation guidance (Tan et al., 9 Jan 2026). The deep-learning-library variant similarly relies on PR Miner, Code Diff Analyzer, Orchestrator Agent, and Impact Analyzer Agent, but it targets a different endpoint: a structured defect pattern plus a downstream Impact Report over client repositories (Gao et al., 14 Jan 2026).
Across these instantiations, a recurring control structure is visible. Factual stages differ by modality, but the common pattern is artifact ingestion, structured representation, provisional tagging, validation or refinement, and persistence of results for audit or future adaptation. A plausible implication is that ADPT’s central abstraction is not the classifier itself but the coordination boundary between specialized agents.
3. Representation, inference, and validation mechanisms
ADPT systems differ most sharply in how they represent evidence. In the structural LVLM formulation, the primary intermediate object is a natural-language description of the image. The description embedding is compared with category prototypes by cosine similarity,
and the assigned class is
An optional threshold can route low-similarity samples to uncertain, and SQR then re-prompts the LVLM with the image-description-label triple to return Correct, Incorrect, or Uncertain plus rationale (Jiang et al., 1 Oct 2025).
In function-level code tagging, representation is explicitly dual and graph-aware. Java code is parsed with tree-sitter into AST-derived tokens and data-flow graphs; variables become nodes, and data dependencies become directed edges. GraphCodeBERT encodes semantic and structural information, while the model input concatenates the clean and buggy function versions, and . A Neural Tensor Network models the relation between the two CLS embeddings, and the fused representation is classified over classes by
Repair is handled by a Transformer decoder with beam search of size $10$; if the classifier predicts clean, or if the generated candidate is invalid or below a probability threshold, the function is left unchanged (Ni et al., 2022).
The requirements variant formalizes defect prediction as adaptive classification over a requirement text , a detected pattern 0, project context 1, and validated memory 2, using
3
Memory is updated when a human validator accepts or corrects a prediction, and exemplar selection uses cosine similarity over embeddings, with a balanced top-4 policy that maintains defect and non-defect quotas and can privilege recency and explanation quality (Unterbusch et al., 5 Jan 2026). Here the rationale is not an auxiliary output; it is itself a conditioning signal for future predictions.
The LLM-integration variant adds graph reasoning and counterfactual validation. Its knowledge graph is defined as 5 with typed node sets spanning code, prompts, configuration files, API calls, tools, memory, and output pseudo-nodes. Candidate ranking uses fused evidence
6
optionally propagated across interaction-boundary edges with attenuation and boundary-specific boosts. Root-cause validation then applies artifact-level edits and measures whether the outcome changes materially through
7
Only validated candidates are passed to the Pattern Tagger, which computes tag confidence from fused evidence, counterfactual score, and pattern-specific features (Tan et al., 9 Jan 2026).
The deep-learning-library variant encodes a defect as a tuple
8
where 9 is semantics, 0 trigger constraints, 1 affected APIs/components, 2 configuration/environment constraints, and 3 metadata. Trigger satisfaction is formalized as
4
with 5 denoting extracted client-side code features and 6 environment attributes. This moves ADPT from local tagging toward conditional impact analysis: a defect pattern is not only named but operationalized as a predicate over client usage and runtime context (Gao et al., 14 Jan 2026).
Earlier pattern-oriented systems use lighter but still structured representations. App-review tagging learns GP trees over literals, POS tags, wildcards, entity types, and boolean or sequence operators, with precision-weighted 7 for individual pattern fitness and logical OR across the learned pattern group at inference time (Mangnoesing et al., 2020). Patch-pattern detection models a repair pattern as a predicate over an AST edit script
8
and local code context, enabling modular detectors that fire on characteristic edit sequences and node types (Madeiral et al., 2018).
4. Defect taxonomies and tagging schemas
The label space in ADPT is domain-specific rather than universal.
| Domain | Primary labels or schema | Source |
|---|---|---|
| Structural images | crack, efflorescence, scaling, corrosion, non-defect, uncertain | (Jiang et al., 1 Oct 2025) |
| Function-level code | 16 SStuBs defect patterns plus clean | (Ni et al., 2022) |
| Requirements text | weak words, vague pronouns, subjective language, passive voice, coordination/anaphoric ambiguity | (Unterbusch et al., 5 Jan 2026) |
| LLM agent systems | prompt-level, API/tool-level, configuration-level, orchestration-level, output-level defects | (Tan et al., 9 Jan 2026) |
| DL library updates | tuple 9 with triggers and affected APIs/components | (Gao et al., 14 Jan 2026) |
| App reviews | defect reports and improvement requests | (Mangnoesing et al., 2020) |
| Human-written patches | nine groups and 25 repair patterns | (Madeiral et al., 2018) |
In the structural setting, the categories are intentionally coarse and category-level rather than pixel-level. The framework is designed for dataset bootstrapping and routing into category folders, not for localization or segmentation (Jiang et al., 1 Oct 2025). In function-level software tagging, the taxonomy is more granular and explicitly mined from ManySStuBs4J and Function-SStuBs4J. The 16 categories include Change Identifier Used, Change Numeric Literal, Change Boolean Literal, Change Modifier, Wrong Function Name, Same Function More Args, Same Function Less Args, Same Function Change Caller, Same Function Swap Args, Change Binary Operator, Change Unary Operator, Change Operand, More Specific If, Less Specific If, Missing Throws Exception, and Delete Throws Exception, plus the clean class (Ni et al., 2022).
Requirements-oriented ADPT starts from high-recall pattern detectors and then uses adaptive classification to separate defective from benign cases in context. Its starter taxonomy includes weak words and vague quantifiers, vague pronouns and referents, subjective and unverifiable language, passive voice without clear agent, and coordination and anaphoric ambiguity (Unterbusch et al., 5 Jan 2026). The LLM-integration taxonomy is organized by layer: prompt-level patterns such as instruction ambiguity or missing variables, API/tool-level patterns such as parameter mismatch or missing tool responses, configuration-level patterns such as model/version mismatch, orchestration-level patterns such as stale memory/state, and output-level patterns such as schema non-compliance (Tan et al., 9 Jan 2026).
The deep-learning-library formulation shifts from enumerated labels toward structured defect semantics. A defect pattern is defined by what triggers the defect, which public APIs or modules expose it, and which environment constraints must hold downstream (Gao et al., 14 Jan 2026). Earlier tagging systems occupy two additional extremes. Review mining uses only two actionable labels—defect report and improvement request—while patch-pattern detection uses a much richer repair taxonomy comprising nine groups and 25 variants, including Conditional Block, Expression Fix, Wraps/Unwraps, Single Line, Wrong Reference, Missing Null-Check, Copy/Paste, Constant Change, and Code Moving (Mangnoesing et al., 2020, Madeiral et al., 2018).
5. Empirical evidence and reported performance
Direct evaluation under the ADPT name is reported for structural defect annotation. On a class-balanced dataset of 800 images, binary defective-versus-non-defective accuracy reaches up to 98%, with Gemini correctly identifying 393/400 defective and 391/400 non-defective images. In multi-class annotation, the reported range is 85%–98% across four defect categories under class-balanced settings, and with the optimal Gemini + FPB + SQR configuration, class-imbalanced evaluations retain 90.9% accuracy on the crack-only subset, 80.0% on the efflorescence-only subset, and per-class accuracies in the 80%–92% range on a composite multi-defect set (Jiang et al., 1 Oct 2025).
Several other results are central to ADPT-oriented designs but arise from source frameworks rather than from separate end-to-end ADPT implementations. CompDefect reports macro-averaged Precision 0.401, Recall 0.295, F1 0.319, AUC_OVO 0.723, and AUC_OVR 0.776 on Function-SStuBs4J, as well as commit-level binary identification Precision 0.750, Recall 0.619, F1 0.679, and AUC 0.785. Its repair module reports BLEU 0.964 and Accuracy 0.193 on the positive test set, versus SequenceR’s BLEU 0.734 and Accuracy 0.136, and BLEU 0.972 with Accuracy 0.232 on a leakage-filtered set (Ni et al., 2022).
The requirements HLC study reports strong adaptation from limited validated memory. On the QuRE benchmark of 1,266 balanced instances, zero-shot CoT yields Precision approximately 0.573, Recall approximately 0.997, and F1 approximately 0.728, while 20 validated examples with rationales raise performance to Precision approximately 0.679, Recall approximately 0.972, and F1 approximately 0.799. Larger shot pools show diminishing returns, and the approach outperforms fine-tuned BERT baselines while maintaining high recall (Unterbusch et al., 5 Jan 2026).
In LLM-integrated software, LIDL reports Top-3 accuracy 0.64 and MAP 0.48 on 146 real-world defects from 105 GitHub repositories and 16 agent-based systems, representing a 64.1% improvement over the best-performing baseline and a 92.5% cost reduction (Tan et al., 9 Jan 2026). In deep-learning-library defect analysis, DepRadar achieves 90% precision in defect identification on 157 PRs and 70 commits, generates high-quality structured fields with average field score 1.6, and on 122 client programs reports 90% recall and 80% precision for impact analysis; its ablations show that removing coordination drops defect extraction F1 to 68%, removing adaptive context drops it to 91%, removing the verification layer reduces impact precision from 80% to 66%, and removing domain mapping reduces impact recall from 90% to 76% (Gao et al., 14 Jan 2026).
The antecedent literature provides additional evidence for pattern-based tagging. Genetic-programming patterns for app reviews outperform manual patterns in F1 for both defect reports and improvement requests, with learned-pattern metrics of Precision 0.91, Recall 0.39, F1 0.54 for defects and Precision 0.79, Recall 0.51, F1 0.62 for improvements; automated pattern generation also reduces construction time from 18.75 hours to 5.9 hours (Mangnoesing et al., 2020). AST-level repair-pattern detection reports post-analysis Precision approximately 91.53%, Recall approximately 92.39%, and overall F1 approximately 92.1% on 395 Defects4J patches, with especially strong post-analysis results for Single Line, Missing Null-Check (Positive), and Wraps-with try-catch, each at 100% precision and 100% recall (Madeiral et al., 2018).
These metrics are not directly comparable across papers because the tasks range from image annotation and textual smell classification to function-level code categorization, defect localization, impact analysis, and patch-pattern tagging. What they do demonstrate is that agentic decomposition can coexist with very different supervision regimes: zero-shot LVLM annotation, supervised multiclass classification, rationale-driven few-shot adaptation, KG-based evidence fusion, and explicit rule-based AST matching.
6. Limitations, misconceptions, and likely directions
A common misconception is to treat ADPT as a single ready-made algorithm. The literature instead describes a family of architectures whose commonality lies in agent coordination, explicit defect schemas, and post-hoc validation. This suggests that ADPT is a reusable systems pattern rather than a stable model specification.
The limitations are correspondingly heterogeneous. The structural LVLM system is restricted to category-level labels, does not use ROI extraction or bounding boxes, and is sensitive to prompt design and visual overlap among categories such as scaling versus corrosion and efflorescence versus cracks; inference time, throughput, hardware needs, and API cost are not reported (Jiang et al., 1 Oct 2025). The function-level software variant focuses on single-statement fixes and 16 SStuBs patterns, is trained on Java open-source projects only, and explicitly notes uncertainty from SZZ tracing, message-based bug-fixing identification, and AST line mapping; it also reports no explicit ablations separating semantic versus structural features, clean versus buggy signals, or statistical significance tests (Ni et al., 2022). The requirements variant is prompt-sensitive, adapts to negotiated labels that may not transfer across teams, shows domain shift risk, and exhibits diminishing returns beyond roughly 20 exemplars (Unterbusch et al., 5 Jan 2026).
The LLM-integration and deep-learning-library variants add further concerns. LIDL can be affected by misleading logs, hallucination in symptom inference, incomplete KG coverage for custom frameworks, Python-centric assumptions, and the difficulty of reproducing runtime-only defects under LLM nondeterminism (Tan et al., 9 Jan 2026). DepRadar identifies failure modes involving test-only patches, sparse commit context, hallucinations despite verification, and triggers that depend on runtime paths or distributed topology not visible statically (Gao et al., 14 Jan 2026). Earlier pattern-based precursors also remain language- and domain-bound: app-review patterns were studied on Evernote reviews, and PPD is Java-only, syntactic in focus, and dependent on GumTree differencing quality (Mangnoesing et al., 2020, Madeiral et al., 2018).
Several forward directions recur across the literature. They include extending beyond single-statement or category-level tagging to richer repair or localization outputs, incorporating stronger retrieval or memory mechanisms, improving calibration and abstention policies, integrating static and dynamic evidence, and keeping human validation in the loop when uncertainty is irreducible. A plausible implication is that future ADPT systems will be judged less by raw tagging accuracy alone than by how well they combine structured evidence, calibrated confidence, and safe intervention boundaries.