mdm_coverage / server /README.md
lylybig8's picture
Archive MDM experiment code, results, audits, and environment records (part 2)
83d5975 verified
|
Raw History Blame Contribute Delete
8.01 kB

MDM Coverage Experiments

CPU experiments and finite-state verification code accompanying the study of accuracy--depth tradeoffs for parallel masked sampling. The repository contains the source, frozen configurations, raw finite-dimensional results, arithmetic certificates, logs, and publication figures for three experiment phases.

The experiments are deterministic finite sums, linear programs, and exact or outward-rounded rational checks. They do not train a neural model and do not require a GPU. They are diagnostic and verification artifacts for selected finite instances; they are not a formal proof assistant, a global minimax optimizer, or an empirical claim about natural-language models.

Repository layout

Path Contents
src/, configs/ Phase 1 model/execution diagnostics and randomized-policy LPs
results/run-20260916-phase1-v1/ Frozen Phase 1 source snapshot, JSON outputs, policies, logs, and figures
phase2/src/, phase2/configs/ Phase 2 finite witness search and independent certification
phase2/results/run-20260916-phase2-certified-v2/ Certified Phase 2 witnesses, certificates, recovery audit, and figures
phase3/ Phase 3 fixed-schedule comparison and biased-pair pilot
phase3/results/run-20260916-phase3-v1/ Frozen Phase 3 outputs, certificates, logs, and figures
.venv/ Original server-side virtual-environment wrapper, retained intentionally
requirements.txt Minimal Python packages actually imported by the experiment code

Each phase has a PROTOCOL.md describing its scientific scope, resource limits, controls, and interpretation. Each frozen result directory contains a status.json with source/configuration hashes and stage status.

Environment

The reported runs used:

  • Python 3.13.13
  • NumPy 2.2.6
  • SciPy 1.17.1, including HiGHS
  • Matplotlib 3.10.9
  • one CPU numerical-library thread
  • no GPU

The committed .venv was created on the original Linux server with --system-site-packages. It points to /root/userdata/liangyan/miniconda3/bin/python3.13; therefore it is retained as an environment artifact but is not portable to another server or operating system. On the original server it can be activated with:

cd /root/userdata/liangyan/mdm_coverage_experiments
source .venv/bin/activate

For a fresh clone, create a local environment instead:

git clone git@github.com:yanliang3612/mdm_coverage.git
cd mdm_coverage
python3 -m venv .venv-local
source .venv-local/bin/activate
python -m pip install --upgrade pip
python -m pip install -r requirements.txt

Use a single numerical-library thread for every run:

export OMP_NUM_THREADS=1
export OPENBLAS_NUM_THREADS=1
export MKL_NUM_THREADS=1
export NUMEXPR_NUM_THREADS=1
export MPLBACKEND=Agg

Basic checks:

python src/check_environment.py
python src/verify_main_examples.py
python phase2/verify_exact_target_control.py \
  --source phase2/src/certify_witness.py \
  --output phase2/exact_target_control.json

Phase 1: model and execution diagnostics

Phase 1 contains three experiments:

  1. E1: model KL/TV versus the two-round all-A/all-B execution error.
  2. E2: self-generated pilot size, posterior drift, and output TV.
  3. E3: a small-dimensional occupation-measure LP over randomized adaptive policies for a fixed oracle.

Run the complete Phase 1 pipeline with a new run identifier:

python src/run_study.py \
  --config configs/phase1.json \
  --run-id run-YYYYMMDD-phase1-local

The runner executes regression checks, E1, E2, E3, and plotting in order. It refuses to overwrite an existing result directory. To run individual stages:

mkdir -p scratch/phase1
python src/e1_model_execution.py --config configs/phase1.json --output scratch/phase1/e1.json
python src/e2_pilot.py --config configs/phase1.json --output scratch/phase1/e2.json
python src/e3_policy_lp.py --config configs/phase1.json --output scratch/phase1/e3.json

To regenerate figures for a completed run:

python src/plot_results.py --run-dir results/run-YYYYMMDD-phase1-local

The original complete run is results/run-20260916-phase1-v1/.

Phase 2: finite all-policy witness search and certification

Phase 2 first searches a prespecified finite family using floating-point LPs, then independently verifies selected witnesses using exact rational oracle heads, a full-action Bellman recursion, downward-rounded probability flow, and explicit logarithm enclosures.

Fast smoke run:

python phase2/src/run_phase2.py \
  --config phase2/configs/phase2.json \
  --run-id run-YYYYMMDD-phase2-smoke \
  --smoke

Full search and certification:

python phase2/src/run_phase2.py \
  --config phase2/configs/phase2.json \
  --run-id run-YYYYMMDD-phase2-full

The historical full run reached the 120-second limit for two selected K=4 LPs. finalize_phase2.py performs only the narrowly scoped IPM recovery permitted by the frozen protocol, preserves the original failures, and then reruns all exact certification and plotting stages. The archived recovery chain can be replayed to a new output directory with:

python phase2/src/finalize_phase2.py \
  --base-run phase2/results/run-20260916-phase2-v1 \
  --output-run phase2/results/run-YYYYMMDD-phase2-certified-replay \
  --config phase2/configs/phase2.json \
  --reuse-retry phase2/results/retry-n16-B002-K4-ipm.json

The certified paper-facing run is phase2/results/run-20260916-phase2-certified-v2/. Certification intervals are deterministic arithmetic enclosures, not Monte Carlo confidence intervals.

Phase 3: schedule comparison and biased-pair pilot

Phase 3 reuses the nine certified Phase 2 witnesses. It compares geometric, equal-size, exhaustive fixed-label, and randomized-label batch schedules, then runs a bounded biased-representative experiment with an expanded pair-state kernel.

The checked-in phase3/inputs/ contains the frozen witnesses and certificates used by the reported run. Run the full Phase 3 pipeline with:

python phase3/run_phase3.py \
  --run-id run-YYYYMMDD-phase3-local

This runs the schedule benchmark, biased pilot, summary validation, and plots. To use a newly certified Phase 2 run, replace the two frozen inputs first:

cp phase2/results/RUN_ID/witnesses.json phase3/inputs/witnesses.json
cp phase2/results/RUN_ID/certificates.json phase3/inputs/certificates.json

To create a separate, data-identical presentation revision for a completed Phase 3 run:

python phase3/publish_figures.py \
  --run-dir phase3/results/run-YYYYMMDD-phase3-local \
  --plotter phase3/plot_phase3.py

The original complete run is phase3/results/run-20260916-phase3-v1/.

Output conventions

  • Run identifiers must start with run- and must be unique.
  • Runners create new directories and refuse to overwrite prior results.
  • status.json is the authoritative completion record.
  • Logs and failed cases are retained rather than silently discarded.
  • PDF and 300-dpi PNG figures are both preserved.
  • Exact certificates and floating-point exploratory diagnostics are labeled separately.

Scientific scope

Phase 1 illustrates finite mechanisms. Phase 2 certifies all-policy error brackets for selected finite exchangeable models but searches only a finite outer family. Phase 3 compares restricted schedules and studies a small biased model. None of these computations replaces the manuscript's analytic proofs, establishes an asymptotic exponent by curve fitting, or certifies performance on language data.

The plotting palette was inspired by figures4papers; the numerical methods and implementations are independent of that repository.

License

No software license has been added. Public visibility alone does not grant a license to reuse the code. Add an explicit software license separately if reuse permissions are desired.