Add RESULTS.md
Browse files- RESULTS.md +34 -40
RESULTS.md
CHANGED
|
@@ -1,53 +1,47 @@
|
|
| 1 |
# Lesson 08 RESULTS: structured output and constrained decoding (pankh-decider-v1)
|
| 2 |
|
| 3 |
-
Run: 2026-10-11, Apple M4 Max, PyTorch 2.14.1, training
|
| 4 |
|
| 5 |
## Data
|
| 6 |
-
- Same
|
| 7 |
-
- Real slot values:
|
| 8 |
-
-
|
| 9 |
-
- Leakage: identical questions across train/test 0; shared shapes 0 (Lesson 07 check, repeated here); 271/2,000 test questions also fit a loose training-template pattern (same as Lesson 07).
|
| 10 |
|
| 11 |
## Model
|
| 12 |
-
|
| 13 |
-
- 837,888 parameters. 1,500 steps x batch 64, word dropout 0.15 on non-marker input words, loss on the JSON tokens only. 20.5 s on MPS. Final loss 0.0359. Longest target 19 tokens.
|
| 14 |
-
- Values are kept real by pointers: the model writes `<code0>`, the decoder copies the question's first code back in before parsing.
|
| 15 |
|
| 16 |
-
## Stencils
|
| 17 |
-
- Catalog stencil:
|
| 18 |
-
- Grounded stencil:
|
| 19 |
-
- Gold answers
|
|
|
|
| 20 |
|
| 21 |
-
## Numbers (held-out templates, 2,000
|
| 22 |
-
| Decoding | Valid
|
| 23 |
|---|---|---|---|---|
|
| 24 |
-
| Free | 91.
|
| 25 |
-
| Catalog stencil | 100.0% |
|
| 26 |
-
| Grounded stencil | 100.0% |
|
| 27 |
-
|
| 28 |
-
**CHECK (Lesson 08):** with the stencil on, validity
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
| Model | Fixed threshold | Decided
|
| 36 |
|---|---|---|---|---|---|---|
|
| 37 |
-
| v1 free | 0.
|
| 38 |
-
| v1 grounded stencil | 0.
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
## 14 benchmark questions (operation mapped as in Lesson 07; grounded stencil)
|
| 42 |
-
Operation correct 11/14; decided at the fixed threshold 13/14, 2 wrong. The grounded stencil makes "revenue" questions infeasible for the KPI operations ("revenue" is not a metric in the pharma catalog): "Which 10 territories had the most revenue" -> UNSUPPORTED (1.000), "revenue of T-401" -> coverage_owner (0.401). "Why did calls fall in T-112 in 2026-08?" -> kpi_value (0.996), wrong.
|
| 43 |
|
| 44 |
-
##
|
| 45 |
-
|
| 46 |
-
- Operation only (one forward pass + feasibility check): p50 0.813 ms, p95 0.921 ms.
|
| 47 |
-
- Model file 3.3 MB fp32.
|
| 48 |
|
| 49 |
-
##
|
| 50 |
-
|
| 51 |
-
- Each re-run on MPS gives slightly different numbers (training is not bit-exact).
|
| 52 |
|
| 53 |
-
|
|
|
|
|
|
|
|
|
| 1 |
# Lesson 08 RESULTS: structured output and constrained decoding (pankh-decider-v1)
|
| 2 |
|
| 3 |
+
Run (after grading fixes): 2026-10-11, Apple M4 Max, PyTorch 2.14.1, MPS training (GPU shared), CPU latency. papermill, `lesson_08.executed.ipynb` local. Whole notebook **96.5 s**. Seed 42. Not timed on a T4. Warm-started from the re-executed Lesson 07 v0; supersedes the first run.
|
| 4 |
|
| 5 |
## Data
|
| 6 |
+
- Same gen.py sets and shape-hash split as Lesson 07 (fit 15,205, calibration 4,795, test 2,000).
|
| 7 |
+
- Real slot values: gen.py replayed with a recorder (read with ast.literal_eval, never executed); asserted byte-identical (22,000 questions). Gold objects failing the validator: 0. Unpointable training pairs: 0.
|
| 8 |
+
- Leakage: 0 identical questions, 0 shared shapes; 271/2,000 test questions also fit a loose training-template pattern (as in Lesson 07).
|
|
|
|
| 9 |
|
| 10 |
## Model
|
| 11 |
+
Warm start from v0, vocabulary 210 -> 284. 837,888 params; 1,500 steps x 64, word dropout 0.15 (markers exempt), JSON-only loss; 71.9 s on shared MPS; final loss 0.0357. Pointers (`<code0>`) are replaced by the question's real values before parsing.
|
|
|
|
|
|
|
| 12 |
|
| 13 |
+
## Stencils
|
| 14 |
+
- Catalog stencil: router.yaml structure, structural feasibility (pankhllm's slot-fit rule), names in catalog order without skipping a required one, listed enum words, pattern-fitting markers, integers in range, `}}` only when required params present.
|
| 15 |
+
- Grounded stencil: + an enum value only if it or a router.yaml alias appears in the question.
|
| 16 |
+
- Gold answers allowed: catalog 100.0%, grounded 100.0%.
|
| 17 |
+
- Validator: operation, names, enums, patterns, ranges, required params, and every string parameter must appear verbatim in the question.
|
| 18 |
|
| 19 |
+
## Numbers (held-out templates, 2,000, greedy)
|
| 20 |
+
| Decoding | Valid | Exact match | Wrong but valid | Op accuracy |
|
| 21 |
|---|---|---|---|---|
|
| 22 |
+
| Free | 91.6% | 47.3% | 44.4% | 84.5% |
|
| 23 |
+
| Catalog stencil | 100.0% | 50.5% | 49.5% | 84.5% |
|
| 24 |
+
| Grounded stencil | 100.0% | 71.3% | 28.7% | 90.8% |
|
| 25 |
+
|
| 26 |
+
**CHECK (Lesson 08):** with the stencil on, validity **100.0%**; wrong-but-valid **49.5%** (catalog) and **28.7%** (grounded); free decoding 91.6% valid, 44.4% wrong but valid.
|
| 27 |
+
- The catalog stencil (pankhllm's slot-fit check plus structure) left operation accuracy unchanged (84.5% -> 84.5%): it bought validity, not precision. The lift came from grounding enum words.
|
| 28 |
+
- Exact match is literal. Filling router.yaml defaults on both sides makes 67 of 887 free, 81 of 989 catalog and 29 of 574 grounded wrong-but-valid answers equal gold; semantic wrong-but-valid: free 41.0%, catalog 45.4%, grounded 27.3%.
|
| 29 |
+
- Free failures (167): unknown param window 44, not JSON 43, unknown param benchmark 34, direction 22, grain 16.
|
| 30 |
+
- Grounded wrong-but-valid: 390 right op with wrong/missing parameter, 184 wrong op.
|
| 31 |
+
|
| 32 |
+
## Decisions at a threshold (operation; confidence renormalised over feasible ops with the stencil)
|
| 33 |
+
| Model | Fixed threshold | Decided | Op precision | Wrong | JSON exact among decided | Oracle 98% |
|
| 34 |
|---|---|---|---|---|---|---|
|
| 35 |
+
| v1 free | 0.9978 | 7.6% | 100.00% | 0 | 54.90% | 39.2% |
|
| 36 |
+
| v1 grounded stencil | 0.9777 | 72.1% | 98.54% | 21 | 77.05% | 85.4% |
|
| 37 |
+
(The first run of this notebook gave 93.0% at 93.49% for the grounded row: with renormalisation a single feasible operation gets confidence 1.0, so the result swings between runs.)
|
|
|
|
|
|
|
|
|
|
| 38 |
|
| 39 |
+
## 14 benchmark questions (grounded)
|
| 40 |
+
Op correct 11/14; decided 12/14, 2 wrong. "Why did calls fall in T-112 in 2026-08?" -> kpi_value 0.996, decided and wrong. "revenue of T-401" -> prescriber_list (0.512); "Which 10 territories... most revenue" -> UNSUPPORTED (1.000): revenue is not a catalog metric.
|
|
|
|
|
|
|
| 41 |
|
| 42 |
+
## Latency (CPU, batch 1, 300 questions)
|
| 43 |
+
Full JSON, grounded: p50 5.993 ms, p95 9.345 ms, 10.7 tokens (~1,785 tokens/s, no KV cache). Op only: p50 0.873 ms, p95 1.001 ms. 3.3 MB fp32.
|
|
|
|
| 44 |
|
| 45 |
+
## History
|
| 46 |
+
First drafts: wrong replay order, unquoted op names, a mislabelled reason count and a grammar dead end, all fixed before the first full run. After grading: widget gained a pointer-substitution line and hides the final JSON until the last step; the header notes T4 not timed; defaults-adjusted scoring added; re-executed.
|
| 47 |
+
- After this re-execution, one display-only fix was applied to the widget JavaScript in both the clean and the executed notebook without re-running (re-running would change every number down the chain): operation names are now quoted in the "after pointer substitution" line. No computation changed.
|