Repository navigation
feat: Phase 5 — Evaluation Harness, Stage 1 baseline recorded - #6
Merged
Merged
Conversation
src/eval.rs [NEW]
- probe_accuracy(model, tokenizer, probes, device) → EvalReport
greedy first-token exact-match; correct = predicted.trim() == expected.trim()
- perplexity(model, tokenizer, examples, device) → f32
token-length-weighted CE (batch=1); returns exp(mean_nll)
- run_eval(checkpoint_dir, probe_path, device) → EvalReport
load_checkpoint → probe_accuracy + perplexity in one call
- EvalReport { probe_accuracy, perplexity, n_correct, n_total, results }
- ProbeResult { name, attribute, prompt, expected, predicted, correct }
- 5 milestone tests (37 total)
src/main.rs [MODIFIED]
- mod eval; declaration
- Eval(EvalArgs) variant in Commands
- EvalArgs: --checkpoint, --probes, --verbose
- cmd_eval: validates paths, calls run_eval, prints accuracy + perplexity +
optional per-probe ✅/❌ table; hints ≥85% threshold for Phase 6 readiness
Architecture decisions:
- first-token exact-match: sufficient for this single-word-value dataset
- batch=1 perplexity loop: no padding complexity, flat memory, <1s on CPU
- run_eval reconstructs Example from ClozeProbe (prompt + expected + '.')
to avoid a second data file; no information loss for single-value facts
Milestone (run against real 2000-step Stage 1 checkpoint):
cargo run --release -- eval --checkpoint checkpoints/stage1 --probes data/stage1_forgetting_probes.jsonl
probe_accuracy : 44.0% (44 / 100)
perplexity : 14.471
Stage 1 baseline recorded — reference for every Phase 7 forgetting delta.
CI: 37/37 tests pass · 0 clippy warnings · cargo build --release ✅
Docs: CHANGELOG + ROADMAP (Phase 5 ✅ DONE) + README (status + phase table)
11 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Phase 5 of the continual-learning-poc roadmap. Implements the reusable evaluation harness that scores any checkpoint against a probe file — this is the measurement instrument every Phase 6–11 forgetting comparison depends on.
What Changed
src/eval.rs[NEW]probe_accuracy(model, tokenizer, probes, device)EvalReportperplexity(model, tokenizer, examples, device)exp(mean_nll)run_eval(checkpoint_dir, probe_path, device)load_checkpoint → probe_accuracy + perplexityin one callEvalReportprobe_accuracy,perplexity,n_correct,n_total,resultsProbeResultname,attribute,prompt,expected,predicted,correctProbe accuracy algorithm:
Design decisions:
run_evalreconstructsExamplefromClozeProbe— avoids a second data file;prompt + expected + "."== original training sentencesrc/main.rs[MODIFIED]Added
mod eval;and theevalsubcommand:Output format:
Tests — 5 new (37 total)
eval::tests::test_probe_accuracy_trained_modeleval::tests::test_probe_accuracy_random_initeval::tests::test_perplexity_decreases_with_trainingeval::tests::test_eval_report_fieldsn_correct + n_wrong == n_total; accuracy field ==n_correct/n_totaleval::tests::test_run_eval_round_triprun_eval→ finite perplexity,n_total > 0Stage 1 Baseline — Milestone Result
44% is the Stage 1 baseline — recorded once, compared against every Phase 7 Stage 2 run to quantify catastrophic forgetting.
CI
cargo fmt --check✅cargo clippy --all-targets -- -D warnings✅ (0 warnings)cargo test --no-fail-fast✅ 37/37 passcargo build --release✅Docs Updated
CHANGELOG.md— Phase 5 entry with arch decisions, test table, milestone resultROADMAP.md— all[ ]→[x], milestone block filled, Phase 5 marked ✅ DONEREADME.md— status updated to Phase 5 ✅ Done, Phase 6 🔜 NextNext: Phase 6 — Stage 2 Corpus + Naive Continual Training
src/dataset/stage2_corpus.rs: disjoint-domain corpus (capital-city facts);train_stage2warm-started from Stage 1 checkpoint;train-stage2 --strategy naiveCLI.