Skip to content

Commit c93e500

Browse files
committed
docs(handover): add S5-VERIFICATION-RUNBOOK for trained-weights verification flow
Three-step runbook: wire-format test (no Julia needed), model-load health check via /gnn/health, and MRR measurement via `just eval`. Includes acceptance table (MRR >= 0.66 vs STOP) and troubleshooting matrix for common failure modes. https://claude.ai/code/session_01YPqu7gti4azBach6ZvpRFJ
1 parent 89ae91f commit c93e500

1 file changed

Lines changed: 107 additions & 0 deletions

File tree

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
# S5 Verification Runbook: Trained-Weights Verification Flow
2+
3+
## Purpose
4+
5+
This runbook proves end-to-end that once `just train-cpu` produces real weights
6+
in `models/neural/`, (a) the Julia GNN server picks them up and stops using cosine
7+
similarity, (b) the Rust backends that call `gnn_augment_tactics` receive
8+
model-derived scores via the `/gnn/rank` wire format, and (c) MRR on a held-out
9+
validation split can be measured and compared against the 0.66 cosine baseline.
10+
Steps 1 and 2 can run before training has finished; only Step 3 requires weights.
11+
12+
---
13+
14+
## Prerequisite
15+
16+
`just train-cpu` (or `just train` on GPU) has completed and
17+
`models/neural/gnn_ranker/` (or `best_model/` or `final_model/`) exists.
18+
19+
---
20+
21+
## Step 1 — Confirm wire format (no training needed)
22+
23+
```bash
24+
cargo test --test gnn_augment_integration
25+
```
26+
27+
Spawns an in-process mock HTTP server and asserts:
28+
29+
- `GnnClient::health_status()` returns the richer payload (model_path, vocab_size,
30+
training_records_received).
31+
- For each of rocq, lean, agda, isabelle, z3: `suggest_tactics` returns
32+
`Tactic::Custom { command: "apply", args: ["lemma_foo"] }` as the first tactic,
33+
proving the `/gnn/rank` wire format is consumed correctly by every backend.
34+
35+
Expected output: `test result: ok. 6 passed; 0 failed`.
36+
37+
---
38+
39+
## Step 2 — Confirm model load
40+
41+
Start the Julia GNN server:
42+
43+
```bash
44+
julia --project=src/julia src/julia/api_server.jl
45+
```
46+
47+
(or however you normally start it — check `src/julia/run_server.jl` for args).
48+
Then query health:
49+
50+
```bash
51+
curl -s http://localhost:8090/gnn/health | jq .
52+
```
53+
54+
Expected response when weights are loaded:
55+
56+
```json
57+
{
58+
"status": "ok",
59+
"gnn_model_loaded": true,
60+
"model_path": "/absolute/path/to/models/neural/gnn_ranker",
61+
"vocab_size": <non-zero>,
62+
"training_records_received": 0,
63+
"num_gnn_layers": 4,
64+
"service": "echidna-gnn",
65+
"version": "2.1.0"
66+
}
67+
```
68+
69+
`gnn_model_loaded: true` and `vocab_size > 0` confirm the server picked up real weights
70+
and is no longer falling back to cosine similarity.
71+
72+
---
73+
74+
## Step 3 — Measure lift
75+
76+
```bash
77+
just eval
78+
```
79+
80+
Loads the trained model, runs `compute_metrics` on the held-out validation split
81+
(20% of `training_data/`), and appends one JSONL row to
82+
`training_data/eval_results.jsonl`. Read the result:
83+
84+
```bash
85+
tail -1 training_data/eval_results.jsonl | jq '{mrr, top1, top5, top10, val_size}'
86+
```
87+
88+
---
89+
90+
## Acceptance
91+
92+
| Result | Action |
93+
|--------|--------|
94+
| MRR ≥ 0.66 | Baseline met. Log the row. Run `just train` on GPU for full training. |
95+
| MRR < 0.66 | **STOP.** File a bug. Do not paper over it — this signals architecture mismatch, label leakage, or vocabulary miss. |
96+
97+
---
98+
99+
## Troubleshooting
100+
101+
| Symptom | Check |
102+
|---------|-------|
103+
| `gnn_model_loaded: false` after `just train-cpu` | Confirm `models/neural/gnn_ranker/` exists and contains `model.bson`, `vocabulary.bson`, `config.bson`. Restart the Julia server. |
104+
| Integration test fails on `connection refused` | Re-run: `cargo test --test gnn_augment_integration`. The mock binds `127.0.0.1:0`; transient OS port exhaustion is extremely rare but retry once. |
105+
| `just eval` errors with `No trained model found` | Run `just train-cpu` first. |
106+
| `just eval` errors on a missing solver method | File a bug in the `EchidnaML` Julia module. Do not patch the eval script to bypass. |
107+
| MRR unchanged from 0.66 after training | Check `models/model_metadata.txt` — if it still reads `0 words, 0 classes` the training run did not write weights. Check training logs. |

0 commit comments

Comments
 (0)