evaluate 0 0 0

m-zest/trojanspec-bench

published by @m-zest

Alignment dataset tracked in the /datasets sub-catalog.

Lifetime downloads
323
Last 30 days
77
Likes
-
Size
89 KB
Created on HF
2026-05-20
Age
5 months ago

Description

TrojanSpec-Bench v4

1024 verifier-admitted adversarial formal specifications across Dafny,

Lean 4, and Verus - a benchmark for evaluating defenders against

specification-level Trojan attacks, where an AI specification

elicitor produces a spec that (1) the verifier accepts, (2) reads as

faithful English, but (3) does not actually entail the natural-language

requirement.

Source repository: https://github.com/m-zest/TrojanSpec-Bench-v1.0

(release v0.4.1). Interactive demo:… See the full description on the dataset page: https://huggingface.co/datasets/m-zest/trojanspec-bench.

Tags

task_categories:text-classificationlanguage:enlicense:cc-by-4.0size_categories:1K<n<10Kformat:parquetmodality:textlibrary:datasetslibrary:pandaslibrary:polarslibrary:mlcroissantarxiv:2602.11136arxiv:2506.10903region:usformal-methodsverificationsecuritydafnyleanverustrojan-detection

README current version from Hugging Face


license: cc-by-4.0
language:

  • en
    pretty_name: TrojanSpec-Bench v4
    size_categories:
  • 1K<n<10K
    task_categories:
  • text-classification
    tags:
  • formal-methods
  • verification
  • security
  • dafny
  • lean
  • verus
  • trojan-detection
    configs:
  • config_name: default
    data_files:
    • split: test
      path: data/test-*.parquet

TrojanSpec-Bench v4

1024 verifier-admitted adversarial formal specifications across Dafny,
Lean 4, and Verus
- a benchmark for evaluating defenders against
specification-level Trojan attacks, where an AI specification
elicitor produces a spec that (1) the verifier accepts, (2) reads as
faithful English, but (3) does not actually entail the natural-language
requirement.

Source repository: https://github.com/m-zest/TrojanSpec-Bench-v1.0
(release v0.4.1). Interactive demo:
https://huggingface.co/spaces/m-zest/specguard-demo.

Threat model

A developer asks an AI assistant to (a) write a formal spec S for an
English requirement R, and (b) write an implementation I plus a
machine proof that I ⊨ S. The verifier checks the proof. The
adversary is the spec elicitor; the bug lives in R \ S, which no
verifier can see. Full threat model: docs/threat_model.md in the
GitHub repo.

Schema

field type meaning
triple_id string UUID for the triple
language string one of dafny, lean, verus
attack_pattern string one of vacuity, implementation_leak, domain_restriction, predicate_swap
difficulty string seed-difficulty tag (easy/medium/hard)
model_origin string which elicitor produced the trojan (sonnet/haiku/llama)
elicitor_model string full Bedrock model id
elicitor_temperature float sampling temperature used
nl_requirement string the natural-language requirement R
preamble string shared helper definitions / imports / axioms visible to both specs
original_spec string the honest spec (paired control)
trojan_spec string the adversarial spec
trojan_witness string a witness implementation + proof that the verifier accepts under trojan_spec
source_benchmark string seed source (e.g. vericoding, cryspec-anchor)
crypto_primitive string crypto-anchor tag if applicable (e.g. ed25519, ml-kem)
source_problem_hash string SHA-256 of the seed problem (dedupe key)
validation_timestamp string ISO-8601 UTC timestamp of verifier admission
verifier_accepts_witness_under_trojan bool always true for admitted triples (admission gate)
verifier_rejects_witness_under_original bool always true for admitted triples (the witness is genuinely incorrect under the honest spec)

Splits

Single test split - this is a benchmark, not training data. Use
the model_origin field if you need a held-out set (Sonnet-generated
triples are the primary corpus; Haiku and Llama are cross-family controls).

from datasets import load_dataset
ds = load_dataset("m-zest/trojanspec-bench", split="test")
print(len(ds), "triples")
print(ds[0]["nl_requirement"])
print(ds[0]["trojan_spec"])

Generation methodology

The dataset evolved across four contract designs (v1 → v4); only v4 is
released here. Full iteration history:
STATUS.md
in the source repo.

  • Elicitor: Bedrock Claude Sonnet 4.6 (primary, 906 triples) +
    Claude Haiku 4.5 (59) + Meta Llama-3.3 70B (59) for
    cross-family diversity.
  • v4 contract: shared preamble (helper definitions, imports,
    axioms) + single target spec/witness. Eliminates schema mismatch and
    enables real preamble-mediated implementation leaks.
  • Verifier-proven few-shot: all 8 Lean worked examples (A+B × 4
    attacks) are confirmed acc_troj=True / rej_orig=True through a
    fixed verify_lean that runs lake env lean Main.lean instead of
    lake build (the original bug spuriously accepted every Lean
    triple). Same correctness gate for Dafny and Verus.
  • Phase 7 admission gate: a triple is admitted only if the verifier
    accepts the witness under trojan_spec AND rejects the same
    witness under original_spec. This is the strongest possible
    ground-truth signal: the witness is genuinely incorrect under the
    honest spec but provably accepted under the trojan.

Statistics

Per-language admission (Phase 7)

language admitted / total rate
Dafny 319 / 600 53.2 %
Lean 417 / 600 69.5 %
Verus 288 / 598 48.2 %
all 1024 / 1798 57.0 %

Per-attack distribution (Phase 7 admitted)

attack pattern admitted / generated rate
implementation_leak 377 / 450 83.8 %
vacuity 348 / 450 77.3 %
domain_restriction 187 / 450 41.6 %
predicate_swap 112 / 448 25.0 %

Elicitor model distribution (this release)

| haiku | 59 |
| llama | 59 |
| sonnet | 906 |

(model_origin = sonnet is the primary set; haiku and llama are
cross-family ablation controls. See Phase 10a - Haiku trojans are
markedly easier to detect than Sonnet's.)

Detector evaluation summary

Numbers from the companion SpecGuard evaluation (Phase 9 + Phase 10):

detector precision recall F1 FPR LLM calls / side
static_only (4 detectors) 0.793 0.490 0.606 0.128 0
axiom_audit only 0.742 0.368 0.492 0.128 0
SSC baseline 0.771 1.000 0.871 0.297 2
monitor_consensus (3 monitors) 0.771 1.000 0.871 0.297 3
atomic K = 2 of 4 (Phase 10i) 0.936 1.000 0.967 0.068 4
atomic C3 alone (logical fidelity) 0.953 0.998 0.975 0.049 2

The Phase 10i atomic-criteria detector breaks the 0.871 SSC ceiling by
decomposing the coarse FAITHFUL/UNFAITHFUL question into four
independent atomic Yes/No criteria (completeness, independence,
logical-fidelity, internal-consistency) and flagging when ≥ 2 fail.
Validates FormalJudge (arXiv:2602.11136) and Epistemic Ensemble
(arXiv:2506.10903) in the spec-Trojan setting.

5-fold CV on Phase 10i: F1 = 0.967 ± 0.005, K* = 2 on every fold.

Intended use

  • Evaluating LLM-as-judge / programmatic / hybrid detectors on
    verifier-admitted adversarial specs.
  • Studying the gap between syntactic spec validity and semantic
    alignment with NL intent
    .
  • Calibrating false-positive rates against the companion
    100-Mathlib-theorem honest sample (Phase 11 in the source repo).

Not intended use

  • Training a spec elicitor or auto-completer - this is a benchmark, not
    a corpus; the trojan_spec field is adversarial by construction.
  • Direct use as a verifier test suite - admission already proves the
    verifier accepts; what's interesting is the defender.

License

CC BY 4.0 - free to use
with attribution. Companion code at
https://github.com/m-zest/TrojanSpec-Bench-v1.0 is Apache 2.0.

Citation

@misc{zeeshan2026trojanspec,
  author = {Zeeshan, Mohammad},
  title  = {{TrojanSpec-Bench}: Verified Adversarial Specifications for Detector Evaluation},
  year   = {2026},
  url    = {https://github.com/m-zest/TrojanSpec-Bench-v1.0}
}

Changelog

  • v0.4.1 (2026-05-20)

    • Phase 11 Mathlib calibration extended to atomic_monitor (K=2 of 4): 3/100 FPR on 100 honest Lean lemmas, a 7.7× reduction vs monitor_consensus (23/100). All 3 atomic-flagged lemmas are a strict subset of monitor_consensus flags - atomic decomposition tightens precision without introducing new false positives.
    • Per-criterion flag rate on Mathlib: C1 completeness 0.06, C2 independence 0.06, C3 logical_fidelity 0.05, C4 consistency 0.01.
    • Phase 14 MutDafny head-to-head on 319 admitted Dafny trojans: atomic K=2 reaches F1 0.992 versus the published ICSE 2026 MutDafny baseline at 0.530 (McNemar p < 10^-45, strict superset). Static mutation testing detects vacuity (98%) but is structurally blind to implementation_leak, domain_restriction, and predicate_swap (combined recall ~0.5%).
    • atomic_monitor promoted to library module at src/trojanspec/specguard/atomic_monitor.py with unit tests.
    • boto3/botocore declared as hard runtime dependencies in pyproject.toml.
  • v0.3.0 (2026-05-20): initial public
    release - 1024 admitted triples, paired honest controls, paper-grade
    README. Companion HF Space:
    m-zest/specguard-demo.

README history 8 revisions

Every night we snapshot the README of every dataset in the catalog. When the SHA changes we archive the new version and diff it against the last. This is the evolving thought record of the alignment-data field: what the author decided to say about the corpus, and how that framing shifted over time.

  1. 2026-05-24v0.4.1 corrections: recall ~0.5% (was ~0.3%), version reference v0.4.1ea58cc08.5 KB
    Loading...
  2. 2026-05-24v0.4.1: add Phase 14 MutDafny head-to-head to changelogee479bc8.5 KB
    Loading...
  3. 2026-05-24v0.4.1: add Phase 14 MutDafny head-to-head to changelog, remove em dashes255d0538.5 KB
    Loading...
  4. 2026-05-20minor48f757b8.2 KB
    Loading...
  5. 2026-05-20minor2e4a88a8.2 KB
    Loading...
  6. 2026-05-20v0.4.1: Phase 11 atomic_monitor Mathlib calibrationd9c16768.2 KB
    Loading...
  7. 2026-05-20phase13: TrojanSpec-Bench v4 dataset release (1024 triples)7e4be2d7.5 KB
    Loading...
  8. 2026-05-20initial commitbfd32b327 B
    Loading...

Used by abliterated models none yet

No abliterated models in our catalog have declared this dataset in their YAML metadata yet. This can mean the dataset is used but not declared, is used outside abliteration workflows, or is new. The link will populate automatically as models are indexed.

Community discussions 1 thread · 1 open · 1 comments

Threads posted by the community on Hugging Face: bug reports, questions about usage, pull requests on the README, license clarifications. Click any thread to expand and read the full conversation inline. Newest first.

  1. 2026-05-25[bot] Conversion to Parquetopen1 💬#1
    Loading...

Related datasets same stage · evaluate

Read further

Metadata

License
cc-by-4.0

Repository

Download the dataset

0

Copy any of these snippets into your notebook or terminal. All three fetch directly from Hugging Face using your own credentials.

Recommended: datasets library (Python)
from datasets import load_dataset
ds = load_dataset("m-zest/trojanspec-bench")
Raw snapshot (Python)
from huggingface_hub import snapshot_download
snapshot_download(repo_id="m-zest/trojanspec-bench", repo_type="dataset")
git clone (requires git-lfs)
git clone https://huggingface.co/datasets/m-zest/trojanspec-bench
Catalog is the map. Apps are the tools.

Run models on your own machine, not in the cloud.

Every model page has an "Open in Abliteration" button that hands the model directly to the first-party desktop client, at the quantization your rig can actually run. No API keys, no subscription, no prompt leakage.

Open in Abliteration