File size: 7,353 Bytes
bb654e0 646f355 bb654e0 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 | ---
license: mit
task_categories:
- text-classification
- question-answering
language:
- en
tags:
- formal-methods
- protocol-verification
- security
- model-checking
- ieee-802-11
- 3gpp
- reasoning
- counterexamples
pretty_name: Protocol-Bench
size_categories:
- n<1K
configs:
- config_name: default
data_files: protocol_bench.jsonl
---
# Protocol-Bench
**15 published IEEE 802.11 and 3GPP procedures with ground-truth safety verdicts — and, where a
property fails, the shortest counterexample trace that proves it.**
Most reasoning benchmarks accept an answer. This one asks for a **proof**: if a model says a protocol
is broken, it must supply a trace that starts at the initial state, moves only along real
transitions, and ends in a genuinely violating state. Traces are replayed mechanically. A
plausible-sounding trace that does not replay earns nothing.
## Why the metric is shaped this way
The task set is **deliberately imbalanced** — 13 of 15 procedures are safe, which is what the
published-procedure population actually looks like.
| Strategy | Accuracy | Balanced accuracy | Valid counterexamples |
|---|---|---|---|
| Answer "safe" every time | **0.867** | 0.500 | 0 |
| Answer "violated" every time | 0.133 | 0.500 | **0** |
| Exhaustive model checker | 1.000 | **1.000** | **2** |
Plain accuracy is nearly uninformative here — hence **balanced accuracy** as the headline, and the
**valid-counterexample count** as the column separating a detector from a guesser.
There is a second reason, specific to language models: a verdict is separable from the reasoning that
should justify it. *"The WPA2 four-way handshake"* is strongly associated with *"vulnerable"* in any
training corpus, so a model can be right about it having done no reasoning at all. Recalling a CVE
does not produce a replaying trace; reasoning about the state machine does.
## Schema
21 fields per row. Everything is derived from the live models at export time, never hand-maintained.
| Field | Type | Description |
|---|---|---|
| `id` | string | Task identifier |
| `standards_body` | string | `IEEE` (8) or `3GPP` (7) |
| `spec_clause` | string | The published clause modelled |
| `property` | string | Name of the safety property that must hold |
| `label` | string | `KNOWN_COUNTEREXAMPLE` \| `CANDIDATE_COUNTEREXAMPLE` \| `PROVEN_SAFE` |
| `violated` | bool | Binary target, derived from `label` |
| `prompt` | string | Ready-to-use prompt |
| `prompt_mode` | string | `model` or `spec` (see below) |
| `state_machine` | string | Human-readable rendering of the machine |
| `state_fields` | list[string] | State variable names, in order |
| `initial_state` | object | Field → initial value |
| `transitions` | list[object] | Every reachable edge: `{from, label, to}` |
| `n_state_fields` | int | Number of state variables |
| `n_reachable_states` | int | Reachable state count |
| `n_transitions` | int | Reachable edge count |
| `counterexample` | list[object] \| null | Shortest violating trace: `{label, state}` per step |
| `counterexample_length` | int | Steps in the trace (0 if none) |
| `has_fixed_twin` | bool | Whether a repaired variant exists |
| `fixed_twin_holds` | bool \| null | Whether the repair actually removes the violation |
| `citation` | string \| null | Publication, where the finding is published |
| `known_finding` | string \| null | One-line description of the published finding |
Corpus totals: **67 reachable states** and **83 transitions** across the 15 machines; 2 rows carry a
counterexample; 2 carry a repaired twin, and both twins verify.
## Two difficulty modes
- **`model`** — the full transition table is in the prompt. No protocol knowledge needed; isolates
formal reasoning.
- **`spec`** — only the standards clause and a description of the procedure. The model must know or
infer the behaviour. This is the mode corresponding to what a security researcher actually does.
Regenerate either: `python load_dataset.py --regenerate --mode spec`.
## Usage
```python
# No dependencies
from load_dataset import load, stats
rows = load()
stats() # {'n_rows': 15, 'n_violated': 2, 'trivial_always_safe_accuracy': 0.8667, ...}
# Or as a datasets.Dataset
from load_dataset import load_hf
ds = load_hf()
print(ds[0]["prompt"])
```
```bash
python load_dataset.py --stats # summary counts
python load_dataset.py --regenerate # rebuild from the package, so data cannot drift from code
```
Scoring — including trace replay — needs the package, because a trace only means something when
replayed against the real model:
```bash
pip install "protocol-bench @ git+https://github.com/nickharris808/protocol-bench.git"
# `pip install protocol-bench` does not work yet — the package is not on PyPI.
protocol-bench prompts --mode model -o prompts.json
# ... run your model, save {task_id: completion} to completions.json ...
protocol-bench score-completions completions.json
```
## Provenance
Rows are generated by `protocol_bench.export.export_rows()` from the same finite-state models the
package ships and the test suite checks. Nothing in this file is hand-written:
- `n_reachable_states`, `n_transitions`, and `transitions` come from exhaustive reachability;
- `counterexample` is the shortest violating trace found by breadth-first search;
- `fixed_twin_holds` is the verdict on the repaired model;
- `label` is cross-checked against exhaustive reachability by a test, so a label cannot drift away
from its model.
A further test asserts that **the committed JSONL is byte-equal to what the package generates**, and
another asserts that **every counterexample in this file replays against its own model**.
## Labels, and one deliberate open question
`KNOWN_COUNTEREXAMPLE` means the violation is published and cited. The single instance is the WPA2
4-way handshake — **KRACK** (Vanhoef & Piessens, ACM CCS 2017, CVE-2017-13077…13088).
`CANDIDATE_COUNTEREXAMPLE` means the property fails and **no published citation was found**. It is
labelled unconfirmed on purpose, and it is a genuine open question posed publicly: if you can cite
it, or show the model is wrong, please say so.
## Limitations
These are **models of published procedures**, not the standards themselves and not implementations.
`PROVEN_SAFE` means the property holds over the modelled state space — not that any shipping product
is secure. Abstractions hide things.
The set is small (15 rows) and drawn from one modelling effort, so a system tuned on it will overfit
quickly. Treat per-task outcomes as the primary result and the aggregate as a summary. Two further
procedures exist in the source corpus and are withheld.
Replay validation checks that a trace is a genuine execution reaching a violating state; it does not
check that the trace is the *explanation* a human would give.
## Licence and attribution
MIT, for the code and the task metadata. The KRACK finding belongs to Vanhoef & Piessens; this
dataset reproduces it and does not claim it. Specification clauses are cited, not reproduced.
## Citation
```bibtex
@misc{protocolbench2026,
title = {Protocol-Bench: ground-truth safety verdicts for published IEEE 802.11 and 3GPP procedures},
year = {2026},
note = {Counterexamples are machine-validated by replay against the model.}
}
```
|