Lattice_Spike / docs /paper_ready_evaluation.md
Md Saiful Islam Sajol
Upload Lattice_Spike project with full LFS weights
e2c9d42 verified
|
Raw History Blame Contribute Delete
9.6 kB

Paper-Ready Evaluation Protocol

Status: v5.3 is development data with judge-derived labels. Results from it are useful for method development and matched comparison, but they are not an untouched confirmatory test result.

Current run status and the provisional historical numbers are maintained in current_paper_ready_status.md.

1. Locked Inputs

Every reportable run must use:

  1. The exact same raw v5.3 source JSONL, TokenEvalRow export, and dataset-bound grouped split.
  2. The same immutable Llama model revision for model and tokenizer.
  3. The canonical tanazzah-llama-chat replay template and saved answer-token IDs.
  4. A clean Git commit, prediction schema v2, and content hashes for inputs and outputs.
  5. Five fixed training seeds: 42, 43, 44, 45, 46.

The orchestrator rejects mutable model revisions, missing inputs, duplicate seeds, and dirty reportable runs by default. It also checks every row of the TokenEvalRow export against raw v5.3 for ID, prompt, answer, token text, token IDs, G/H/U labels, and t_star_index; the two files cannot be accidentally mixed.

2. Comparison Suites

Causal matched

This is the primary direct comparison. LatticeSpike, EPR token scores, and the corrected Lookback score all predict the current answer token without reading that token. Metrics use exactly the same valid G/H token support.

  • Token index 0 is preserved in artifacts but excluded from metrics because no method has generated-token history before it.
  • U tokens are preserved but excluded from binary metrics.
  • Lookback uses a one-token causal window and never reads future/current-token attention.
  • LatticeSpike uses scoring protocol latticespike_causal_token_v2: Channel 1 at token t compares B[t-1] with B[t], and token zero is padded. Results from the older forward-aligned Channel 1 are not causal-matched results.
  • Any support mismatch is a hard reporting error.

Method faithful

This suite reproduces each method's native unit and information horizon. Its numbers must not be placed in the causal-matched table as if they shared one task.

  • EPR: response-level mean top-k entropy in nats.
  • WEPR: response logistic regression over per-rank entropy mean and maximum.
  • Lookback: the original post-emission, full eight-token-window condition.
  • MVA: the official sequence-level Transformer-CRF condition, maximum length 300.

Offline diagnostic

This suite tests full-sequence MVA with maximum length 512 and partial-label CRF training. U positions are marginalized rather than converted to G/H or used as sequence boundaries. It is explicitly an offline diagnostic, not a causal early-warning comparison.

3. LatticeSpike Selection

  1. Compare ranking-loss weights 0.5 and 1.0 over all five seeds.
  2. Candidate runs are --validation-only; they cannot produce test metrics.
  3. Select the weight with the highest mean validation AUPRC. Break exact ties in favor of the smaller weight.
  4. Evaluate the five validation-selected winner checkpoints on the held-out v5.3 test partition without retraining them.
  5. Select checkpoints by validation AUPRC.
  6. Lock the classification threshold to the most permissive validation threshold whose FPR is at most 1%. Apply that threshold unchanged to test.

The matched LSTM-with-volume control uses the same channels, loss settings, selected rank weight, split, seeds, and threshold policy. Anchor loss remains off in both arms.

4. MVA Formula Variants

MVA is reported as separate named variants; formulas are never silently mixed.

  1. official_code_raw: reproduces the official repository's raw attention feature computation, including its full query-axis mean.
  2. official_code_norm: adds the official static embedding and V/O projection norm weighting.
  3. offline + official_code_raw: uses the partial-label CRF diagnostic.

Before a 200-trial search, run five Optuna trials for one seed of each variant. Record wall time and inspect the logs. The full stage requires the explicit --confirm-full-mva-search flag so a costly search cannot start accidentally.

5. Metrics and Uncertainty

Primary ranking metric: micro average precision on the common causal support.

Also report:

  1. Micro AUROC.
  2. Answer-balanced AP, where each response contributes equal total weight.
  3. Per-source AP and source-macro AP.
  4. Mean and sample standard deviation across training seeds.
  5. A paired 10,000-draw bootstrap for the LatticeSpike-minus-Lookback AP difference. Complete duplicate split_group clusters are resampled within each source.

Source and duplicate-group fields are bound from one explicitly named canonical prediction run after exact token-support validation. Reporting fails if that canonical run has an unknown source or a fallback row-level group.

Training-seed variation and dataset-sampling uncertainty are kept separate; seed-token observations are never pooled into one oversized sample.

6. Commands

Stage the three external v5.3 inputs in one directory. Their exact sizes and SHA-256 hashes are locked in artifacts/v5_3_locked_inputs.json. The repository does not silently download or substitute them.

export V53_DIR=/path/to/v5.3_bundle
export MODEL_REVISION=9213176726f574b556790deb65791e0c5aa438b6
export OUTPUT_ROOT=outputs/paper_ready_eval
export SIGNAL_CACHE=/path/to/sealed/latticespike/signals_fresh
export BASELINE_CACHE=/path/to/sealed/baseline_feature_cache

sha256sum \
  "$V53_DIR/hallu_dataset_v5.3.jsonl" \
  "$V53_DIR/hallu_dataset_v5.3_uncertain_eval.jsonl" \
  "$V53_DIR/hallu_dataset_v5.3_pr44_split.json"

Create a side-effect-free plan:

python scripts/run_paper_ready_eval.py \
  --source-dataset "$V53_DIR/hallu_dataset_v5.3.jsonl" \
  --input "$V53_DIR/hallu_dataset_v5.3_uncertain_eval.jsonl" \
  --split-summary "$V53_DIR/hallu_dataset_v5.3_pr44_split.json" \
  --model meta-llama/Llama-3.2-1B-Instruct \
  --model-revision "$MODEL_REVISION" \
  --output-root "$OUTPUT_ROOT" \
  --stage all

--stage all without --execute only writes a plan. With --execute, it runs rank selection, the locked LatticeSpike and controls, baselines, the five-trial MVA pilot, and the report. It never starts the 200-trial MVA search.

Run the cheap gate first:

python scripts/run_paper_ready_eval.py <same locked arguments> \
  --signal-cache-dir "$SIGNAL_CACHE" --skip-signal-extraction \
  --baseline-feature-cache-dir "$BASELINE_CACHE" \
  --require-baseline-feature-cache \
  --stage smoke --execute

To reuse a previously sealed cache, add --signal-cache-dir /path/to/cache and --skip-signal-extraction. Every tensor, label, replay-material fingerprint, and cached provenance field is still validated; a mismatch fails instead of silently triggering mixed-cache training.

Use a fresh output root for protocol v2. Every later stage adds --resume. Resume is accepted only when the command, Git commit, and every recorded artifact hash match its atomic completion manifest.

Use --stage core for the primary paper workflow after the smoke gate. It selects the rank-loss weight on validation data, evaluates the selected checkpoints on the held-out split, runs the cached standard baselines, and builds the paired report. It intentionally excludes the LSTM control and MVA experiments.

python scripts/run_paper_ready_eval.py <same locked arguments and caches> \
  --stage core --resume --execute

Then run validation-only rank selection, followed by the locked model stages:

python scripts/run_paper_ready_eval.py <same locked arguments> \
  --stage rank-selection --resume --execute

python scripts/run_paper_ready_eval.py <same locked arguments> \
  --stage lattice --locked-rank-weight SELECTED_WEIGHT --resume --execute

python scripts/run_paper_ready_eval.py <same locked arguments> \
  --stage controls --locked-rank-weight SELECTED_WEIGHT --resume --execute

python scripts/run_paper_ready_eval.py <same locked arguments> \
  --stage baselines --resume --execute

MVA full search is currently disabled. Before it is enabled, tuning must become validation-only, occur once per named variant, emit a hash-bound hyperparameter lock, and evaluate five seeds with zero further search. The existing pilot is diagnostic only and must not support a final test claim.

python scripts/run_paper_ready_eval.py <same locked arguments> \
  --stage mva-pilot --execute

python scripts/run_paper_ready_eval.py <same locked arguments> \
  --stage report --locked-rank-weight SELECTED_WEIGHT --execute

All commands, resolved paths, hashes, runtimes, logs, and expected artifacts are recorded under the output root. Immutable plans and atomic per-command manifests survive partial failures; orchestrator_manifest.json cumulatively seals predictions, summaries, checkpoints, diagnostics, provenance, fitted baseline models, reports, and logs. Copy the output root to durable team storage without changing its contents; the manifest then verifies the copy. Use scripts/report_paper_ready_eval.py only on schema-v2 predictions; it fails closed on missing provenance, non-finite comparison scores, or support mismatch.

7. Claim Boundary

The v5.3 table may support a statement such as “under the locked v5.3 development protocol.” It cannot support a definitive generalization claim. That requires a separately collected or separately adjudicated dataset that was never used for pipeline, hyperparameter, checkpoint, or threshold decisions.