geraldaton20 commited on
Commit
0826b09
Β·
verified Β·
1 Parent(s): 691144b

Model card: real training stats, usage, and limits

Browse files
Files changed (1) hide show
  1. README.md +82 -18
README.md CHANGED
@@ -8,7 +8,7 @@ tags:
8
  - vsa
9
  - neuro-symbolic
10
  - laya
11
- base_model: NandhaKishorM/laya
12
  ---
13
 
14
  # hd-laya
@@ -18,29 +18,93 @@ un-distilled upstream [laya](https://github.com/NandhaKishorM/laya) System-1
18
  engine. It removes laya's ~20-option choice ceiling and lets a
19
  hyperdimensional (HDC/VSA) workspace manage context.
20
 
21
- - **v0.1** (GitHub): no-train HDC harness around unmodified laya checkpoints.
22
- - **v1.0** (this release): trained components β€” HDC option slots, HDC-context
23
- hypertoken projection, realtime RLCD refine loop.
 
24
 
25
- ## Measured laws (probes 1–5)
26
 
27
- | Probe | Verdict |
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  |---|---|
29
- | 1 speed | scan sweet spot 1024–2048d |
30
- | 2 matryoshka | two-stage == full-D (0–0.056%); ≀2.8Γ— scan speedup |
31
- | 3 semantic | 512-bit SimHash β‰ˆ float top-1 within near-ties; β‰₯2048 exact |
32
- | 4 capacity | D/64 pairs exact-or-refuse |
33
- | 5 head update | realtime RLCD: 23–63 ms/update on T4 |
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
 
35
- ## Artifacts
 
 
 
 
 
 
 
 
36
 
37
- - `hd_laya_head.pt` β€” trained head checkpoint (PyTorch state_dict, 1000 steps, K=[77,150])
38
- - `head.onnx` β€” promoted head in ONNX (opset 17, verified on ONNX Runtime CPU)
39
 
40
- ## Inference
41
 
42
- ONNX Runtime (CPU/CUDA) + PyTorch/transformers. Encoder is a frozen graph;
43
- the head is swappable (promote-on-gate).
 
 
 
 
 
 
 
 
44
 
45
  ## License
46
 
@@ -49,4 +113,4 @@ Apache-2.0 (derived from laya; attribution to NandhaKishorM/laya).
49
  ## Links
50
 
51
  - GitHub: https://github.com/sensesVoid/hd-laya
52
- - SQAC docs: design spec + probe verdicts (project key `hd-laya`)
 
8
  - vsa
9
  - neuro-symbolic
10
  - laya
11
+ base_model: convaiinnovations/laya
12
  ---
13
 
14
  # hd-laya
 
18
  engine. It removes laya's ~20-option choice ceiling and lets a
19
  hyperdimensional (HDC/VSA) workspace manage context.
20
 
21
+ - **v0.1** (GitHub): no-train HDC harness around unmodified laya checkpoints β€”
22
+ two-stage option index, int16 counter workspace, z-gate abstention.
23
+ - **v1.0** (this repo): trained head on a high-K choice task, so the narrowed
24
+ option set is scored by a head that was actually trained for it.
25
 
26
+ ## Files
27
 
28
+ | File | Size | What it is |
29
+ |---|---|---|
30
+ | `hd_laya_trained.pt` | 106 MB | trainable weights only (`head`, `scorer`, `act_head`, `type_emb`, `temperature`) |
31
+ | `head.onnx` + `head.onnx.data` | 0.7 MB + 100 MB | the trained TransformerEncoder head as an ONNX graph (opset 18) |
32
+
33
+ The checkpoint holds **trainable weights only**. The encoder is frozen and comes
34
+ from `convaiinnovations/laya`, so load the base model first and then apply this
35
+ state dict. `hd_laya.laya_agent` does that and refuses to continue if any
36
+ non-encoder weight fails to load β€” a half-loaded head answers confidently at
37
+ random, which is worse than an error.
38
+
39
+ ## Training
40
+
41
+ | | |
42
+ |---|---|
43
+ | base model | `convaiinnovations/laya` (encoder frozen) |
44
+ | hardware | Kaggle T4 x2 |
45
+ | task | synthetic high-K choice, K=77, 512 items |
46
+ | epochs | 4 (RLCD objective, option-order shuffling on `choice`) |
47
+ | budgets | `max_len=512`, `head_max_len=192` |
48
+ | trainable params | 26,512,131 |
49
+ | epoch losses | 3.89, 4.42, 4.05, 3.96 |
50
+
51
+ ## Measured
52
+
53
+ Local CPU run, 48 generated items at K=20 (chance = 5%):
54
+
55
+ | metric | value |
56
  |---|---|
57
+ | accuracy | 52.1% |
58
+ | refusal rate (z-gate, `z_bar=5.0`) | 6.25% |
59
+ | accuracy on answered | 55.6% |
60
+
61
+ These numbers say the head learned the task; they are not a benchmark result.
62
+ The high-K suite (K = 20/77/150/500/1000, 256 items each, HDC narrowing to 20
63
+ options before the forward pass) is what measures the index-plus-head path, and
64
+ its numbers belong in the GitHub README when they land.
65
+
66
+ ## Usage
67
+
68
+ ```python
69
+ from huggingface_hub import hf_hub_download
70
+ from laya.agent import Agent
71
+ from hd_laya.agent import HDLayaAgent
72
+ from hd_laya.laya_agent import TrainedLayaAgent
73
+
74
+ ckpt = hf_hub_download("geraldaton20/hd-laya", "hd_laya_trained.pt")
75
+ laya = Agent("convaiinnovations/laya", device="cuda")
76
+
77
+ # Fails loudly if the checkpoint does not fit this architecture.
78
+ trained = TrainedLayaAgent.from_checkpoint(
79
+ ckpt, agent=laya, max_len=512, head_max_len=192
80
+ )
81
+ agent = HDLayaAgent(trained, max_options=20, z_bar=5.0)
82
 
83
+ result = agent.predict(
84
+ "customer wants to refund order",
85
+ {"q": {"type": "choice",
86
+ "instructions": "Choose the option that matches the customer request.",
87
+ "criteria": {"opt_0": "refund order (variant 0)",
88
+ "opt_1": "reset password (variant 1)"}}},
89
+ )
90
+ print(result["answers"]["q"]["choice"], result["meta"]["z"])
91
+ ```
92
 
93
+ Question sets above `max_options` are narrowed by the HDC option index first;
94
+ the answer maps back to the original labels.
95
 
96
+ ## Limitations
97
 
98
+ - **Uncalibrated.** No temperature fit was applied after training; the smoke
99
+ sample measured top-label ECE β‰ˆ 0.60. Treat `confidence` as uncalibrated.
100
+ - **Head-only ONNX.** `head.onnx` exports the trained encoder block
101
+ (`src`, `src_key_padding_mask` β†’ hidden states). `scorer`, `act_head` and the
102
+ encoder stay in PyTorch for now.
103
+ - **Trained at K=77.** The head saw 77 options with 192 head tokens during
104
+ training, where options were truncated aggressively; the K=20 numbers above are
105
+ the cleaner read of its skill.
106
+ - **Synthetic task.** Topics are 12 templates; this is a pipeline milestone, not
107
+ evidence about real intents.
108
 
109
  ## License
110
 
 
113
  ## Links
114
 
115
  - GitHub: https://github.com/sensesVoid/hd-laya
116
+ - Upstream: https://github.com/NandhaKishorM/laya