specforge / README.md
nickh007's picture
Link the rest of the portfolio, and the docs site
5c4f405
|
Raw
History Blame Contribute Delete
6.31 kB
metadata
license: mit
task_categories:
  - text-classification
tags:
  - formal-methods
  - model-checking
  - verification
  - reasoning
  - synthetic
size_categories:
  - n<1K
configs:
  - config_name: medium
    data_files: specforge_medium.jsonl
    default: true
  - config_name: easy
    data_files: specforge_easy.jsonl
  - config_name: hard
    data_files: specforge_hard.jsonl

specforge — a verification benchmark that cannot be memorised

600 protocol-shaped state machines whose ground truth was computed by an exhaustive model checker, not written down by hand.

Every fixed benchmark has a shelf life: once its answers are in a training corpus, a high score stops telling you whether a model reasons or remembers. This snapshot is generated, and the generator is public — so when this set ages, you make a new one with a different seed rather than trusting a stale number.

from datasets import load_dataset

ds = load_dataset("nickh007/specforge", split="train")     # medium by default
ds[0]["spec"]        # the state machine
ds[0]["violated"]    # ground truth, computed not assumed

Configs

config rows violated safe
easy 150 75 75
medium (default) 300 150 150
hard 150 75 75

Difficulty controls the size of the search, not how tricky the answer is: more components, more auxiliary fields, wider bounds.

Fields

field meaning
id {shape}_{difficulty}_{seed}
shape one of mutual_exclusion, bounded_retry, handshake, sequence_window, resource_pool
difficulty easy, medium, hard
seed the generation seed for this task
spec the declarative state machine (JSON)
property the name of the safety property being checked
violated ground truth — computed by exhaustive check
reachable_states size of the reachable state space
counterexample_length steps to the violation, when there is one

Plus per-shape metadata, present only on the shapes that define them and null elsewhere (the configs are a union of all five shapes): guarded, components, limit, capped, ordered, width, checked, size. These record which variant was generated — e.g. guarded: false on a mutual_exclusion task is why that task is violated. 17 columns in total.

Why the answer key is trustworthy

Three rules, enforced at generation time and covered by tests in the generator:

  1. A task is emitted only on a definite verdict. A candidate the checker could not settle is discarded, never labelled. An answer key containing guesses is worse than no benchmark.
  2. Every violated task's counterexample was replayed against its own model before the task was emitted.
  3. Generation is deterministic from the seed, so this exact set is reproducible: specforge export --n 300 --seed 2026 --difficulty medium.

One subtlety worth stating: a safe label requires an exhaustive search, because it is a claim about every reachable state. A violated label does not, because it rests on a single witness that stands whether or not the search finished. Different evidential bars, applied separately.

Scoring credits only what replays

Predicting "violated" is cheap; producing a counterexample that replays is not. Scoring a submission needs the specforge package, because a trace only means something when replayed against the real model.

pip install "specforge @ git+https://github.com/nickharris808/specforge.git"
specforge score submission.json --tasks tasks.json

Measured on 20 tasks at seed 42: a submission that knows every answer and fabricates every trace scores balanced accuracy 0.500 — exactly what guessing scores — while accuracy_ignoring_replay reads 1.000. The gap between those two numbers is the measurement.

Honest scope

What a score measures. How well a solver finds and demonstrates safety violations in synthetic finite state machines, at a given size.

What it does not. Nothing about real-world protocol implementations — the shapes are drawn from how protocols are built, but the machines are synthetic and deliberately so. Nothing about reading a specification, since the model is given. And nothing comparable across seeds or difficulties unless you say which you used.

It makes no claim about any named third-party protocol, product or implementation. Judgements about named systems belong in a human-reviewed corpus; that is protocol-bench, which is fixed, small and reviewed.

Always report the seed and count with any score. A number nobody can reproduce is not a result.

Licence

MIT.


The portfolio

This is one artifact in a set built around a single rule: a verdict you cannot check is not a verdict — and its corollary, undetermined is not a pass.

Documentation the front door: what an explicit-state check proves, and what it does not
minicheck the model checker underneath all of it
protocol-bench fixed ground truth from published standards; a detection must replay
specforge a benchmark that cannot be memorised — ground truth is computed
minicheck-mcp the checker as an MCP server, for agents
failclosed default-deny middleware for verification-gated endpoints
polyfrac exact rational arithmetic with Sturm root counting

Try it in the browser · model-check a state machine · the specforge leaderboard

Ground-truth data · protocol-bench · specforge