esscor commited on
Commit
fc0f435
·
verified ·
1 Parent(s): 4b832ff

TamilBench v1

Browse files
Files changed (3) hide show
  1. README.md +18 -5
  2. data.js +0 -0
  3. index.html +152 -18
README.md CHANGED
@@ -1,10 +1,23 @@
1
  ---
2
- title: TamilBench
3
- emoji: 📊
4
- colorFrom: green
5
- colorTo: purple
6
  sdk: static
7
  pinned: false
 
 
 
 
 
 
 
 
 
 
 
 
8
  ---
 
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: TamilBench - Beam's Tamil Token Tax
3
+ emoji: 🪔
4
+ colorFrom: yellow
5
+ colorTo: red
6
  sdk: static
7
  pinned: false
8
+ license: cc-by-4.0
9
+ short_description: What does Beam charge to think in Tamil and Tanglish?
10
+ models:
11
+ - reflection/Beam-1.0-501B-A23B
12
+ datasets:
13
+ - esscor/TamilBench
14
+ tags:
15
+ - beam
16
+ - build-with-beam
17
+ - tamil
18
+ - multilingual
19
+ - tokenizer
20
  ---
21
+ TamilBench: the same 50 questions in English, Tamil script and Tanglish, plus 22 native-Tamil questions, run on **Beam-1.0-501B-A23B** (via HF Inference Providers / Baseten). Measures accuracy, prompt tokens, reasoning tokens and cost, with an in-browser Beam tokenizer playground and every raw answer with its reasoning trace.
22
 
23
+ Data: https://huggingface.co/datasets/esscor/TamilBench
data.js ADDED
The diff for this file is too large to render. See raw diff
 
index.html CHANGED
@@ -1,19 +1,153 @@
1
  <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">
5
+ <title>TamilBench · What does Beam charge to think in Tamil?</title>
6
+ <link rel="preconnect" href="https://fonts.googleapis.com">
7
+ <link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;600;800&family=Noto+Sans+Tamil:wght@400;600&display=swap" rel="stylesheet">
8
+ <script src="https://cdn.jsdelivr.net/npm/chart.js@4.4.1/dist/chart.umd.min.js"></script>
9
+ <script src="data.js"></script>
10
+ <style>
11
+ :root{--bg:#0d0f14;--card:#161a22;--line:#262c38;--txt:#e8ebf1;--mut:#9aa3b2;--en:#6aa6ff;--ta:#ff8a3d;--tl:#3ddc97;--acc:#ffd166}
12
+ *{box-sizing:border-box}body{margin:0;background:var(--bg);color:var(--txt);font-family:Inter,'Noto Sans Tamil',system-ui,sans-serif;line-height:1.55}
13
+ .wrap{max-width:1080px;margin:0 auto;padding:28px 20px 60px}
14
+ h1{font-size:clamp(28px,4.5vw,46px);line-height:1.1;margin:8px 0 10px;font-weight:800}
15
+ h1 .ta{color:var(--ta)}h2{font-size:24px;margin:44px 0 12px}h3{margin:0 0 6px;font-size:16px}
16
+ .kicker{color:var(--acc);font-weight:600;letter-spacing:.06em;text-transform:uppercase;font-size:13px}
17
+ .lead{color:var(--mut);font-size:18px;max-width:780px}
18
+ .grid{display:grid;gap:14px}.g4{grid-template-columns:repeat(auto-fit,minmax(220px,1fr))}.g2{grid-template-columns:repeat(auto-fit,minmax(420px,1fr))}
19
+ .card{background:var(--card);border:1px solid var(--line);border-radius:14px;padding:18px}
20
+ .big{font-size:38px;font-weight:800;line-height:1}.mut{color:var(--mut);font-size:14px}
21
+ .pill{display:inline-block;padding:2px 9px;border-radius:99px;font-size:12px;font-weight:600;margin-right:6px}
22
+ .en{background:#6aa6ff22;color:var(--en)}.ta{background:#ff8a3d22;color:var(--ta)}.tl{background:#3ddc9722;color:var(--tl)}
23
+ textarea{width:100%;min-height:90px;background:#0b0d12;color:var(--txt);border:1px solid var(--line);border-radius:10px;padding:12px;font:inherit;font-size:16px}
24
+ button,select{background:#222837;color:var(--txt);border:1px solid var(--line);border-radius:9px;padding:8px 12px;font:inherit;cursor:pointer}
25
+ button:hover{border-color:var(--acc)}
26
+ .toks{display:flex;flex-wrap:wrap;gap:3px;margin-top:10px;font-family:ui-monospace,monospace;font-size:13px}
27
+ .toks span{padding:2px 5px;border-radius:5px;background:#ffffff10}
28
+ table{width:100%;border-collapse:collapse;font-size:14px}th,td{text-align:left;padding:7px 8px;border-bottom:1px solid var(--line);vertical-align:top}
29
+ th{color:var(--mut);font-weight:600}tr.row{cursor:pointer}tr.row:hover{background:#ffffff08}
30
+ .ok{color:var(--tl)}.bad{color:#ff5d73}
31
+ .trace{white-space:pre-wrap;font-size:13px;color:var(--mut);background:#0b0d12;border-radius:8px;padding:10px;margin-top:6px}
32
+ ul.f li{margin:8px 0}a{color:var(--en)}
33
+ .foot{margin-top:50px;color:var(--mut);font-size:13px;border-top:1px solid var(--line);padding-top:18px}
34
+ canvas{max-height:320px}
35
+ </style>
36
+ </head>
37
+ <body><div class="wrap">
38
+ <div class="kicker">Build with Beam · TamilBench v1</div>
39
+ <h1>Beam understands <span class="ta">தமிழ்</span> perfectly.<br>It just charges more to think in it.</h1>
40
+ <p class="lead">80 million people speak Tamil, and most of them type it two ways: in Tamil script and in “Tanglish” (Tamil in Latin letters). I asked <b>Beam-1.0-501B-A23B</b> the same 50 questions in English, Tamil and Tanglish, plus 22 questions that only exist in Tamil, and measured accuracy, prompt tokens, reasoning tokens and dollars. <span id="calls"></span></p>
41
+
42
+ <div class="grid g4" style="margin-top:22px">
43
+ <div class="card"><div class="big" id="s-acc"></div><div class="mut">accuracy on the parallel set, in all three languages, at default <i>and</i> minimal reasoning effort</div></div>
44
+ <div class="card"><div class="big" style="color:var(--ta)" id="s-tok"></div><div class="mut">more input tokens for the same question in Tamil script (tokenizer: <span id="s-tpw"></span> tokens per Tamil word)</div></div>
45
+ <div class="card"><div class="big" style="color:var(--tl)" id="s-rsn"></div><div class="mut">more reasoning tokens when the question is in Tanglish; Beam quietly translates before it thinks</div></div>
46
+ <div class="card"><div class="big" style="color:var(--acc)" id="s-cost"></div><div class="mut">cost per query vs English (Tamil / Tanglish) at Baseten’s $0.40 in / $1.20 out per 1M</div></div>
47
+ </div>
48
+
49
+ <h2>The Tamil token tax, measured</h2>
50
+ <div class="grid g2">
51
+ <div class="card"><h3>Where the tokens go (avg per question, default effort)</h3><canvas id="c1"></canvas>
52
+ <p class="mut">Tamil script is expensive to <i>read</i>; Tanglish is cheap to read but expensive to <i>think</i> about. They land at almost the same price.</p></div>
53
+ <div class="card"><h3>Cost per 1,000 questions: default vs <code>reasoning_effort="minimal"</code></h3><canvas id="c2"></canvas>
54
+ <p class="mut">Minimal effort kept 100% accuracy in every language here and cut the bill by <span id="s-save"></span>.</p></div>
55
+ </div>
56
+ <div class="card" style="margin-top:14px"><h3>Reasoning tokens by task type</h3><canvas id="c3"></canvas>
57
+ <p class="mut">Logic puzzles in Tanglish make Beam think ~4× longer than the same puzzle in English, the biggest gap in the set.</p></div>
58
+
59
+ <h2>Try it: how many Beam tokens is your sentence?</h2>
60
+ <div class="card">
61
+ <p class="mut" style="margin-top:0">Runs Beam’s real tokenizer in your browser (loaded from the model repo). Paste anything in Tamil, Tanglish or English.</p>
62
+ <textarea id="tin">யாதும் ஊரே யாவரும் கேளிர்</textarea>
63
+ <div style="margin:10px 0;display:flex;gap:8px;flex-wrap:wrap">
64
+ <button data-s="யாதும் ஊரே யாவரும் கேளிர்">Tamil</button>
65
+ <button data-s="Yaadhum oore yaavarum kelir">Tanglish</button>
66
+ <button data-s="Every town is my town, everyone is my kin">English</button>
67
+ <button data-s="Chennai la oru 2BHK rent evlo?">Tanglish chat</button>
68
+ </div>
69
+ <div id="tout" class="mut">Loading tokenizer…</div><div class="toks" id="tlist"></div>
70
+ </div>
71
+
72
+ <h2>Native Tamil: questions with no English twin</h2>
73
+ <div class="grid g4">
74
+ <div class="card"><div class="big" id="n-acc"></div><div class="mut">accuracy on 22 native items × 3 samples: Tamil number words, ancient numerals (௲ ௱ ௰), letter counting by Tamil grammar, Sangam literature, grammar, the Tamil calendar</div></div>
75
+ <div class="card"><div class="big" id="n-rsn"></div><div class="mut">avg reasoning tokens on native items, about 2.6× the parallel Tamil set: counting எழுத்துகள் through byte-level tokens takes real work</div></div>
76
+ <div class="card"><h3>The one miss</h3><div class="mut">Asked for the last word of Kural 1 (அகர முதல… <b>உலகு</b>), one of three samples answered “என்று” (“that”), echoing the prompt’s phrasing instead of the couplet.</div></div>
77
+ </div>
78
+
79
+ <h2>What this means if you build for Tamil users</h2>
80
+ <div class="card"><ul class="f">
81
+ <li><b>Budget ~1.7× English</b> per Tamil or Tanglish query on Beam. Script choice barely changes the price; it moves cost between input and reasoning.</li>
82
+ <li><b>Turn reasoning down.</b> <code>reasoning_effort="minimal"</code> lost nothing on everyday Tamil tasks and saved ~16–21%.</li>
83
+ <li><b>Long Tamil documents hurt most.</b> At ~0.9 characters per token, Tamil RAG context costs ~3.7× English: summarise or translate retrieved chunks before stuffing a 1M context.</li>
84
+ <li><b>Tanglish is the cheaper input</b> for chat UIs (2.5 chars/token) if you can tolerate the extra thinking; for short-answer apps Tamil script is slightly cheaper overall.</li>
85
+ <li><b>Beam is ready for Tamil.</b> 100% on 300 parallel runs and 98.5% on native tasks means accuracy isn't the problem. Cost is.</li>
86
+ </ul></div>
87
+
88
+ <h2>Every answer, with Beam's reasoning</h2>
89
+ <div class="card">
90
+ <div style="display:flex;gap:8px;flex-wrap:wrap;margin-bottom:10px">
91
+ <select id="fl"><option value="">All languages</option><option value="en">English</option><option value="ta">Tamil</option><option value="tl">Tanglish</option></select>
92
+ <select id="fs"><option value="">All splits</option><option value="parallel|default">Parallel · default</option><option value="parallel|minimal">Parallel · minimal</option><option value="native|default">Native Tamil</option></select>
93
+ <select id="fc"><option value="">All results</option><option value="0">Wrong only</option></select>
94
+ </div>
95
+ <div style="max-height:520px;overflow:auto"><table><thead><tr><th>ID</th><th>Lang</th><th>Question</th><th>Gold</th><th>Beam</th><th>In</th><th>Think</th></tr></thead><tbody id="tb"></tbody></table></div>
96
+ <p class="mut">Tap a row to read Beam's reasoning trace (first 700 characters).</p>
97
+ </div>
98
+
99
+ <h2>Method</h2>
100
+ <div class="card mut">
101
+ <p>50 parallel items (20 math word problems with Indian context such as auto fares, rent splits and cents of land, 8 logic, 15 Tamil culture and knowledge, 7 everyday), each written in English, Tamil script and colloquial Tanglish, plus 22 native-Tamil items. Every prompt ends with “answer only” in its own language. Model: <code>reflection/Beam-1.0-501B-A23B</code> via Hugging Face Inference Providers (Baseten), max_tokens 6000. Parallel set: 2 samples per language at default effort and 1 at minimal effort; native set: 3 samples. Scoring: last number for numeric answers, alias match for words (Tamil or Latin script, Tamil digits normalised). Token counts come from the API's usage field; tokenizer stats come from Beam's own <code>tokenizer.json</code>. Cost uses Baseten list price ($0.40/1M input, $1.20/1M output incl. reasoning) as of Oct 2026. Total spend for the whole study: <b id="s-total"></b>.</p>
102
+ <p><b>Limits:</b> 72 items is small, and the parallel set is saturated (Beam aced it), so treat accuracy as a sanity floor; the token and cost findings are the point. Next: longer documents, Tamil-script answers, and a harder native split.</p>
103
+ <p>Dataset, prompts, every raw response: <a href="https://huggingface.co/datasets/esscor/TamilBench" target="_blank">huggingface.co/datasets/esscor/TamilBench</a></p>
104
+ </div>
105
+ <div class="foot">Built by Mohamed Adib (SVCE Chennai) for the Hugging Face × Reflection “Build with Beam” challenge. Apache-2.0 model; data CC-BY-4.0.</div>
106
+ </div>
107
+ <script>
108
+ const {S,Q,R}=window.TB, L={en:'English',ta:'Tamil',tl:'Tanglish'}, C={en:'#6aa6ff',ta:'#ff8a3d',tl:'#3ddc97'};
109
+ const d=S.default,m=S.minimal,f=x=>x.toFixed(2);
110
+ calls.textContent=`${S.total_calls} API calls in total.`;
111
+ document.getElementById('s-acc').textContent='100%';
112
+ document.getElementById('s-tok').textContent=(S.tokenizer.ta.tokens/S.tokenizer.en.tokens).toFixed(1)+'×';
113
+ document.getElementById('s-tpw').textContent=S.tokenizer.ta.tok_per_word;
114
+ document.getElementById('s-rsn').textContent=(d.tl.reasoning/d.en.reasoning).toFixed(1)+'×';
115
+ document.getElementById('s-cost').textContent=(d.ta.cost_per_1k/d.en.cost_per_1k).toFixed(1)+'× / '+(d.tl.cost_per_1k/d.en.cost_per_1k).toFixed(1)+'×';
116
+ const sv=['en','ta','tl'].map(l=>1-m[l].cost_per_1k/d[l].cost_per_1k);
117
+ document.getElementById('s-save').textContent=Math.round(Math.min(...sv)*100)+'–'+Math.round(Math.max(...sv)*100)+'%';
118
+ document.getElementById('n-acc').textContent=S.native.acc+'%';
119
+ document.getElementById('n-rsn').textContent=Math.round(S.native.reasoning);
120
+ document.getElementById('s-total').textContent='$'+S.total_cost.toFixed(2);
121
+ Chart.defaults.color='#9aa3b2';Chart.defaults.borderColor='#262c38';Chart.defaults.font.family='Inter';
122
+ const langs=['en','ta','tl'];
123
+ new Chart(c1,{type:'bar',data:{labels:langs.map(l=>L[l]),datasets:[
124
+ {label:'Prompt tokens',data:langs.map(l=>d[l].prompt),backgroundColor:'#ffd166'},
125
+ {label:'Reasoning tokens',data:langs.map(l=>d[l].reasoning),backgroundColor:'#c77dff'},
126
+ {label:'Answer tokens',data:langs.map(l=>d[l].completion-d[l].reasoning),backgroundColor:'#3ddc97'}]},
127
+ options:{plugins:{legend:{position:'bottom'}},scales:{x:{stacked:true},y:{stacked:true}}}});
128
+ new Chart(c2,{type:'bar',data:{labels:langs.map(l=>L[l]),datasets:[
129
+ {label:'Default effort',data:langs.map(l=>d[l].cost_per_1k),backgroundColor:langs.map(l=>C[l])},
130
+ {label:'Minimal effort',data:langs.map(l=>m[l].cost_per_1k),backgroundColor:langs.map(l=>C[l]+'77')}]},
131
+ options:{plugins:{legend:{position:'bottom'},tooltip:{callbacks:{label:c=>' $'+c.raw.toFixed(3)+' per 1k'}}},scales:{y:{ticks:{callback:v=>'$'+v}}}}});
132
+ const cats=['math','logic','knowledge','everyday'];
133
+ new Chart(c3,{type:'bar',data:{labels:cats,datasets:langs.map(l=>({label:L[l],data:cats.map(c=>S.bycat[c][l].reasoning),backgroundColor:C[l]}))},options:{plugins:{legend:{position:'bottom'}}}});
134
+ // table
135
+ function render(){const fl=document.getElementById('fl').value,fs=document.getElementById('fs').value,fc=document.getElementById('fc').value;let h='';
136
+ R.forEach((r,i)=>{if(fl&&r.lang!==fl)return;if(fs&&(r.split+'|'+r.effort)!==fs)return;if(fc==='0'&&r.ok)return;const q=Q[r.id];
137
+ h+=`<tr class="row" data-i="${i}"><td>${r.id}${r.split==='parallel'&&r.effort==='minimal'?' <span class="mut">min</span>':''}</td><td><span class="pill ${r.lang}">${L[r.lang]}</span></td><td>${(q[r.lang]||'').slice(0,90)}</td><td>${q.answer}</td><td class="${r.ok?'ok':'bad'}">${r.out.replace(/</g,'&lt;')}</td><td>${r.pt}</td><td>${r.rt}</td></tr>`});
138
+ tb.innerHTML=h}
139
+ ['fl','fs','fc'].forEach(x=>document.getElementById(x).onchange=render);render();
140
+ tb.onclick=e=>{const tr=e.target.closest('tr.row');if(!tr)return;const nx=tr.nextElementSibling;if(nx&&nx.classList.contains('tr'))return nx.remove();
141
+ const r=R[tr.dataset.i];const t=document.createElement('tr');t.className='tr';t.innerHTML=`<td colspan="7"><div class="trace">${(r.why||'(no trace)').replace(/</g,'&lt;')}</div></td>`;tr.after(t)};
142
+ </script>
143
+ <script type="module">
144
+ import {AutoTokenizer} from 'https://cdn.jsdelivr.net/npm/@huggingface/transformers@3.5.1';
145
+ const out=document.getElementById('tout'),list=document.getElementById('tlist'),tin=document.getElementById('tin');
146
+ let tok;
147
+ try{tok=await AutoTokenizer.from_pretrained('reflection/Beam-1.0-501B-A23B');}catch(e){out.textContent='Could not load the tokenizer in this browser ('+e.message+').';}
148
+ function go(){if(!tok)return;const s=tin.value;const ids=tok.encode(s,{add_special_tokens:false});const words=s.trim().split(/\s+/).filter(Boolean).length||1;
149
+ out.innerHTML=`<b style="color:#ffd166;font-size:22px">${ids.length}</b> Beam tokens · ${[...s].length} characters · ${(ids.length/words).toFixed(1)} tokens per word`;
150
+ list.innerHTML=ids.slice(0,200).map(i=>`<span>${tok.decode([i]).replace(/</g,'&lt;')||'·'}</span>`).join('')}
151
+ tin.oninput=go;document.querySelectorAll('[data-s]').forEach(b=>b.onclick=()=>{tin.value=b.dataset.s;go()});go();
152
+ </script>
153
+ </body></html>