Skip to content

MetaVul: automated discovery of agent harnesses for vulnerability detectionMetaVul: Agentic Harness Discovery for Vulnerability Detection

arXiv· arXiv:2610.40721· Ira Ceka, Arnav Garg, Ryan Lutz, Ting Zhang, Ratnadira Widyasari, Gail Kaiser, Baishakhi RayColumbia University; The Citadel; Monash University; University of Victoria; Columbia University, Department of Computer ScienceIndexed by this site · 22 days ago· Originally publishedTools

Quick read

Evaluation and benchmarks

Based on the paper PDF (AI-generated); refer to the original

The authors propose MetaVul, which uses an optimization loop to automatically discover the harness of a vulnerability detection agent; the authors state that on PrimeVul held-out, pairwise accuracy improves by up to 25.8 percentage points.

Questions
When LLM agents perform vulnerability detection, distinguishing vulnerable functions from their patched versions is difficult, and detection accuracy depends on a hand-written fixed harness that is hard to improve based on evaluation feedback and hard to transfer across datasets and models.
Methods
MetaVul starts from the SCoT seed harness; the optimizer agent iteratively rewrites the harness based on validation set feedback, the detector agent evaluates in a sandbox, Pareto selection is performed by pairwise accuracy and joint hit rate, and then it is tested on held-out data and unseen models.
Experiments and results
Authors report: validation-set pairwise accuracy improves 11.4–23.3 percentage points; on held-out PrimeVul improves 5.6–25.8 points; transfer to unseen models improves 4.7–14.7 points; on GPT-4o correctly discriminates 103/435 pairs, higher than the compared methods; the authors state no evidence of shortcut exploitation was found.
Limitations and future work
The authors note: the optimizer and detector use the same model, only one seed harness was tested, the contributions of the workspace components were not separated, only C/C++ function-level detection is covered, API cost limits the number of iterations and repetitions, and training data contamination cannot be fully ruled out.
Experimental setupOpus 4.6、DeepSeek V4 Flash et al. · TitanVul、CWEval et al. · pairwise accuracy、joint hit rate et al.
Evaluated models
Opus 4.6DeepSeek V4 FlashInkling-SmallGLM-5.3Opus 5Nemotron 3.5 LightningGLM-4.7 FlashGPT-OSS-120BGPT-4o
Benchmarks
TitanVulCWEvalPrimeVul
Metrics
pairwise accuracyjoint hit rateaccuracyprecisionrecallF1FPRCWE accuracyLoc F1loc hit rate
AI summaryThe research team proposes MetaVul, which uses a workflow-style optimization loop to automatically search for an agent harness for vulnerability detection. The method starts from a structured reasoning scaffold and iteratively improves the harness with feedback from paired vulnerable functions and fixed functions, while preserving the original structured reasoning and decision format; each round searches the trajectories, logs and metrics of historical harnesses, and finally returns a set of Pareto-optimal harnesses. On a 202-pair validation set, the optimized harness improved paired vulnerability detection accuracy by up to 23.3 percentage points; on a 430-pair held-out set not used in optimization, the Pareto-frontier harness improved it by up to 25.8 percentage points. A harness learned on one model also transfers to other models, improving by 14.7 percentage points on the held-out set without further optimization.

The research team proposes MetaVul, which uses a workflow-style optimization loop to automatically search for an agent harness for vulnerability detection. The method starts from a structured reasoning scaffold and iteratively improves the harness with feedback from paired vulnerable functions and fixed functions, while preserving the original structured reasoning and decision format; each round searches the trajectories, logs and metrics of historical harnesses, and finally returns a set of Pareto-optimal harnesses. On a 202-pair validation set, the optimized harness improved paired vulnerability detection accuracy by up to 23.3 percentage points; on a 430-pair held-out set not used in optimization, the Pareto-frontier harness improved it by up to 25.8 percentage points. A harness learned on one model also transfers to other models, improving by 14.7 percentage points on the held-out set without further optimization.

Paper analysis

6 questions; open one to read the full answer

  1. What problem does this paper attempt to solve?

    The accuracy of LLM vulnerability detection agents depends on a hand-written fixed harness; the authors propose a framework that automatically optimizes the harness.

    Core problem: the accuracy of LLM agent vulnerability detection depends largely on the harness (the scaffolding code wrapping the model), and existing harnesses are mostly hand-written and fixed, unable to adapt based on evaluation feedback.

    • Setting and motivation: the authors state that the growing scale of AI-assisted code generation makes vulnerability detection more important; false positives are costly, and security analysts face alert fatigue, a problem present in both traditional tools and LLM detectors (the introduction cites Tariq et al., 2025 and others).
    • Shortcomings of existing methods: the authors state that existing harness optimization work has not targeted vulnerability detection, nor incorporated safety objectives such as CWE identification, vulnerability localization, and vulnerability-patch discrimination; Ding et al. (2024) show that models are close to random guessing on PrimeVul paired evaluation.
    • Core observation: the authors argue that merely strengthening the underlying model cannot replace harness design—they cite an independent report from April 2026 stating that Claude Opus 4.6 also struggles to reliably distinguish vulnerable functions from their patches (Walker, 2026).
    • Paper proposes: MetaVul, a self-improving harness discovery framework: starting from a SCoT seed harness, it uses an optimization loop to iteratively rewrite the harness based on feedback from paired vulnerable/patch functions, returns a Pareto-optimal set of harnesses, and tests generalization on held-out data and unseen models.
    • Research questions: RQ1 whether optimization improves the harness and whether the gains transfer to unseen data and models; RQ2 comparison with other LLM/multi-agent detection methods; RQ3 whether the gains depend on shortcuts such as data leakage, embedded answers, or verdict bias.
  2. What related research exists?

    Related work falls into three groups: LLM vulnerability detection, harness engineering and optimization, and code reasoning strategies; the authors state that none of them performs harness optimization for vulnerability detection.

    LLM vulnerability detection

    • Ding et al. (2024): proposed PrimeVul and pairwise accuracy, noting that traditional accuracy/F1 are insufficient and that models are close to random on paired evaluation; CoT prompting (Wei et al., 2022) outperforms two-shot but remains below random level.
    • GPTLens (Hu et al., 2023), VulTrial (Widyasari et al., 2026), ConfColl (Tsai et al., 2025): respectively an auditor-critic dual-role method, a courtroom-style debate multi-agent method, and a sequential method that escalates to multiple agents on demand, all with GPT-4o as the backbone. The paper states that unlike these three, MetaVul keeps only a single detector agent and instead optimizes its harness.
    • Li et al. (2026a): an empirical study of project-level LLM vulnerability detection, reporting low recall, a high false discovery rate, and high computational cost.

    Harness engineering and optimization

    • GEPA (Agrawal et al., 2026), SecureForge (Liu et al., 2026): respectively optimize prompts from execution trajectories and optimize system prompts for secure code generation.
    • Meta-Harness, MemoHarness, DarwinX, StarHarness, TTHE, OneDayAgent (2026): explore harness adaptation based on execution experience, search, held-out selection, test-time adaptation, and long-horizon execution.
    • HarnessOpt-Bench, Evo-Bench, HarnessDev, Wang et al. (2026): evaluate models' ability to build/improve harnesses; the paper cites HarnessDev as saying that a harness may overfit the model that wrote it, and cites Wang et al. as saying that when optimization and evaluation share tasks, the gains largely disappear on held-out tasks.

    Code reasoning strategies

    • SCoT (Li et al., 2023), MoT (Pan & Zhang, 2025), ToT (Yao et al., 2023): respectively structured chain of thought, modular decomposition, and multi-path exploration. MetaVul's seed harness is based on SCoT.

    Baselines and benchmarks

    • Comparison baselines: Ding et al.'s CoT, GPTLens, VulTrial, ConfColl (all with GPT-4o backbone, results taken from prior work), compared on PrimeVul (Table 2).

    Authors' positioning: to their knowledge, none of the above work does harness optimization for vulnerability detection, nor tests transfer of a harness to unseen datasets and models; MetaVul performs automatic optimization with pairwise accuracy and joint CWE/line localization as safety objectives.

  3. How does the paper address this problem?

    MetaVul uses an optimizer/detector dual-role loop to iteratively rewrite the harness, and performs Pareto selection by pairwise accuracy and joint hit rate.

    Overall approach: MetaVul separates harness discovery from evaluation—the optimizer agent (Aopt) rewrites the harness based on validation set feedback, the isolated detector agent (Adet) evaluates each candidate, and after the loop ends it returns the Pareto-frontier harnesses, which are then evaluated frozen on held-out PrimeVul and on unseen models (Figure 1, Algorithm 1).

    Discovery loop and roles

    • Process: first evaluate the seed h0; in each round t, Aopt proposes ht based on the historical workspace, and Adet evaluates it on the validation set D to obtain metrics and predictions; stop after T=15 rounds or when pairwise accuracy shows no improvement for K=4 consecutive rounds.
    • Role isolation: Aopt and Adet may use the same model, but they run separately and do not share state; Aopt can only read its own workspace (historical harnesses, metrics, labeled predictions), while Adet is started fresh each time and sees only the rendered harness and one function.
    • Constraint: rewrites must preserve the SCoT structured reasoning and verdict output format (Algorithm 1, line 6).

    Pareto selection

    • Two objectives: pairwise accuracy and joint hit rate on the validation set, both maximized; A dominates B if A is no lower than B on both metrics and higher on at least one, the frontier F is the set of non-dominated harnesses, and ties keep the earliest one.

    Sandbox and contamination prevention

    • Optimizer sandbox: the Claude Code working directory is limited to the workspace, read/write/edit tools are disabled, the shell is read-only, and CLAUDE.md and user settings are not loaded; Codex uses an OS-level sandbox, read-only, no writes, no network.
    • Detector sandbox: no workspace, no labels, no trajectories, no memory across calls; Claude Code runs under /tmp with no tools and an empty system prompt, and Codex runs in an empty temporary directory, read-only, with no network.
    • Held-out isolation: PrimeVul evaluation and transfer results are never written to any workspace, and the optimizer never sees PrimeVul.

    Metric definitions

    • Pairwise accuracy: PairAcc(f) = 1/N∑i=1N 1[f(xiv)=1 ∧ f(xip)=0], i.e., the proportion of pairs in which the vulnerable function is judged vulnerable and its patch is judged safe; this is the target metric of Algorithm 1.
    • Joint hit rate: Joint = 1/(|T|)∑i∈ T 1[ĉi(1) ∈ Ci] · 1[Ĝi ∩ Gi ≠ ∅], i.e., among correctly labeled vulnerable functions, the proportion where the first CWE guess is correct and at least one gold line is hit; gold lines are derived from the lines modified/deleted by the patch.
    • Others: accuracy, precision, recall, F1, FPR, CWE accuracy, Loc F1, loc hit rate; functions that fail to parse are counted as errors and remain in the denominator.

    Seeds and configuration

    • Seed harness: a 151-line SCoT harness (Supp. S3); the authors state that in preliminary experiments SCoT's accuracy and precision were higher than plain instructions, MoT, and ToT.
    • Agents: Codex CLI and Claude Code; optimization models are Inkling-Small, DeepSeek V4 Flash, Opus 4.6, GLM-5.3; transfer models are Opus 5, Nemotron 3.5 Lightning, GPT-4o, GLM-4.7 Flash, GPT-OSS-120B.
    • Iterations: all at most 15 rounds; Inkling-Small and DeepSeek V4 Flash ran the full 15 rounds, GLM-5.3 stopped at round 8 due to patience, and Opus 4.6 ran only 4 rounds due to subscription quota limits.
  4. What experiments did the paper conduct?

    All four optimization runs improved pairwise accuracy on the validation set; the gains held on held-out PrimeVul and unseen models, and on GPT-4o it outperformed the compared methods.

    Experimental Setup

    • Datasets: Validation set D is TitanVul (150 pairs, stratified sampling by CWE frequency) + CWEval (all 52 C/C++ tasks), totaling 202 pairs (404 functions, 161 C, 41 C++, 72 CWEs); held-out is the PrimeVul paired test set, 430 pairs after removing 5 pairs overlapping with D (860 functions, 141 projects, 61 CWEs) (Table 1).
    • Optimization models: Inkling-Small, DeepSeek V4 Flash (Codex CLI); Opus 4.6, GLM-5.3 (Claude Code).
    • Transfer models: Nemotron 3.5 Lightning, GLM-4.7 Flash, Opus 5, GPT-OSS-120B; RQ2 additionally uses GPT-4o.
    • Baselines: Ding et al.'s CoT, GPTLens, VulTrial, ConfColl (GPT-4o backbone, results taken from prior work).
    • Metrics: pairwise accuracy (primary objective), joint hit rate, accuracy, precision, recall, F1, FPR, CWE accuracy, Loc F1, loc hit rate.
    • Review method: RQ3 uses GPT-OSS-120B as judge, scoring all 44 harness texts on three items (retains SCoT, no prohibited content, retains output format) on a 0–4 scale.
    • Number of repetitions: the paper does not report the number of repeated runs; overall parse failure rate 0.36%, single-run maximum 0.63%.

    Main Results

    Pairwise accuracy (%), seed → best value per setting, labels taken from Figure 3 annotations; improvement points taken from Section 5 of the main text.

    Swipe horizontally to read the table

    Settingseedbestimprovement (points)
    Validation (Inkling-Small)8.830.1*+21.3
    Validation (DeepSeek V4 Flash)6.428.2*+21.8
    Validation (Opus 4.6)10.533.8*+23.3
    Validation (GLM-5.3)14.425.8*+11.4
    Held-out (Inkling-Small)12.824.7*+11.9
    Held-out (DeepSeek V4 Flash)13.339.1+25.8
    Held-out (Opus 4.6)10.418.8*+8.4
    Held-out (GLM-5.3)14.420.0*+5.6

    *The main text gives the improvement points and seed values; the best values are obtained by adding the two; annotated values visible in Figure 3 include held-out DeepSeek 39.1, transfer Opus 5 36.1, transfer GLM-4.7 Flash 27.9, held-out Inkling-Small 24.0, transfer GPT-OSS-120B 20.7, etc.; some annotations cannot be matched one-to-one with the series in the text conversion.

    • Authors state: all four runs improve on the validation set, and all 40 discovered harnesses outperform the seed; in all 8 held-out and transfer evaluations the frontier harnesses outperform the seed (Figure 3).
    • Improvement from transfer to unseen models: Nemotron 3.5 Lightning +8.4, GLM-4.7 Flash +7.9, Opus 5 +14.7, GPT-OSS-120B +4.7 points (Section 5 of the main text).
    • Authors state: pairwise accuracy generally rises with precision and falls with recall; its relationship with joint hit rate varies by model (negative correlation for Inkling-Small and DeepSeek V4 Flash, positive correlation for GLM-5.3, Supp. Table S5.2); of the 40 harnesses only 10 improved localization (Supp. Table S5.3).

    RQ2: Comparison with Other Methods (Table 2)

    • Setup: randomly select the 6 harnesses with the highest validation pairwise accuracy from the DeepSeek V4 Flash discovery run and transfer them to GPT-4o (not all tested due to budget), plus testing round 7; Table 2 reports iter 12 (the highest-accuracy among the transferred harnesses).
    • Results: iter 12 correctly discriminates 103 of 435 pairs (P-C=103, Error=332, accuracy 0.5483, FPR 0.3310), seed is 74 pairs; among prior methods VulTrial is highest at 81 pairs. After removing the 5 overlapping pairs it is 100/430.
    • Authors' interpretation: the authors state that MetaVul surpasses multi-agent methods with a single detector agent, and that this result is budget-limited and should not be viewed as an upper bound.

    RQ3: Optimization Integrity (Table 3)

    • What was tested: verifying that the optimizer cannot access PrimeVul during the discovery phase; a GPT-OSS-120B judge checks 44 harness texts.
    • Results: all 11 Pareto-frontier harnesses score 4/4 on retaining SCoT and avoiding prohibited content; 2 have lower output-format scores (the authors state this is a quality issue rather than a shortcut); all frontier harnesses reduce false positives by 33%–60% and reduce the total number of functions flagged as vulnerable by 31%–49%.
    • Authors' interpretation: the authors state they found no evidence of data leakage, embedded answers, or increased flagging tendency.

    Other Ablations and Analyses

    • Data contamination check: GPT-4o's training cutoff (October 2023) predates the release of the three benchmarks, and the harness learned by DeepSeek V4 Flash still improves on it (correct pairs 79–101 vs. 71, Supp. S7); the seed's pairwise accuracy is near the lower bound (10.5%); grouping by CVE year (2008–2022) shows no monotonic trend (Section 8).
    • Workspace ablation: preliminary experiments removing workspace components step by step are inconclusive (Supp. S11, Section 8).
    • Failed iterations: GLM-5.3 stops after round 8 due to patience; Opus 4.6 has only 4 rounds due to subscription quota; round 13 in the GPT-4o transfer is incomplete (the "No metric" annotation in Figure 3 marks iterations where the optimizer failed or returned an invalid harness).
  5. What are some points that can be further explored?

    The authors list six limitations (same model in both roles, single seed, component contributions not separated, limited to C/C++ function level, cost, contamination) and give directions for future work.

    Limitations and Future Directions Noted by the Authors

    • Same model in dual roles: in the discovery phase the optimizer and detector use the same model; the authors state that cross-model transfer experiments mitigate this risk (Sec. 8).
    • Seed harness: only one seed, SCoT, was tested; the seed space is too large to test whether other seeds produce different or better harnesses (Sec. 8).
    • Component contributions not separated: it is not determined which parts of the workspace (harness history, aggregate metrics, score history, per-sample predictions) bring the improvement; step-by-step ablation is inconclusive (Sec. 8, Supp. S11).
    • Language and granularity: all experiments are C/C++ function-level; results may not transfer to memory-safe or dynamically typed languages; detection has no repository-level context (Sec. 8).
    • Cost and infrastructure: API access is limited; subscription quotas and GPT-4o cost limit the number of iterations, repeated runs, and model pairings (Sec. 8).
    • Data contamination: it cannot be fully ruled out that the benchmarks appear in model training data; the authors give three observations suggesting it is unlikely (Sec. 8).
    • Future directions (Sec. 9): swap or pair different optimizer/detector (e.g., a small detector with a strong optimizer); directly study the trade-off among discrimination, localization, and CWE identification; start from different seeds; specification-driven harness design; provide the detector with precomputed data-flow graphs, program dependence graphs, call graphs; integrate with agentic exploit generation.

    Scope of Experimental Coverage

    • 4 optimization runs in total (Inkling-Small, DeepSeek V4 Flash, Opus 4.6, GLM-5.3), transfer evaluation on 4 models, RQ2 tests only the 6+1 harnesses from the DeepSeek V4 Flash run on GPT-4o (Sec. 6).
    • Data are C/C++ function pairs: validation 202 pairs, held-out 430 pairs (Table 1).
    • Iteration cap 15 rounds; Opus 4.6 only 4 rounds, GLM-5.3 stops at round 8 (Sec. 4.1).
    • The paper does not report the number of repeated runs or statistical significance tests.
    • Shortcut checks cover text review of 44 harnesses and access-isolation verification, with GPT-OSS-120B as judge (Sec. 7).
  6. Summarize the main content of the paper

    MetaVul automatically optimizes the vulnerability detection harness; the authors claim the gains hold on unseen data and models, and no evidence of shortcuts was found.

    MetaVul is a harness automatic discovery framework for vulnerability detection, addressing the problem that LLM agent detection accuracy depends on hand-written fixed harnesses.

    • Method: Starting from a 151-line SCoT seed harness, an optimizer agent iteratively rewrites the harness based on feedback from the TitanVul+CWEval validation set (202 pairs), and an isolated detector agent evaluates in a sandbox; Pareto selection is performed by pairwise accuracy and joint hit rate, without touching the held-out PrimeVul (430 pairs) throughout.
    • RQ1: Four runs improve validation-set pairwise accuracy by 11.4–23.3 percentage points (Opus 4.6 highest +23.3); on held-out PrimeVul the improvement is 5.6–25.8 points (DeepSeek V4 Flash highest +25.8); transfer to unseen models improves 4.7–14.7 points (Opus 5 +14.7) (Figure 2, 3).
    • RQ2: On GPT-4o, the transferred iter 12 harness correctly discriminates 103/435 pairs, higher than the seed's 74 and the highest of prior methods at 81 (VulTrial), and uses a single detector agent (Table 2).
    • RQ3: All 11 Pareto-frontier harnesses pass the SCoT retention and prohibited-content checks, with false positives reduced by 33%–60%; the authors state they found no evidence of data leakage, embedded answers, or judgment bias (Table 3).
    • Authors' conclusion: The authors state that MetaVul addresses both the false-positive and generalization challenges, and consider it meaningful for codebase auditing, filtering before exploit generation, and triage.
    • Limitations: optimizer and detector are the same model, single seed, C/C++ function-level only, cost limits iterations and repetitions, cannot fully rule out training-data contamination (Sec. 8).
Read originalarxiv.org