Download docs/final_deck/dense_v26/method.html from Anupam-Rawat-IITB/code-switch-mtp: direct link, hf CLI and curl.
- Browser
- Download file 4.23 kB
-
https://huggingface.co/Anupam-Rawat-IITB/code-switch-mtp/resolve/main/docs/final_deck/dense_v26/method.html
- Command line
-
hf download hf://Anupam-Rawat-IITB/code-switch-mtp/docs/final_deck/dense_v26/method.html
-
curl -L -o method.html https://huggingface.co/Anupam-Rawat-IITB/code-switch-mtp/resolve/main/docs/final_deck/dense_v26/method.html
4.23 kB
| <section id="method" class="backup"> | |
| <h2 class="b-title">Method: one lossless decoder, and which parts are ours</h2> | |
| <p class="k-cap">One round of decoding, left to right. The backbone is frozen; only the draft heads (46.1M parameters) are trained. Each part is marked as prior work or ours.</p> | |
| <div class="m-flow"> | |
| <div class="m-step"> | |
| <p class="m-n">1. Backbone</p> | |
| <p class="m-d">Frozen Llama-3.2-1B gives its own next token and the hidden state at that position.</p> | |
| <p class="m-tag">Given</p> | |
| </div> | |
| <div class="m-step"> | |
| <p class="m-n">2. Draft heads</p> | |
| <p class="m-d">Three look-ahead heads. Each reads the tokens drafted before it and is trained on the backbone’s own outputs.</p> | |
| <p class="m-tag">Prior work: Hydra, Medusa-2, Hydra++</p> | |
| </div> | |
| <div class="m-step"> | |
| <p class="m-n">3. Shortlist</p> | |
| <p class="m-d">Heads score 4,352 tokens: 256 successors of the previous token and the 4,096 most frequent.</p> | |
| <p class="m-tag">Prior work: FR-Spec</p> | |
| </div> | |
| <div class="m-step"> | |
| <p class="m-n">4. Confidence tree</p> | |
| <p class="m-d">4 candidates per node; the N nodes with the highest path probability are kept.</p> | |
| <p class="m-tag">Prior work: EAGLE-2</p> | |
| </div> | |
| <div class="m-step"> | |
| <p class="m-n">5. Copied branch</p> | |
| <p class="m-d">If the last 2 or more tokens occurred earlier, up to 12 tokens that followed are added as a branch.</p> | |
| <p class="m-tag">Prior work: prompt lookup decoding</p> | |
| </div> | |
| <div class="m-step m-ours"> | |
| <p class="m-n">6. Calibrated allocator</p> | |
| <p class="m-d">A linear scorer ranks head nodes and copied nodes in one budget, using confidence, word-group position, script switch and token length.</p> | |
| <p class="m-tag hot">Ours</p> | |
| </div> | |
| <div class="m-step"> | |
| <p class="m-n">7. Verify</p> | |
| <p class="m-d">One backbone pass over all nodes with a tree attention mask. The longest path that matches the backbone is committed.</p> | |
| <p class="m-tag">Prior work: lossless verification</p> | |
| </div> | |
| </div> | |
| <div class="row"> | |
| <div class="blk m-b1"> | |
| <h3 class="blk-h">Ours</h3> | |
| <ul class="m-list"> | |
| <li><b>The word-group diagnosis.</b> Drafts fail at the start of a Hindi word group: 36% first-draft accuracy against 73% to 76% elsewhere, in all four spellings.</li> | |
| <li><b>The learned allocator with linguistic features</b> (step 6): about +1% measured speed (1 seed); the linguistic features themselves help only at 8 verified tokens with 5 copied tokens.</li> | |
| <li><b>The measurement.</b> The same text in four spellings and English, lossless, with copying separated from drafting and speed measured end to end.</li> | |
| </ul> | |
| </div> | |
| <div class="blk m-b2"> | |
| <h3 class="blk-h">What the speed numbers use</h3> | |
| <p class="body">The measured speeds use steps 1 to 5 and 7 with a fixed rule for the copied branch: 12 copied tokens and N − 12 tree nodes when the branch opens.</p> | |
| <p class="body">The allocator of step 6 adds about 1% where the budget leaves room for it: 2.99× against 2.95× at 24 verified tokens (1 seed, next slide).</p> | |
| </div> | |
| <div class="blk m-b3"> | |
| <h3 class="blk-h">Tried and negative</h3> | |
| <p class="body">Reweighting group-start targets in training, word-position features for the heads, shortlists by script, word-group rules for the tree without calibration, ending the copied branch at the word-group boundary. Each changed tokens per pass by less than 1% or lowered it.</p> | |
| </div> | |
| </div> | |
| <p class="compute"><b>Compute.</b> Heads: 10M tokens per run, batch 2 × 512, AdamW, learning rate 1e-4, fp32; 2.8 h for one stack on a GTX 1080 Ti (1,000 tokens/s, 7.4 GB). Allocator: fitted on 358 held-out documents in under 5 min per seed, 5.5 GB.</p> | |
| <aside>References for the borrowed parts: Medusa (draft heads on a frozen model), Hydra (heads that read earlier drafts), Medusa-2 and Hydra++ (heads trained on the model's own outputs), FR-Spec (frequency-ranked shortlist), EAGLE-2 (confidence-ranked draft tree), prompt lookup decoding (drafting by copying from the context). The word group follows Karthika et al. (arXiv 2501.03988). Two versions of the allocator were fitted on documents that are not in the test set: a linear scorer that runs inside the decoder, and a network with two hidden layers of 64 units per tree depth that was evaluated in tokens per pass.</aside> | |
| </section> | |