YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
trustworthy — Are passing LLM-agent patches actually well-engineered?
Thesis: a patch that passes its tests is not necessarily a trustworthy /
well-engineered patch. We hold correctness constant — every analyzed patch
passes its FAIL_TO_PASS + PASS_TO_PASS tests — and measure intrinsic code
quality with 38 programmatically-computed metrics (drawn from highly-cited SE
literature plus opinionated tooling) and LLM-as-judge tournaments. If quality still differs across models when
all patches pass, "pass rate" is an incomplete proxy for agent quality.
Headline finding (summary in report_cleaned.md, exact numbers in
data/results/analysis.md): among 170 passing
feature patches from 10 models on 18 FeatBench tasks, the weak small models
(pangu-7B, qwen3.6-35B-MoE) are out-engineered by the frontier reference
(claude-opus-4.7, gpt-5.5) within-task on 18/18 tasks (Cliff's δ = +0.73,
bootstrap 95% CI excludes 0), driven by under-implementation. The 7B also
only solves 8/18 tasks. (We are explicit about a size confound — see Threats in
the report; we claim the weak-vs-frontier contrast, not a total 10-model order.)
Quickstart
The 18 base repositories are pinned as git submodules at their exact base_commit, so cloning
with --recurse-submodules rehydrates the precise trees the patches were written against (verified:
170/170 patches apply cleanly against them).
# 1. clone WITH the pinned base repos (or run the submodule step below after a plain clone)
git clone --recurse-submodules git@github.com:PGCodeLLM/trustworthy.git
cd trustworthy
git submodule update --init # only needed if you cloned without --recurse-submodules
# 2. set up the environment (pinned deps, Python 3.12)
uv venv --python 3.12 .venv
uv pip install --python .venv -r requirements.lock
# 3. run everything end-to-end (extract -> apply 170 patches -> 38 metrics -> stats -> judges)
./reproduce.sh
reproduce.sh creates the venv automatically if you skip step 2. The static lenses (metrics +
stats) need only the result-set zips; the LLM-judge lenses additionally need an OpenAI-compatible
endpoint (configurable via JUDGE_BASE_URL/JUDGE_API_KEY/JUDGE_MODEL) and are skipped cleanly if
it is unreachable. See report_cleaned.md for a short, plain-language summary
of the findings, and data/results/analysis.md for the exact numbers.
What we analyze
The MindDistiller trustworthy-18 eval run: per-model results_set_*.zip under
/shared_workspace_mfs/MindDistillor/data/results_sets/. Each trial's model patch
is git_diffs.agent["working.patch"]; task_name = instance; reward/state =
pass label; ground-truth gold_patch + tests come from the featbench dataset.
10 models × 18 tasks; only passing patches analyzed (one scaffold = opencode,
so scaffold is controlled).
Repository layout
report_cleaned.md # the write-up (read this) — plain-language summary of all findings
reproduce.sh # one-command end-to-end pipeline
requirements.lock # pinned deps (Python 3.12)
metrics/NN_<slug>/ # 38 static metrics (01–36, 38–39) + 37_llm_judge_tournament (README + paper.pdf each)
metrics/PAPER_SOURCES.md # provenance of every paper PDF
trustworthy/
schema/ # Pydantic v2 models (patch, parsed diff, metric results)
ingest/ # results_set_*.zip -> normalized PatchRecord
diffparse.py # unified diff -> ParsedDiff
apply.py # clone repo@base_commit + apply patch -> full post-patch files
calculators/ # one module per metric family; registry of all 36
run.py # CLI: run / table / inspect
analysis/close_loop.py # statistics: KW+FDR, Cliff's δ, bootstrap, within-task ranks
analysis/calibration/ # judge-calibration + quantitative taxonomy (paper track; see its README)
data/
minddistiller/<model>/ # extracted per-model trials
repos/, applied/ # cached base clones + reconstructed post-patch files
results/ # metrics_table.md/.csv, analysis.md, patch_metrics.jsonl
pilot_study/ # earlier 7-model pilot (reference only; NOT scored here)
The metrics: 36 static (7 families) + an LLM-judge tournament (37)
One folder per metric under metrics/, each with a concrete-implementation
README and (where one exists) the open-access source paper. Families:
change size/diffusion (Nagappan–Ball, Hassan, Kamei) · complexity (McCabe,
cognitive, CK, Halstead, MI, nesting) · code smells (DECOR/Moha, Marinescu,
Khomh, SATD/Potdar–Shihab, dead code/Romano) · reuse/clones (Roy–Cordy) ·
readability/docs (Buse–Weimer, comments, naming/Lawrie, docstrings, black,
pylint) · feature quality (gold locality & symbol recall, test contribution,
API surface/Chianti, test-overfit/Smith–Barr, error-handling, test-tampering,
dependency hygiene). Direction and "terrible-when" thresholds are in the glossary
of data/results/metrics_table.md.
Reproduce (100%, one command)
./reproduce.sh # extract zips -> clone+apply (170/170) -> 36 metrics -> statistics
Needs Python ≥3.11, git, the patch util, and the result-set zips. Outputs land
in data/results/. Deterministic given pinned requirements.lock (pylint/black/
pyflakes versions pinned; patch apply is fuzzy -F3 with a deterministic order).
Step-by-step instead of the script:
python -c "from trustworthy.ingest.minddistiller import prepare_root; prepare_root([55,56,57,58,59,61,62,63,64,65])"
python -c "from trustworthy.ingest.minddistiller import load_minddistiller; from trustworthy.apply import precompute; precompute(list(load_minddistiller()))"
python -m trustworthy.run run --source minddistiller # -> metrics_table.md/.csv, patch_metrics.jsonl
python -m analysis.close_loop # -> analysis.md (stats + takeaways)
Inspect one patch by hand (reset → apply → view in VS Code)
# print ready-to-run commands for a given model+instance:
python -m trustworthy.run inspect --model anthropic-claude-opus-4.7 --instance projectmesa__mesa-2502
That writes the patch to data/inspect/<model>__<instance>.patch and prints:
REPO=data/repos/projectmesa__mesa__54d7e28c4e81 # cached base clone
# 1) clean checkout of the base commit:
git clone https://github.com/projectmesa/mesa.git "$REPO"
git -C "$REPO" fetch --depth 1 origin <base_commit> && git -C "$REPO" checkout -q FETCH_HEAD
# 2) reset the repo to pristine base (undo any prior patch):
git -C "$REPO" checkout -- . && git -C "$REPO" clean -fdq
# 3) apply this model's patch (fuzzy; harness shifts line numbers):
patch -p1 -F3 --no-backup-if-mismatch -d "$REPO" -i data/inspect/<model>__<instance>.patch
# 4) examine:
git -C "$REPO" diff # terminal
code "$REPO" # open patched repo in VS Code
The human gold patch for the same task lives in the featbench config.json
(patch field) — diff the model's solution against it to see design divergence.
Statistical analysis
data/results/analysis.md is regenerated by analysis/close_loop.py and contains
six sections, each with a 🔑 Takeaway box: (1) task coverage, (2) engineering-
quality composite + Cliff's δ + bootstrap CI, (3) top discriminating metrics,
(4) within-task model×task ranks, (5) per-model consistency, (6) model-level
volume profile. Methodology: within-task rank-normalization, Kruskal–Wallis +
Benjamini–Hochberg FDR, Cliff's δ effect sizes, 10k-resample bootstrap CIs, and
Spearman-vs-churn flags for size-confounded metrics. See report_cleaned.md ("What to trust this
for") and data/results/analysis.md (per-section takeaways + threats) for the defensible reading.
Out of scope (and why)
Process/history/ownership metrics (agent patches have no VCS author history), runtime & execution-coverage metrics (need to run the suite, not a static diff), review-based metrics. The boundary is intentional: we judge the artifact statically.
- Downloads last month
- 8