Technical reference

All model documents · source: docs/models/tracking.md

Experiment tracker

dexvantage/core/tracking/ keeps a record of every study run, designed experiment, optimiser run, tolerance Monte Carlo and readiness scorecard (--check) as a run, in a run store beside the project, and exports the runs to the tools research teams already use (CSV, Parquet, MLflow, Weights & Biases). The Runs page (Analysis ▸ Runs), batch mode (--track, --runs, --runs-export), the Python API (dv.runs, dv.track) and the assistant (get_runs) read the same store.

The tracker computes no figure of its own: every number in a run is a number its study's result states, read through core/metrics (read(): None with status "not stated" when the result does not state it, bound kept when the study states only a bound).

Opt-in

Nothing is logged unless the project turns tracking on, project.analysis.studies['tracking']:

Setting Default (a labelled default) Meaning
enabled false log runs of this project
folder '' the run store; empty: <project file name>.runs beside the project file; relative paths from the project's folder
quick false also log the quick studies the window re-runs after each edit (off: they would log a run per edit)
tags [] tags added to every run logged from this project

or batch mode is given --track DIR. The setting is left out of the project's content hash (core/provenance.py, _UI_STUDIES, as the live toggle is): turning tracking on does not make the project "differ" from the runs logged before it, and a project that never had the setting hashes exactly as before.

In the window, a result is logged when the analysis controller finishes it (a worker thread writes it), unless it is a quick study and quick is off, the tracker's own summary, a result already logged in the session (the same store, study, project hash, variant and result hash, so a result from the cache is not logged twice), or a result made before the latest edit (its project is no longer the one in the window). A study that refuses is logged as a failed run with its plain sentence. In batch mode and the API every requested run is logged: study flags, --experiment, --check, --stats, --campaign, --cells, the study and check steps of a --run-plan, the cluster runs (--jobs N, and a complete --gather of an experiment or a Monte Carlo) and dv.cluster's results (integration of research tools part 2).

A run (schema dexvantage.run/1, core/tracking/record.py)

Field What
run_id uuid4 hex (32 characters): unique without coordination, and a valid MLflow run id
kind study, experiment (study experiments), optimise (optimise, design_agent), tolerance, check (requirements, --check)
study, title, name, interface the core.jobs study id, its title, a display name, app / batch / api
started_utc, ended_utc, seconds UTC, YYYY-MM-DDTHH:MM:SS.mmmZ (sorts as time); seconds is the study's own computation time; started_utc = end − seconds unless given
status, reason finished, cancelled, failed (with the study's sentence)
project, variant name, file name (never its folder), content hash (core/provenance); variant name, index, uid, own hash
settings, seeds the study's settings with defaults filled in and every seed, as core/provenance records them
metrics {key: {metric, stat, title, unit, better, value, status, bound?, reason?, check?}} (below)
headline {text, status, word}: the study's headline metric and its status word
result {file: result.json, schema, sha256 (the result hash), output (where batch wrote it)}
provenance DexVantage version, code hash, git commit and dirty flag (from a checkout), library versions, platform, interface, command, inputs, plan
tags, note free; tags are trimmed, without repeats, commas turned into spaces
rerun_of, reproduce for a re-run: the run it re-ran and {verdict, verdict_text, message, reasons} (core/reproduce)
samples (run.json only) per-draw values of a tolerance Monte Carlo: the replicates a significance test can use, in draw order with null for a draw that states no value (so two runs with one seed pair draw by draw; a pair with a missing side is dropped)

Metric keys. Every core/metrics figure registered for the study, read off its result; plus, per kind:

The run store (core/tracking/store.py)

<store>/store.json            {schema dexvantage.runstore/1, created_utc}
<store>/runs.jsonl            the index: one JSON object per line (JSON Lines)
                              {op: add, run: {record without samples}} | {op: update, run_id, tags, note, at}
                              | {op: delete, run_id, at}
<store>/runs/<run_id>/run.json, result.json
<store>/deleted/<run_id>/     a deleted run (moved, not erased)
<store>/.lock                 the lock appends and updates take

Adding a run. The run's folder is written under a temporary name inside runs/ (each file written to a temporary file, fsync'd and renamed) and renamed to runs/<run_id> in one step; then its index line is appended under an exclusive advisory lock (fcntl.flock) as one write() followed by fsync. POSIX rename() keeps the new name "visible … and refer[ring] either to the file referred to by new or old before the operation began": a reader sees a run folder whole or not at all. Updates (tags, note) rewrite run.json by write-then-rename and append their index line, both under the lock. Nothing is edited in place.

Reading. The index is folded in order (add, then updates, deletes); a line that does not parse is counted as damaged and skipped (a final line without its newline may be mid-write and is not counted); a run folder the index does not name is read from its run.json ("recovered"); an indexed run whose folder is gone is marked folder_missing. So:

A writer that dies … leaves readers see
before its rename a runs/.tmp-… folder nothing (not a run id)
between rename and index line a folder without an index line the run, recovered from its folder
inside its append a line without its newline the next writer starts a new line; the cut line is one damaged line; the run is recovered from its folder

Comparing runs (compare())

For runs r₁ … rₙ (r₁ the baseline, the oldest selected) and each metric key: the values vᵢ, the deltas dᵢ = vᵢ − v₁, the relative changes dᵢ / |v₁| (none when v₁ is 0 or not stated), the best run by the metric's direction (none when all stated values are equal), and the settings, seeds, project content hash, variant and DexVantage version that differ. For two runs that kept replicates (a tolerance Monte Carlo's draws) the comparison of the base metric adds a significance note from core/stats.compare_samples(a, b, better, paired) (a permutation test with a bootstrap interval, written by the statistics module; paired when both runs drew with the same seed, so draw k of each saw the same perturbation). Without replicates, or in a build without core/stats, the note says why there is no test; a p-value is never made up.

Re-running a run (rerun())

core/reproduce.rerun runs the run's study again on the project given (the window's project as it is now) with the settings it now holds, core/provenance.report compares every number and text with the stored result, and the new result is logged as a run with rerun_of and the verdict (reproduces, reproduces within the tolerances, does not reproduce with the reasons: a different project content, code, library, …).

Exports (export())

mlflow-skinny 3.17.2 and wandb 0.30.0 are the optional extra tracking (Apache-2.0; MIT): writing the exports never needs them; the MLflow read-back check uses MLflow when it is installed, and the replay script needs wandb.

Validation (dexvantage/validation/checks_tracking.py)

Measured 2026-11-07 (full run; tmpfs /tmp):

Check Reference Tolerance Measured
tracking.store_round_trip four records built in the check (a rig-inventory result, a tolerance result with draws, a value not stated and samples, a scorecard with a bound and the three check states, a failed run; Unicode tags, a two-line note, rerun_of, reproduce), through a JSON round trip 0 fields 0 of 443 fields differ (run.json, index line, result.json, after an update, read by a new RunStore)
tracking.concurrent_writers what each of N writer processes reports it wrote (run ids; figures writer × 1000 + i) 0 runs 8 writers × 100 runs (and an update of every third): 800 stored, 0 lost, 0 foreign, 0 corrupt, 0 damaged lines, 0 temporary files; all 8 writing at once at the busiest; 0.16 s on tmpfs, 1.8 s on ext4 (16 × 100 also 0 lost)
tracking.crash_recovery the meaning of each crash, written out in the check 0 cases 7 of 7 cases hold (1 damaged line, 2 recovered folders, the temporary folder ignored, the later run intact)
tracking.csv_parquet_identical the records' own values; read back with Python's csv module and pyarrow.parquet 0 cells 0 of 8 240 cells differ; numbers compared bit for bit over magnitudes 10⁻³⁰⁰ to 10³⁰⁰, both signs, −0.0 and integers
tracking.mlflow_reader MLflow 3.17.2's MlflowClient (mlflow-skinny installed); without it, a reader of the layout written out from file_store.py 0 fields 0 of 80 fields differ (ids, names, statuses, start and end ms, metrics bit for bit, params, note, run name and user tags)

Why tolerance 0: storage and file formats are exact or wrong; repr() of a float64 reads back to the same bits, and MLflow parses metric values with float().

The self-test line tracking runs the round trip, the crash recovery and the table check (0.9 s in a fresh process, most of it imports and the built-in sample).

Known limits

References