Commit 308bae0
committed
feat(v4-11): inference probe extras.inference_probe.{l2_diff,cos_sim}
Closes V4-11 / cppmega-mlx-dpj. Closes G11 from V4 audit (inference-
after-train output divergence never asserted).
Backend (stage_train):
- Before training: forward() over a fixed-seed input
mx.random.normal((1, S, H), key=mx.random.key(42)) using current
weights; snapshot the (B*S*V,)-flat output.
- After all training steps: same forward over the same input.
- Compute l2_diff = ‖after - before‖₂ and cos_sim = <after, before> /
(‖after‖ * ‖before‖). Both surface in extras.inference_probe.
E2E 25_inference_after_train.spec.ts:
- positive: 4-step train shifts inference l2_diff > 0.01 (model
genuinely changed observable output)
- sanity: 1-step train still records a finite, non-negative l2
2/2 green; 29 pytest regression unchanged.1 parent 9efbabc commit 308bae0
2 files changed
Lines changed: 101 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
476 | 476 | | |
477 | 477 | | |
478 | 478 | | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
479 | 495 | | |
480 | 496 | | |
481 | 497 | | |
| |||
520 | 536 | | |
521 | 537 | | |
522 | 538 | | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
523 | 556 | | |
524 | 557 | | |
525 | 558 | | |
| |||
571 | 604 | | |
572 | 605 | | |
573 | 606 | | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
574 | 611 | | |
575 | 612 | | |
576 | 613 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
0 commit comments