Docs / Concepts / Reproducibility

Reproducibility

SwarmLabRE makes three claims, from the strongest to the weakest: a recorded run replays to byte-identical files, a live run is pinned and recorded but not repeatable, and the containers can be run again against recorded model answers.

A recorded run replays to byte-identical files#

swarmlabre replay RUN rebuilds a finished run offline, with no model, no Docker and no network, and compares every output with the SHA-256 in the run's manifest.json: report.json, report.md, report.html, board.json, iocs.csv, iocs.stix.json, iocs.misp.json and detection.yar.

Recordinputs.jsonl, the model trace,events and manifest.jsonReplayrebuilds the board andevery report file offlineComparehashes each file and checksit against the manifestResultexit 0: every file identicalexit 1: one byte differs Recordinputs.jsonl, the model trace, events and manifest.jsonReplayrebuilds the board and every report file offlineComparehashes each file and checks it against the manifestResultexit 0: every file identical exit 1: one byte differs
Record a run, replay it offline and compare each rebuilt file with the manifest.

Replaying the recorded demo run prints the checks below. The command exits 0 only when every one of them is identical.

rebuiltrecorded copyboard.jsonboard.json, rebuilt: identicalidenticalboard.json, recorded copy: identicalidenticaldetection.yardetection.yar, rebuilt: identicalidenticaldetection.yar, recorded copy: identicalidenticaliocs.csviocs.csv, rebuilt: identicalidenticaliocs.csv, recorded copy: identicalidenticaliocs.misp.jsoniocs.misp.json, rebuilt: identicalidenticaliocs.misp.json, recorded copy: identicalidenticaliocs.stix.jsoniocs.stix.json, rebuilt: identicalidenticaliocs.stix.json, recorded copy: identicalidenticalreport.htmlreport.html, rebuilt: identicalidenticalreport.html, recorded copy: identicalidenticalreport.jsonreport.json, rebuilt: identicalidenticalreport.json, recorded copy: identicalidenticalreport.mdreport.md, rebuilt: identicalidenticalreport.md, recorded copy: identicalidentical
The output of swarmlabre replay demo/sfaef16e6, from its checks block. Hover a word for its file.
Show as a table
FileRebuiltRecorded copy
board.jsonidenticalidentical
detection.yaridenticalidentical
iocs.csvidenticalidentical
iocs.misp.jsonidenticalidentical
iocs.stix.jsonidenticalidentical
report.htmlidenticalidentical
report.jsonidenticalidentical
report.mdidenticalidentical

Five more checks sit beside the files. board compares the rebuilt board.jsonl with the recorded one. summary compares the Reporter's summary, its lint result and its assessment with the recorded ones. record compares the rebuilt swarm.json with its hash in the manifest. sample checks that the kept sample is the one the manifest names, and inputs_untouched checks that no recorded input file changed after the run ended. The bundle_outputs column is the copy of each output a bundle carries under out/: the player serves and the demo embeds those files, so they are checked as well as the rebuilt ones. A bundle is copied without following links.

What the replay re-runs#

StepRe-runFrom
The board's evidence checks: bytes at an offset, ATT&CK id and name, call citations, duplicates and capsyes, at the full level because the sample is keptinputs.jsonl: every post, resolution and spot check in the order the board received it, with the clock value it saw
The Reporter's summary, the lint and the assessmentyesthe Reporter's recorded text in swarm.json
Verdict and confidence caps, YARA rules and their matching, IOC grouping and defanging, STIX and MISP ids, the HTML pageyesthe board, the layout and the prepared files of the run
What the model said and what the tools printedno, recordedmodel-trace.jsonl.gz (every exchange, whole) and the agents' tool results inside the board inputs

With no sample kept (keep_sample = false, or --no-sample), the replay is at the downstream level: the board is taken from the record, and the result says so. It never reports more than it checked.

What the replay does not do#

Nothing signs manifest.json. Someone who edits a file and recomputes its hash and the manifest's gets a replay that agrees. The hashes catch an accidental change and an edit that left the manifest alone. A rebuild that differs in even one byte, or a recorded file edited afterwards, makes replay exit 1.

What makes the rebuild repeatable#

  • The build reads no wall clock. One clock module is pinned to the run's end time.
  • All times are UTC, so the local time zone has no effect.
  • Nothing is random: STIX and MISP ids are uuid5 over the run id and the content.
  • Keys are sorted, and nothing depends on dict or set order.

The test suite replays under different time zones and PYTHONHASHSEED values and expects the same hashes. The golden cases pin the bytes of 11 recorded runs.

A live run is pinned and recorded but can differ#

Six agents share one model, so the order of their requests, the server's batching and the tool timings differ between runs. The gate overwrites temperature and seed in every request, whatever the agent's client asked for. That removes the sampling noise the client controls and nothing else. Two live runs on the same sample can differ, for example in which agent posts first and so in the finding numbers.

Two live runs can differ, so a live run promises no identical results. Everything needed to reproduce its results offline is on disk.

Whether the model server honours seed at all is measured. Before a run, the same short question is asked twice with one seed, and swarm.json and manifest.json record seed_support as honoured, ignored or unknown.

Replaying the agents against recorded model answers#

swarmlabre run SAMPLE --replay RUN starts the containers as usual and answers every model request from the recorded trace. A reply is served only to a request whose body has the same SHA-256 as the recorded one. Any other request gets an error and is counted as replay_diverged in the result. The run reuses the recorded run's task key (nonce.key): the per-task marker the agents echo back is an HMAC of that key, so the conversations repeat word for word. It needs Docker and the two images.

On the second demo sample, which has a dispute, a resolution, a round 2 and a duplicate reject, the measurement was 0 unrecorded requests and the same findings, ids, evidence levels, statuses and rejects. Repeated eleven times, the count was 0 six times and 4 five times. Which agent posts first decides the finding numbers, and the containers' timing is not controlled, so a replay through the containers can diverge, and replay_diverged says so. The offline replay above is not affected.

This is a new run, so its files differ from the recording in the run id and the times. The byte-identical claim belongs to the offline replay. With a real model's tool use, timing-dependent tool output can also make a request differ from the recorded one.

Files of a run#

FileContentHashed in the manifest
swarm.jsonthe run recordyes
board.jsonlthe board's decisionsyes
inputs.jsonlthe board's inputs, in orderyes
model-trace.jsonl.gzevery model exchange: the request is kept as its hash and the reply whole, at most 64 MiByes
layout.json, events.jsonl, detection.jsonthe map, the event log and the stored YARA rulesyes
manifest.jsontool version, sample hash, model and sampling, image ids, ATT&CK version, report format and the hashes aboveno
out/*the outputsnamed by hash in manifest.json

Everything in a run folder that came from a sample, a tool or a model is untrusted text. It is capped, never executed and shown only as text.

SwarmLabRE alpha 0.1.0Edit this page on GitHub