Download docs/final_deck/slides/tax.html from Anupam-Rawat-IITB/code-switch-mtp: direct link, hf CLI and curl.
- Browser
- Download file 4.3 kB
-
https://huggingface.co/Anupam-Rawat-IITB/code-switch-mtp/resolve/main/docs/final_deck/slides/tax.html
- Command line
-
hf download hf://Anupam-Rawat-IITB/code-switch-mtp/docs/final_deck/slides/tax.html
-
curl -L -o tax.html https://huggingface.co/Anupam-Rawat-IITB/code-switch-mtp/resolve/main/docs/final_deck/slides/tax.html
4.3 kB
| <section id="tax" class="v z6"> | |
| <h2 class="v-title">Drafting shrinks the cost of a poor tokenization</h2> | |
| <table class="t v-t"> | |
| <tr class="t-head"><th>Milliseconds per word</th><th class="v-c">Tokens per word</th><th class="v-c">Greedy decoding</th><th class="v-c">Tree + 12 copied tokens</th><th class="v-c">Speed-up</th></tr> | |
| <tr><td>Llama-3.2-1B, Devanagari</td><td>2.55</td><td>28.4</td><td><b>11.1</b></td><td>2.6×</td></tr> | |
| <tr><td>Llama-3.2-1B, ITRANS</td><td>2.61</td><td>28.3</td><td><b>6.3</b></td><td>4.5×</td></tr> | |
| <tr><td>Sarvam-1, Devanagari</td><td>1.47</td><td>30.8</td><td>15.8</td><td>1.9×</td></tr> | |
| <tr><td>Sarvam-1, ITRANS</td><td>3.36</td><td>70.4</td><td>22.2</td><td>3.2×</td></tr> | |
| </table> | |
| <ul class="v-takes"> | |
| <li>With Sarvam-1, ITRANS is 2.3× slower per word than Devanagari under greedy decoding and 1.4× slower with drafting.</li> | |
| <li>Sarvam-1 needs 1.7× fewer tokens per word but takes 1.9× longer per token, so Llama stays ahead.</li> | |
| </ul> | |
| <p class="v-cav">One A40; the models differ in size (2.4B against 1B parameters). Part of the ITRANS gain is the prompt being restated.</p> | |
| <aside>Milliseconds per word on one A40: greedy decoding against the tree with 12 copied tokens. Romanized text costs Sarvam-1 many more tokens per word; drafting takes most of that penalty away. Detail moved from the slide: Earlier title: tokenization tax under drafting. Milliseconds per word, greedy decoding against tree + 12 copied tokens (three look-ahead heads, shortlist, 16 verified tokens per round). Seed 0, one A40, fp32, output identical to greedy on every document. Tokens per word are those of the generated text. Row: Model and script | Tokens per word | Greedy, ms per word | Tree + 12 copied, ms per word | Speed-up | Speed-up, low-looping documents. Row: Llama-3.2-1B, Devanagari | 2.55 | 28.4 | 11.1 | 2.56× | 2.43×. Row: Llama-3.2-1B, ITRANS | 2.61 | 28.3 | 6.3 | 4.53× | 5.10×. Row: Sarvam-1, Devanagari | 1.47 | 30.8 | 15.8 | 1.95× | 1.85×. Row: Sarvam-1, ITRANS | 3.36 | 70.4 | 22.2 | 3.16× | 3.11×. Low-looping: documents where at most 10% of the continuation repeats itself (44, 52, 52 and 69 documents, rows in order). Both takeaways hold there: with Sarvam-1 the ITRANS penalty falls from 2.21× to 1.31×, and Llama leads at 11.6 against 16.2 ms per word. Drafting shrinks the romanization penalty. With Sarvam-1, ITRANS is 2.28× slower per word than Devanagari under greedy decoding and 1.41× slower with drafting and copying. A better tokenizer does not win by itself. Sarvam-1 needs 1.74× fewer tokens per Devanagari word but takes 1.88× longer per token, and drafting widens Llama’s lead (11.1 against 15.8 ms per word). Part of the ITRANS gain is the prompt being restated, as on slide 1. Caveats. The two models differ in size (Sarvam-1 2.4B parameters, Llama-3.2-1B 1B), so this is not a pure tokenizer comparison. The GPU differs from slide 1: on the A40 the Llama Devanagari speed-ups are 6% to 16% lower than on the GTX 1080 Ti (chain 1.53× against 1.85×, tree + 12 copied 2.56× against 2.90×). Compute. One A40, fp32, batch size 1, greedy decoding; 47.6 min for the four rows together (7.1, 5.9, 9.4 and 10.0 min); 119, 119, 101 and 116 documents (rows in order); peak 5.6 GB with Llama-3.2-1B and 11.1 GB with Sarvam-1. Heads as on the tokenizer slide: Llama-3.2-1B 3.3 h on an A40 (832 tokens/s, 8.6 GiB); Sarvam-1 2.4 to 2.5 h per seed on an A100 80 GB (1,094 to 1,173 tokens/s, 12.5 GiB). Further notes: This comparison was run on the Prajna cluster in a separate session and is not reproduced on our own GPUs. On the low-looping documents greedy decoding takes 28.28, 28.59, 30.00 and 66.19 ms per word (rows in order); the drafted figures there (11.6, 5.6, 16.2 and 21.3 ms per word) are derived from those and the two-decimal speed-ups, not measured separately. Ratios from the table: greedy penalty of ITRANS with Sarvam-1 70.4 / 30.8 = 2.28, with drafting 22.2 / 15.8 = 1.41; with Llama 28.3 / 28.4 = 1.00 and 6.3 / 11.1 = 0.57, so romanized text is faster than Devanagari once copying is on. Tokens per word, Sarvam-1 against Llama on Devanagari: 2.55 / 1.47 = 1.74. Time per token under greedy decoding: 30.8 / 1.47 = 21.0 ms for Sarvam-1 and 28.4 / 2.55 = 11.1 ms for Llama, a ratio of 1.88.</aside> | |
| </section> | |