Premchandyadav369 commited on
Commit
3d24ee3
·
1 Parent(s): 114f6bd

docs(paper): exact IEEE layout standards, 6 pages, table-aligned non-overlapping equations & 7 figures

Browse files
paper/ieee_conference_6page_qtensorformer.pdf CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:693d1128cc7d93ea341c95a12f0c3789297f21e255cd1c994fdd59dba62a73e3
3
- size 1641126
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b978b9c212c2ab6c7b09e696e4c5e5968d50b66fb40b1f1de454931413b7c31c
3
+ size 1805737
paper/ieee_conference_paper.html CHANGED
The diff for this file is too large to render. See raw diff
 
paper/ieee_conference_paper_raw.html CHANGED
The diff for this file is too large to render. See raw diff
 
paper/q_tensorformer_ieee_paper.pdf CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:693d1128cc7d93ea341c95a12f0c3789297f21e255cd1c994fdd59dba62a73e3
3
- size 1641126
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b978b9c212c2ab6c7b09e696e4c5e5968d50b66fb40b1f1de454931413b7c31c
3
+ size 1805737
scripts/generate_ieee_pdf.py CHANGED
@@ -1,15 +1,21 @@
1
  #!/usr/bin/env python3
2
  """
3
  scripts/generate_ieee_pdf.py
4
- Generates camera-ready 6-page IEEE Conference PDF for Q-TensorFormer.
5
- Paper Title: Q-TensorFormer: Real-Time High-Throughput Edge LLM Inference via
6
- Zero-SVD Dynamic Tensor-Train Slicing and Provable Lyapunov-Stable Control
7
- Authors: Dr. Madala Guru Brahmam (1st) & V C Premchand Yadav (2nd) - VIT-AP University.
8
-
9
- Pre-renders all LaTeX math offline using KaTeX into MathML + HTML spans,
10
- inlines KaTeX CSS and base64 vector figures, and compiles via Headless Chrome
11
- with --no-pdf-header-footer to eliminate dates, URLs, and browser headers.
12
- Strict constraint: Zero em dashes anywhere in manuscript.
 
 
 
 
 
 
13
  """
14
 
15
  import base64
@@ -35,13 +41,14 @@ def get_base64_image(filename):
35
  return ""
36
 
37
  fig1_b64 = get_base64_image("figure1_architecture.png")
38
- fig2_b64 = get_base64_image("figure4_nested_tt_suboptimality.png")
39
- fig3_b64 = get_base64_image("figure8_controller_convergence.png")
40
- fig4_b64 = get_base64_image("figure7_kv_rate_distortion.png")
41
- fig5_b64 = get_base64_image("figure16_baseline_improvement_radar.png")
42
- fig6_b64 = get_base64_image("figure12_hardware_roofline.png")
43
-
44
- raw_template = '''<!DOCTYPE html>
 
45
  <html lang="en">
46
  <head>
47
  <meta charset="utf-8">
@@ -51,13 +58,16 @@ raw_template = '''<!DOCTYPE html>
51
 
52
  @page {
53
  size: letter;
54
- margin: 0.65in 0.55in 0.65in 0.55in;
 
 
 
55
  }
56
 
57
  body {
58
  font-family: "Times New Roman", Times, "Nimbus Roman No9 L", serif;
59
  font-size: 10pt;
60
- line-height: 1.30;
61
  color: #000;
62
  margin: 0;
63
  padding: 0;
@@ -66,105 +76,108 @@ body {
66
  print-color-adjust: exact;
67
  }
68
 
 
69
  .title-container {
70
  text-align: center;
71
- margin-bottom: 15pt;
72
- padding-bottom: 7pt;
73
- border-bottom: 0.5pt solid #ddd;
74
  }
75
 
76
  .paper-title {
77
- font-size: 19.5pt;
78
- font-weight: bold;
79
- line-height: 1.22;
80
- margin-bottom: 13pt;
81
  letter-spacing: -0.2px;
82
  }
83
 
84
  .author-block {
85
  display: flex;
86
  justify-content: center;
87
- gap: 50pt;
88
- margin-bottom: 11pt;
89
  }
90
 
91
  .author-col {
92
  text-align: center;
93
- max-width: 270pt;
94
  }
95
 
96
  .author-name {
97
- font-size: 11.5pt;
98
- font-weight: bold;
99
  margin-bottom: 2pt;
100
  }
101
 
102
  .author-affil {
103
- font-size: 9pt;
104
  font-style: italic;
105
- line-height: 1.25;
106
  }
107
 
108
  .author-email {
109
- font-size: 8.5pt;
110
  font-family: "Courier New", monospace;
 
111
  margin-top: 3pt;
112
- color: #111;
113
  }
114
 
 
115
  .two-col {
116
  column-count: 2;
117
- column-gap: 18pt;
118
  text-align: justify;
 
119
  }
120
 
 
121
  .abstract-box {
122
- margin-bottom: 11pt;
123
- font-size: 9.5pt;
124
- line-height: 1.25;
125
- }
126
-
127
- .abstract-title {
128
- font-weight: bold;
129
- font-style: italic;
130
  }
131
 
132
  .keywords-box {
133
- margin-bottom: 13pt;
134
- font-size: 9.5pt;
135
- line-height: 1.25;
136
- }
137
-
138
- .keywords-title {
139
- font-weight: bold;
140
- font-style: italic;
141
  }
142
 
 
143
  h2 {
144
- font-size: 10.5pt;
145
- font-weight: bold;
 
146
  text-transform: uppercase;
147
  text-align: center;
148
- margin-top: 15pt;
149
- margin-bottom: 5pt;
150
- letter-spacing: 0.4px;
151
  break-after: avoid;
152
- border-bottom: 0.5pt solid #ccc;
153
- padding-bottom: 2pt;
154
  }
155
 
156
  h3 {
157
  font-size: 10pt;
158
- font-weight: bold;
159
  font-style: italic;
 
160
  margin-top: 9pt;
161
  margin-bottom: 3pt;
162
  break-after: avoid;
163
  }
164
 
 
 
 
 
 
 
165
  p {
166
  margin-top: 0;
167
- margin-bottom: 5pt;
168
  text-indent: 1.2em;
169
  }
170
 
@@ -172,13 +185,41 @@ p {
172
  text-indent: 0;
173
  }
174
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
175
  .theorem-box {
176
- margin: 7pt 0;
177
- padding: 4pt 6pt;
178
  font-style: italic;
179
- border-left: 2.5pt solid #000;
180
- background: #fbfbfb;
181
  break-inside: avoid;
 
182
  }
183
 
184
  .theorem-title {
@@ -188,8 +229,8 @@ p {
188
 
189
  .proof {
190
  font-style: normal;
191
- font-size: 9.2pt;
192
- margin: 3pt 0 6pt 0;
193
  text-indent: 1.2em;
194
  }
195
 
@@ -198,135 +239,128 @@ p {
198
  font-weight: bold;
199
  }
200
 
201
- table {
 
202
  width: 100%;
203
  border-collapse: collapse;
204
- font-size: 8.5pt;
205
- margin: 8pt 0;
206
- line-height: 1.20;
207
  break-inside: avoid;
208
  }
209
 
210
- th, td {
211
- padding: 3.2pt 4pt;
212
  text-align: left;
213
  }
214
 
215
- th {
216
  font-weight: bold;
217
- border-top: 1.4pt solid #000;
218
- border-bottom: 0.8pt solid #000;
219
- background: #f4f4f4;
220
  }
221
 
222
- td {
223
  border-bottom: 0.4pt solid #e0e0e0;
224
  }
225
 
226
  .table-bottom {
227
- border-bottom: 1.4pt solid #000;
228
  }
229
 
230
  .table-caption {
231
- font-size: 8.5pt;
232
  text-align: center;
233
- font-weight: bold;
234
- margin-bottom: 3pt;
235
- text-transform: uppercase;
236
- letter-spacing: 0.3px;
237
  }
238
 
239
  .highlight-row {
240
- background-color: #f0f7ff;
241
  font-weight: bold;
242
  }
243
 
 
244
  .figure-card {
245
  width: 100%;
246
- margin: 9pt 0;
247
  text-align: center;
248
  break-inside: avoid;
249
  }
250
 
251
  .figure-card img {
252
  width: 100%;
253
- max-height: 185pt;
254
  object-fit: contain;
255
- border: 0.5pt solid #ddd;
256
- border-radius: 2pt;
257
  }
258
 
259
  .figure-caption {
260
- font-size: 8.5pt;
261
  text-align: justify;
262
- line-height: 1.20;
263
- margin-top: 4pt;
264
  }
265
 
266
  .figure-caption-title {
267
- font-weight: bold;
268
  }
269
 
 
270
  .algorithm-box {
271
- border-top: 1.4pt solid #000;
272
- border-bottom: 1.4pt solid #000;
273
- padding: 5pt 3pt;
274
- font-size: 8.5pt;
275
  font-family: "Courier New", monospace;
276
- margin: 8pt 0;
277
- line-height: 1.24;
278
- background: #fdfdfd;
279
  break-inside: avoid;
280
  }
281
 
282
  .algo-header {
283
  font-family: "Times New Roman", Times, serif;
284
  font-weight: bold;
285
- font-size: 9pt;
286
- margin-bottom: 3pt;
287
- border-bottom: 0.6pt solid #000;
288
  padding-bottom: 2pt;
289
  }
290
 
291
- .eq-container {
292
- display: flex;
293
- justify-content: space-between;
294
- align-items: center;
295
- margin: 5pt 0;
296
- break-inside: avoid;
297
- }
298
-
299
- .eq-math {
300
- flex-grow: 1;
301
- text-align: center;
302
- }
303
-
304
- .eq-num {
305
- font-size: 9.5pt;
306
  font-weight: normal;
307
- padding-left: 8pt;
308
- white-space: nowrap;
 
 
309
  }
310
 
311
  .references {
312
- font-size: 8.5pt;
313
- line-height: 1.20;
314
  }
315
 
316
  .ref-item {
317
- margin-bottom: 3.5pt;
318
- text-indent: -1.4em;
319
- margin-left: 1.4em;
320
  }
321
 
322
  .perf-badge {
323
  display: inline-block;
324
- padding: 1pt 3pt;
325
  font-size: 7.5pt;
326
  font-weight: bold;
327
  color: #0b6623;
328
  background: #eaf8ec;
329
- border-radius: 2pt;
330
  }
331
  </style>
332
  </head>
@@ -337,12 +371,12 @@ td {
337
  <div class="author-block">
338
  <div class="author-col">
339
  <div class="author-name">Dr. Madala Guru Brahmam</div>
340
- <div class="author-affil">Assistant Professor, Department of Computer Science and Engineering (AIML)<br>School of Computer Science and Engineering (SCOPE)<br>VIT-AP University, Amaravati, Andhra Pradesh, India</div>
341
  <div class="author-email">madala.gurubrahmam@vitap.ac.in</div>
342
  </div>
343
  <div class="author-col">
344
  <div class="author-name">V C Premchand Yadav</div>
345
- <div class="author-affil">Final Year B.Tech Student, Department of CSE (AIML)<br>School of Computer Science and Engineering (SCOPE)<br>VIT-AP University, Amaravati, Andhra Pradesh, India</div>
346
  <div class="author-email">premchandyadav.vc21bce9124@vitap.ac.in</div>
347
  </div>
348
  </div>
@@ -351,61 +385,67 @@ td {
351
  <div class="two-col">
352
 
353
  <div class="abstract-box">
354
- <span class="abstract-title">Abstract</span>: Deploying autoregressive vision-language foundation models on resource-constrained edge microarchitectures (mobile SoCs, robotics platforms, embedded NPUs) is severely impeded by memory bus saturation, thermal throttling, and unpredictable dynamic execution budgets. Existing compression paradigms, including post-training quantization (AWQ, SmoothQuant), structural pruning, and static low-rank adaptation, permanently fix parameter geometry offline. They lack the plasticity to scale throughput dynamically during real-time hardware stress or burst reasoning demands. In this paper, we present <b>Q-TensorFormer</b>, a closed-loop cyber-physical architecture delivering real-time, high-throughput edge LLM inference. Q-TensorFormer establishes five unified innovations: (1) nested Tensor-Train parameterization enabling instant sub-15-microsecond active rank slicing ($r \\in \\{1, 2, 4, 8, 16\\}$) with zero runtime singular value decomposition (Zero-SVD) and zero memory reallocation; (2) a discrete-time Lyapunov-stable dual-subgradient controller with analytical hysteresis deadband ($\\tau = 0.15$), proven to eliminate limit-cycle chattering ($\\Delta V_t \\le 0$); (3) an entropy-gated semantic anchor KV-cache slashing memory footprint by up to $93.36\\%$ with guaranteed $100\\%$ precision retention on critical needle tokens; (4) an in-register fused contraction kernel eliminating $96.90\\%$ of intermediate DRAM traffic; and (5) a LinUCB contextual bandit token scheduler with proven sub-linear regret $\\mathcal{O}(d \\sqrt{T \\ln(T/\\delta)})$. Across 50 empirical trials on edge hardware, Q-TensorFormer delivers a <b>4.8x throughput speedup</b> on Raspberry Pi 5 (18.2 vs 3.8 tok/s) and <b>3.9x</b> on NVIDIA Jetson Orin Nano (94.7 vs 24.1 tok/s), cuts peak RAM by <b>72.8%</b>, and switches rank in <b>14.2 &mu;s</b> (9,042x faster than 128 ms SVD re-factorization) with zero accuracy collapse ($p < 10^{-15}$, Cohen's $d = 1.354$).
355
  </div>
356
 
357
  <div class="keywords-box">
358
- <span class="keywords-title">Index Terms</span>: Edge LLM inference, Tensor-Train decomposition, real-time edge AI, Lyapunov stability, closed-loop control, LinUCB contextual bandits, KV-cache compression, memory bandwidth optimization.
359
  </div>
360
 
361
  <h2>I. Introduction</h2>
362
- <p class="no-indent">Decentralized on-device artificial intelligence requires deploying multi-billion-parameter Transformer foundation models directly on constrained edge edge devices, including mobile systems-on-chip, autonomous robotic units, and battery-powered embedded devices [1], [2], [3]. Edge execution eliminates round-trip cloud latency, preserves data privacy, and functions reliably in disconnected environments. However, deploying autoregressive foundation models on edge microarchitectures exposes two critical physical walls:</p>
363
 
364
- <p><b>1) The Edge Memory Bandwidth Wall:</b> Autoregressive decoding is inherently memory-bound. Generating each single token demands transferring gigabytes of weight parameters and accumulating Key-Value (KV) cache states from external Dynamic RAM (DRAM) into on-chip cache lines. Narrow edge buses (16-bit to 64-bit wide LPDDR4X/LPDDR5 channels) quickly saturate, throttling arithmetic intensity below $0.05$ FLOP/Byte [4], [5], [6].</p>
365
 
366
- <p><b>2) Rigid Static Model Geometries:</b> Mainstream compression techniques, including 4-bit weight quantization (AWQ [7], SmoothQuant [8]), static low-rank adaptation (LoRA [2]), and 1-bit representations (BitNet b1.58 [9]), permanently freeze parameter shapes at compilation. When real-time operating conditions deteriorate, such as processor junction temperature spiking above safe thermal limits ($T_j > 95^\\circ\\text{C}$), battery state-of-charge decaying, or concurrent threads starving DRAM bandwidth, static models suffer severe thermal throttling, causing frame drops and system lockups [10], [11].</p>
367
 
368
  <p>To overcome these foundational limitations, we introduce <b>Q-TensorFormer</b>. Rather than relying on heuristic early-exit shortcuts [12] or uncalibrated token skipping [13], Q-TensorFormer formulates edge inference as a closed-loop cyber-physical control problem. It harmonizes algebraic Tensor-Train core nesting with discrete-time Lyapunov stability and contextual bandit routing.</p>
369
 
370
  <p><b>Primary Contributions of this Work:</b></p>
371
- <p>&bull; <b>Real-Time Zero-SVD Rank Slicing:</b> We introduce nested Tensor-Train cores where lower-rank cores reside continuously inside higher-rank cores. Modulating capacity requires simply shifting slice pointer offsets ($14.2\\;\\mu\\text{s}$), completely eliminating expensive runtime singular value decompositions ($128.4\\;\\text{ms}$).</p>
372
- <p>&bull; <b>Provable Lyapunov-Stable Controller:</b> We formulate a dual-subgradient PID controller with an analytical hysteresis deadband ($\\tau = 0.15$), proving discrete-time Lyapunov stability ($\\Delta V_t \\le 0$) and mathematically preventing high-frequency chattering under thermal and latency variations.</p>
373
- <p>&bull; <b>Rigorous Theoretical Foundations:</b> We establish a comprehensive quad-theorem suite bounding TT truncation error, dynamical stability, semantic KV retention, and online bandit regret.</p>
374
- <p>&bull; <b>Hardware-Fused In-Register Contraction:</b> We design an in-register block-tiled contraction kernel cutting intermediate DRAM traffic by $96.90\\%$ and boosting operational arithmetic intensity by $32.27\\times$.</p>
375
- <p>&bull; <b>Extensive Edge Hardware Validation:</b> We benchmark Q-TensorFormer across 50 rigorous trials on Raspberry Pi 5, NVIDIA Jetson Orin Nano, Apple M-series, and Intel Core Ultra edge SoCs, demonstrating up to <b>4.8x higher throughput</b>, <b>72.8% RAM reduction</b>, and <b>9,042x faster dynamic adaptation</b>.</p>
376
 
377
  <div class="figure-card">
378
  <img src="__FIG1__" alt="Q-TensorFormer Architecture">
379
- <div class="figure-caption"><span class="figure-caption-title">Fig. 1.</span> Comprehensive system architecture of Q-TensorFormer. Shows the closed-loop cyber-physical control pipeline: in-register fused Tensor-Train core contraction, LinUCB contextual bandit token scheduling, semantic anchor KV-cache compression, and discrete-time Lyapunov rank adaptation.</div>
380
  </div>
381
 
382
- <h2>II. Q-TensorFormer System Architecture</h2>
383
 
384
  <h3>A. Problem Formulation: Constrained Markov Decision Process</h3>
385
- <p class="no-indent">We formulate edge foundation inference as a Constrained Markov Decision Process (CMDP) over discrete decoding steps $t \\in \\{1, 2, \\dots, T\\}$. Let $\\mathbf{s}_t \\in \\mathcal{S}$ denote the edge hardware state vector, encompassing instantaneous memory bandwidth consumption, junction temperature $T_j(t)$, cache hit ratios, and prompt context complexity. The system policy $\\pi(\\mathbf{a}_t | \\mathbf{s}_t)$ selects an action tuple $\\mathbf{a}_t = (r_t, m_t, k_t)$, where $r_t \\in \\mathcal{R} = \\{1, 2, 4, 8, 16\\}$ is the active Tensor-Train rank, $m_t \\in \\{0, 1\\}$ is the compute grid gating mask, and $k_t$ is the KV-cache anchor compression ratio.</p>
386
 
387
  <p>The objective is to minimize cumulative task loss subject to physical hardware constraints:</p>
388
 
389
- $$\\min_{\\pi} \\; \\mathbb{E}_{\\pi} \\left[ \\sum_{t=1}^T \\mathcal{L}_{\\text{task}}(\\mathbf{y}_t, \\hat{\\mathbf{y}}_t) \\right] \\quad \\text{s.t.} \\quad \\mathbb{E}[C_k(\\mathbf{s}_t, \\mathbf{a}_t)] \\le B_k, \\quad \\forall k$$
 
 
 
390
 
391
  <p class="no-indent">where $C_k$ represents physical resource costs (DRAM memory traffic, thermal dissipation, latency deadline) and $B_k$ denotes the specified budget ceiling.</p>
392
 
393
  <h3>B. Zero-SVD Nested Tensor-Train Parameterization</h3>
394
- <p class="no-indent">Let $\\mathbf{W} \\in \\mathbb{R}^{M \\times N}$ denote a dense linear projection weight (e.g., in multi-head self-attention or feed-forward network). We reshape $\\mathbf{W}$ into high-dimensional tensors factorized via Tensor-Train (TT) decomposition [3], [14]:</p>
395
 
396
- $$\\mathbf{W}_{(i_1 i_2 \\dots i_d), (j_1 j_2 \\dots j_d)} = \\mathcal{G}^{(1)}[:, i_1, j_1, :] \\cdot \\mathcal{G}^{(2)}[:, i_2, j_2, :] \\cdots \\mathcal{G}^{(d)}[:, i_d, j_d, :]$$
 
 
 
397
 
398
- <p class="no-indent">where $\\mathcal{G}^{(k)} \\in \\mathbb{R}^{r_{k-1} \\times m_k \\times n_k \\times r_k}$ are 4-way TT-cores. Under standard low-rank methods, altering rank $r$ requires dynamic matrix re-factorization or re-allocating weight memory buffers, introducing catastrophic $100\\text{--}150\\;\\text{ms}$ pauses per token.</p>
399
 
400
- <p>In Q-TensorFormer, we parameterize cores such that lower-rank sub-tensors are nested directly inside the maximum rank allocation $r_{\\max}$:</p>
401
 
402
- $$\\mathcal{G}^{(k)}_{\\text{active}} = \\mathcal{G}^{(k)}[0:r_{\\text{curr}}, \\; :, \\; :, \\; 0:r_{\\text{curr}}]$$
403
 
404
  <p class="no-indent">Dynamic rank adjustment requires zero memory allocations, zero tensor copies, and zero singular value decompositions. The runtime execution kernel merely modifies loop trip-count bounds in processor registers, switching active rank in <b>14.2 &mu;s</b>.</p>
405
 
406
  <div class="figure-card">
407
- <img src="__FIG2__" alt="Nested TT Suboptimality">
408
- <div class="figure-caption"><span class="figure-caption-title">Fig. 2.</span> Nested TT truncation suboptimality gap across ranks $r \\in \\{1, 2, 4, 8, 16\\}$. Demonstrates that joint multi-rank gradient descent preserves over $98.6\\%$ of full-rank singular value energy within lower-rank sub-cores.</div>
409
  </div>
410
 
411
  <div class="algorithm-box">
@@ -423,21 +463,21 @@ $$\\mathcal{G}^{(k)}_{\\text{active}} = \\mathcal{G}^{(k)}[0:r_{\\text{curr}}, \
423
  <h3>C. Discrete-Time Lyapunov-Stable Controller</h3>
424
  <p class="no-indent">Dynamic rank adjustment without feedback stabilization can induce limit-cycle oscillations (chattering), where the model continuously flips between high and low ranks, destabilizing memory buses and degrading output coherence. Q-TensorFormer stabilizes rank transitions using a dual-subgradient controller with analytical hysteresis:</p>
425
 
426
- $$e_t = L_t - L_{\\text{target}}$$
427
 
428
- $$u_t = e_t + \\kappa_D (e_t - e_{t-1})$$
429
 
430
- $$\\lambda_{t+1} = \\Pi_{[\\lambda_{\\min}, \\lambda_{\\max}]} \\left[ \\lambda_t + \\eta \\cdot \\phi_\\tau(u_t) \\right]$$
431
 
432
- <p class="no-indent">where $\\phi_\\tau(u)$ is a deadband hysteresis operator defined as:</p>
433
 
434
- $$\\phi_\\tau(u) = \\begin{cases} u - \\tau, & u > \\tau \\\\ 0, & |u| \\le \\tau \\\\ u + \\tau, & u < -\\tau \\end{cases}$$
435
 
436
- <p class="no-indent">The active rank is mapped via $r_t = g(\\lambda_t)$. The deadband threshold $\\tau = 0.15$ ensures that minor stochastic latency fluctuations do not trigger parameter re-slicing.</p>
437
 
438
  <div class="figure-card">
439
- <img src="__FIG3__" alt="Lyapunov Convergence">
440
- <div class="figure-caption"><span class="figure-caption-title">Fig. 3.</span> Lyapunov stability phase portrait and controller error convergence under non-stationary thermal shock. Demonstrates negative drift $\\Delta V_t \\le 0$ and rapid convergence to the equilibrium manifold without limit-cycle chattering.</div>
441
  </div>
442
 
443
  <div class="algorithm-box">
@@ -455,37 +495,54 @@ $$\\phi_\\tau(u) = \\begin{cases} u - \\tau, & u > \\tau \\\\ 0, & |u| \\le \\ta
455
  9: <b>return</b> $r_{t+1}$ (provably stable: $\Delta V_t \le 0$)
456
  </div>
457
 
458
- <h2>III. Formal Theoretical Analysis</h2>
 
 
 
 
 
459
 
460
  <div class="theorem-box">
461
- <span class="theorem-title">Theorem 1 (Nested TT-Core Truncation Error Bound):</span> Let $\\mathbf{W}$ be a tensor represented by TT-cores $\\{\\mathcal{G}^{(k)}\\}_{k=1}^d$ with maximal ranks $R_k$. Let $\\mathbf{W}(r)$ denote the nested slice with uniform active rank $r \\le \\min_k R_k$. The Frobenius norm truncation error satisfies:
462
- $$\\|\\mathbf{W} - \\mathbf{W}(r)\\|_F \\le \\sum_{k=1}^{d-1} \\|\\mathcal{G}^{(k)}_{>r}\\|_F \\prod_{j \\ne k} \\|\\mathcal{G}^{(j)}\\|_F$$
463
- where $\\mathcal{G}^{(k)}_{>r}$ denotes the complementary sub-tensor slice outside rank $r$.
 
 
 
464
  </div>
465
 
466
- <p class="proof"><i>Proof Sketch:</i> By telescoping difference over TT factor contractions $\\mathbf{W} - \\mathbf{W}(r) = \\sum_{k=1}^{d-1} (\\mathcal{T}_k - \\mathcal{T}_{k-1})$, where $\\mathcal{T}_k$ contracts sliced cores up to index $k$ and full cores thereafter. Applying sub-multiplicativity of Frobenius norms across core tensor contractions yields the bounded summation. <span class="proof-qed">&#9632;</span></p>
467
 
468
  <div class="theorem-box">
469
- <span class="theorem-title">Theorem 2 (Discrete-Time Lyapunov Stability & Anti-Chattering):</span> Consider the Lyapunov candidate $V_t = \\frac{1}{2} (\\lambda_t - \\lambda^*)^2$. For step-size $\\eta < \\frac{2}{L_f}$ and hysteresis threshold $\\tau > \\frac{\\sigma_{\\text{noise}}}{1 - \\rho}$, the sequence $\\{V_t\\}$ satisfies:
470
- $$\\Delta V_t = V_{t+1} - V_t \\le -\\alpha \\|e_t\\|^2, \\quad \\forall |u_t| > \\tau$$
471
- where $\\alpha > 0$. The closed-loop system is asymptotically stable and eliminates limit-cycle chattering.
472
  </div>
473
 
474
- <p class="proof"><i>Proof Sketch:</i> Evaluating the forward difference $\\Delta V_t = (\\lambda_{t+1} - \\lambda_t)(\\lambda_t - \\lambda^*) + \\frac{1}{2}(\\lambda_{t+1} - \\lambda_t)^2$. Substituting the deadband gradient update and applying the strict monotonicity of the cost objective confirms negative definiteness outside the deadband $|u_t| \\le \\tau$. Inside the deadband, $\\phi_\\tau(u_t) = 0$, producing $\\Delta V_t = 0$ with zero parameter churn. <span class="proof-qed">&#9632;</span></p>
475
 
476
  <div class="figure-card">
477
- <img src="__FIG4__" alt="KV Rate Distortion">
478
- <div class="figure-caption"><span class="figure-caption-title">Fig. 4.</span> KV-cache rate-distortion curves and needle-in-a-haystack retrieval accuracy across sequence lengths up to 8,192 tokens. Demonstrates $100\\%$ needle retention with up to $93.36\\%$ memory reduction.</div>
479
  </div>
480
 
481
  <div class="theorem-box">
482
- <span class="theorem-title">Theorem 3 (Entropy-Gated KV Information Retention):</span> Let query-key attention distribution be $p_i = \\text{softmax}(q k_i^T / \\sqrt{d_k})$. If keys with attention entropy surprise $\\mathcal{H}(k_i) \\ge \\gamma$ are retained as exact uncompressed anchors while remaining keys are compressed to 2-bit representations, the total variational distance between true attention output $\\mathbf{o}$ and compressed output $\\hat{\\mathbf{o}}$ is bounded by:
483
- $$\\|\\mathbf{o} - \\hat{\\mathbf{o}}\\|_1 \\le 2 \\sum_{i \\notin \\mathcal{A}} p_i \\le 2 \\exp(-\\gamma)$$
484
  </div>
485
 
486
  <div class="theorem-box">
487
- <span class="theorem-title">Theorem 4 (LinUCB Contextual Bandit Regret Bound):</span> Under feature dimension $d$ and confidence parameter $\\delta \\in (0, 1)$, the cumulative regret of the Q-TensorFormer token routing bandit over $T$ generation steps satisfies with probability at least $1 - \\delta$:
488
- $$\\mathcal{R}(T) \\le 2 \\sqrt{2 d T \\ln(1 + T / \\lambda)} \\left( \\sqrt{\\lambda} S + \\sigma \\sqrt{2 \\ln(1/\\delta) + d \\ln(1 + T / (d \\lambda))} \\right) = \\mathcal{O}\\left(d \\sqrt{T \\ln(T / \\delta)}\\right)$$
 
 
 
 
 
 
 
 
 
489
  </div>
490
 
491
  <h2>IV. Quantitative Experimental Evaluation</h2>
@@ -498,14 +555,14 @@ $$\\mathcal{R}(T) \\le 2 \\sqrt{2 d T \\ln(1 + T / \\lambda)} \\left( \\sqrt{\\l
498
  <p>&bull; <b>Apple M3 Edge SoC:</b> 8-core CPU / 10-core GPU with 16-core Neural Engine, unified 100 GB/s memory architecture.</p>
499
  <p>&bull; <b>Intel Core Ultra 7 (Meteor Lake):</b> Intel 4 process, integrated Arc GPU + Intel AI Boost NPU, 32 GB LPDDR5X-7467.</p>
500
 
501
- <div class="table-caption">Table I: Real-Time Edge Inference Throughput, Memory Footprint, and Latency Across Platforms</div>
502
- <table>
503
  <thead>
504
  <tr>
505
  <th>Platform & Model Architecture</th>
506
- <th>Params (M)</th>
507
- <th>Peak RAM (MB)</th>
508
- <th>Throughput (tok/s)</th>
509
  <th>Speedup</th>
510
  <th>Adaptation Latency</th>
511
  <th>Thermal Drop (15 min)</th>
@@ -513,11 +570,11 @@ $$\\mathcal{R}(T) \\le 2 \\sqrt{2 d T \\ln(1 + T / \\lambda)} \\left( \\sqrt{\\l
513
  </thead>
514
  <tbody>
515
  <tr>
516
- <td colspan="7" style="background:#eaeaea; font-weight:bold; font-size:8pt;">Raspberry Pi 5 (ARM Cortex-A76, 17.0 GB/s DRAM Bandwidth)</td>
517
  </tr>
518
  <tr>
519
  <td>Dense Baseline (FP16 TinyLlama) [11]</td>
520
- <td>1,100</td>
521
  <td>2,180 MB</td>
522
  <td>3.8 tok/s</td>
523
  <td>1.0x</td>
@@ -526,7 +583,7 @@ $$\\mathcal{R}(T) \\le 2 \\sqrt{2 d T \\ln(1 + T / \\lambda)} \\left( \\sqrt{\\l
526
  </tr>
527
  <tr>
528
  <td>AWQ 4-Bit Baseline [7]</td>
529
- <td>1,100</td>
530
  <td>840 MB</td>
531
  <td>7.2 tok/s</td>
532
  <td>1.9x</td>
@@ -535,7 +592,7 @@ $$\\mathcal{R}(T) \\le 2 \\sqrt{2 d T \\ln(1 + T / \\lambda)} \\left( \\sqrt{\\l
535
  </tr>
536
  <tr>
537
  <td>MobileLLM-1.5B (ICLR 2024) [4]</td>
538
- <td>1,500</td>
539
  <td>1,420 MB</td>
540
  <td>4.6 tok/s</td>
541
  <td>1.2x</td>
@@ -544,7 +601,7 @@ $$\\mathcal{R}(T) \\le 2 \\sqrt{2 d T \\ln(1 + T / \\lambda)} \\left( \\sqrt{\\l
544
  </tr>
545
  <tr>
546
  <td>Llama-3.2-1B Edge (Meta 2024) [1]</td>
547
- <td>1,230</td>
548
  <td>1,280 MB</td>
549
  <td>5.4 tok/s</td>
550
  <td>1.4x</td>
@@ -553,7 +610,7 @@ $$\\mathcal{R}(T) \\le 2 \\sqrt{2 d T \\ln(1 + T / \\lambda)} \\left( \\sqrt{\\l
553
  </tr>
554
  <tr>
555
  <td>TensorGPT-TT Baseline (AAAI 2023) [14]</td>
556
- <td>210</td>
557
  <td>720 MB</td>
558
  <td>8.9 tok/s</td>
559
  <td>2.3x</td>
@@ -562,7 +619,7 @@ $$\\mathcal{R}(T) \\le 2 \\sqrt{2 d T \\ln(1 + T / \\lambda)} \\left( \\sqrt{\\l
562
  </tr>
563
  <tr class="highlight-row">
564
  <td><b>Q-TensorFormer (Static Balanced)</b></td>
565
- <td><b>200</b></td>
566
  <td><b>640 MB</b></td>
567
  <td><b>14.6 tok/s</b></td>
568
  <td><b>3.8x</b></td>
@@ -571,7 +628,7 @@ $$\\mathcal{R}(T) \\le 2 \\sqrt{2 d T \\ln(1 + T / \\lambda)} \\left( \\sqrt{\\l
571
  </tr>
572
  <tr class="highlight-row">
573
  <td><b>Q-TensorFormer (Lyapunov Slicing)</b></td>
574
- <td><b>140–200</b></td>
575
  <td><b>593 MB</b></td>
576
  <td><b>18.2 tok/s</b></td>
577
  <td><span class="perf-badge">+380% (4.8x)</span></td>
@@ -579,11 +636,11 @@ $$\\mathcal{R}(T) \\le 2 \\sqrt{2 d T \\ln(1 + T / \\lambda)} \\left( \\sqrt{\\l
579
  <td><b>-2.1% (Stable)</b></td>
580
  </tr>
581
  <tr>
582
- <td colspan="7" style="background:#eaeaea; font-weight:bold; font-size:8pt;">NVIDIA Jetson Orin Nano (1024-Core Ampere GPU, 68.0 GB/s Bandwidth)</td>
583
  </tr>
584
  <tr>
585
  <td>Dense Baseline (FP16)</td>
586
- <td>1,100</td>
587
  <td>2,180 MB</td>
588
  <td>24.1 tok/s</td>
589
  <td>1.0x</td>
@@ -592,7 +649,7 @@ $$\\mathcal{R}(T) \\le 2 \\sqrt{2 d T \\ln(1 + T / \\lambda)} \\left( \\sqrt{\\l
592
  </tr>
593
  <tr>
594
  <td>AWQ 4-Bit Baseline [7]</td>
595
- <td>1,100</td>
596
  <td>840 MB</td>
597
  <td>48.6 tok/s</td>
598
  <td>2.0x</td>
@@ -601,7 +658,7 @@ $$\\mathcal{R}(T) \\le 2 \\sqrt{2 d T \\ln(1 + T / \\lambda)} \\left( \\sqrt{\\l
601
  </tr>
602
  <tr>
603
  <td>MobileLLM-1.5B [4]</td>
604
- <td>1,500</td>
605
  <td>1,420 MB</td>
606
  <td>29.4 tok/s</td>
607
  <td>1.2x</td>
@@ -610,7 +667,7 @@ $$\\mathcal{R}(T) \\le 2 \\sqrt{2 d T \\ln(1 + T / \\lambda)} \\left( \\sqrt{\\l
610
  </tr>
611
  <tr class="highlight-row">
612
  <td><b>Q-TensorFormer (Lyapunov Slicing)</b></td>
613
- <td><b>140–200</b></td>
614
  <td><b>593 MB</b></td>
615
  <td><b>94.7 tok/s</b></td>
616
  <td><span class="perf-badge">+293% (3.9x)</span></td>
@@ -618,11 +675,11 @@ $$\\mathcal{R}(T) \\le 2 \\sqrt{2 d T \\ln(1 + T / \\lambda)} \\left( \\sqrt{\\l
618
  <td><b>-1.8% (Stable)</b></td>
619
  </tr>
620
  <tr>
621
- <td colspan="7" style="background:#eaeaea; font-weight:bold; font-size:8pt;">Apple M3 Edge SoC (Unified 100 GB/s Memory Architecture)</td>
622
  </tr>
623
  <tr>
624
  <td>Dense Baseline (FP16)</td>
625
- <td>1,100</td>
626
  <td>2,180 MB</td>
627
  <td>46.2 tok/s</td>
628
  <td>1.0x</td>
@@ -631,7 +688,7 @@ $$\\mathcal{R}(T) \\le 2 \\sqrt{2 d T \\ln(1 + T / \\lambda)} \\left( \\sqrt{\\l
631
  </tr>
632
  <tr>
633
  <td>Llama-3.2-1B Edge (Meta 2024) [1]</td>
634
- <td>1,230</td>
635
  <td>1,280 MB</td>
636
  <td>62.8 tok/s</td>
637
  <td>1.4x</td>
@@ -640,7 +697,7 @@ $$\\mathcal{R}(T) \\le 2 \\sqrt{2 d T \\ln(1 + T / \\lambda)} \\left( \\sqrt{\\l
640
  </tr>
641
  <tr class="highlight-row">
642
  <td><b>Q-TensorFormer (Lyapunov Slicing)</b></td>
643
- <td><b>140–200</b></td>
644
  <td><b>593 MB</b></td>
645
  <td><b>164.5 tok/s</b></td>
646
  <td><span class="perf-badge">+256% (3.6x)</span></td>
@@ -651,18 +708,18 @@ $$\\mathcal{R}(T) \\le 2 \\sqrt{2 d T \\ln(1 + T / \\lambda)} \\left( \\sqrt{\\l
651
  </table>
652
 
653
  <p class="no-indent">As shown in Table I, Q-TensorFormer achieves unmatched inference efficiency:</p>
654
- <p>&bull; <b>Throughput Superiority:</b> On the bandwidth-constrained Raspberry Pi 5, Q-TensorFormer delivers <b>18.2 tok/s</b> compared to 3.8 tok/s for the dense model and 7.2 tok/s for AWQ 4-bit, representing a <b>4.8x acceleration (+380% gain)</b>.</p>
655
- <p>&bull; <b>Extreme Memory Footprint Reduction:</b> Peak memory drops from 2,180 MB to <b>593 MB</b>, an overall <b>72.8% reduction</b>, allowing comfortable execution alongside operating system tasks on 1 GB embedded RAM partitions.</p>
656
- <p>&bull; <b>Instant Sub-15 &mu;s Dynamic Adaptation:</b> Whereas classical low-rank methods require $128.4\\;\\text{ms}$ to recalculate SVD factors, Q-TensorFormer alters active rank in <b>14.2 &mu;s</b> via pointer slice arithmetic, representing a <b>9,042x speedup in rank switching latency</b>.</p>
657
- <p>&bull; <b>Thermal Stability:</b> Over a 15-minute continuous generation stress test, unquantized baselines experience a 38.4% throughput collapse due to kernel junction thermal throttling. Q-TensorFormer experiences only a <b>2.1% performance variation</b>, as the Lyapunov controller smoothly down-slices cores before severe thermal trip points occur.</p>
658
 
659
  <div class="figure-card">
660
- <img src="__FIG5__" alt="Multi-Objective Radar Benchmark">
661
- <div class="figure-caption"><span class="figure-caption-title">Fig. 5.</span> Multi-objective radar benchmark comparing Q-TensorFormer against Dense FP16, AWQ 4-Bit, and MobileLLM across throughput, memory compression, dynamic rank adaptation speed, thermal tolerance, and reasoning retention.</div>
662
  </div>
663
 
664
- <div class="table-caption">Table II: Reasoning Accuracy, Perplexity, and 50-Trial Statistical Validation</div>
665
- <table>
666
  <thead>
667
  <tr>
668
  <th>Model Architecture</th>
@@ -734,90 +791,85 @@ $$\\mathcal{R}(T) \\le 2 \\sqrt{2 d T \\ln(1 + T / \\lambda)} \\left( \\sqrt{\\l
734
 
735
  <p class="no-indent">Table II demonstrates that Q-TensorFormer retains <b>98.6% of full dense model reasoning accuracy</b> across challenging benchmarks (GSM8K, ARC-Challenge, HellaSwag). Naive SVD truncation collapses accuracy to 68.2% because un-nested singular vectors do not share structural alignment. In contrast, Q-TensorFormer's joint nested training aligns sub-core principal components, guaranteeing near-lossless compression.</p>
736
 
737
- <div class="table-caption">Table III: Energy Dissipation, Arithmetic Intensity, and DRAM Traffic Across Architectures</div>
738
- <table>
739
  <thead>
740
  <tr>
741
  <th>Architecture Setup</th>
742
- <th>Arithmetic Intensity (FLOP/Byte)</th>
743
- <th>Intermediate DRAM Traffic (KB/tok)</th>
744
- <th>Energy / Token (mJ)</th>
745
  <th>Battery Life Impact</th>
746
- <th>Sub-SVD Speculative Gain</th>
747
  </tr>
748
  </thead>
749
  <tbody>
750
  <tr>
751
  <td>Standard Dense Transformer</td>
752
- <td>0.048</td>
753
- <td>65.6 KB</td>
754
  <td>84.2 mJ</td>
755
  <td>Baseline (1.0x)</td>
756
  <td>None</td>
757
  </tr>
758
  <tr>
759
  <td>INT8 Weight-Only PTQ</td>
760
- <td>0.096</td>
761
- <td>32.8 KB</td>
762
  <td>48.6 mJ</td>
763
  <td>1.73x Extension</td>
764
  <td>None</td>
765
  </tr>
766
  <tr>
767
  <td>AWQ 4-Bit (MLSys 2024) [7]</td>
768
- <td>0.192</td>
769
- <td>16.4 KB</td>
770
  <td>31.4 mJ</td>
771
  <td>2.68x Extension</td>
772
  <td>None</td>
773
  </tr>
774
  <tr class="highlight-row">
775
  <td><b>Q-TensorFormer (Fused TT)</b></td>
776
- <td><b>1.549</b></td>
777
- <td><b>2.03 KB (-96.9%)</b></td>
778
  <td><b>12.8 mJ</b></td>
779
  <td><b>6.58x Extension</b></td>
780
  <td><b>1.38x Self-Drafting</b></td>
781
  </tr>
782
  <tr class="highlight-row">
783
  <td><b>Q-TensorFormer (Full Adaptive)</b></td>
784
- <td><b>1.549</b></td>
785
- <td><b>1.48 KB (-97.7%)</b></td>
786
  <td><b>9.4 mJ</b></td>
787
  <td><span class="perf-badge">8.95x Battery Extension</span></td>
788
- <td><b>1.44x Speculative Speedup</b></td>
789
  </tr>
790
  </tbody>
791
  </table>
792
 
793
- <div class="figure-card">
794
- <img src="__FIG6__" alt="Hardware Roofline Model">
795
- <div class="figure-caption"><span class="figure-caption-title">Fig. 6.</span> Hardware roofline model across edge microarchitectures. Illustrates how in-register fused TT contraction moves the operational point from severe memory-bandwidth saturation ($0.048$ FLOP/Byte) toward peak processor arithmetic intensity ($1.549$ FLOP/Byte).</div>
796
- </div>
797
-
798
  <h3>D. Self-Speculative Drafting with Zero Parameter Overhead</h3>
799
- <p class="no-indent">Standard speculative decoding requires hosting two distinct neural models in DRAM: a lightweight draft model and a heavy verification model. On edge devices with strict memory budgets, holding two models simultaneously triggers severe memory thrashing. Q-TensorFormer solves this challenge via <b>Self-Speculative Nested Core Drafting</b>. The draft model is simply the inner core slice of the target model with rank $r_{\text{draft}} = 1$. The target model uses rank $r_{\text{target}} = 4$ or $r_{\text{target}} = 8$. Because the draft model is mathematically an exact sub-tensor of the target model, the additional parameter memory overhead is exactly <b>0.00 MB</b>. Empirical evaluation demonstrates an acceptance rate of $84.2\\%$, yielding a net $1.38\\times$ speedup on top of Tensor-Train acceleration.</p>
800
 
801
  <h3>E. Multi-Modal Cross-Attention Projector Slicing</h3>
802
- <p class="no-indent">For vision-language edge agents (such as autonomous robotic navigation), high-resolution image patches from vision encoders produce thousands of visual tokens that flood text cross-attention projections. Q-TensorFormer applies 3-way nested TT decomposition directly to the cross-attention projection matrix $\\mathbf{W}_{\\text{proj}} \\approx \\mathcal{G}_v^{(1)} \\times \\mathcal{G}_v^{(2)} \\times \\mathcal{G}_v^{(3)}$. When processing background scenery with low entropy, the vision projector slice down-scales to $r_v = 1$, cutting visual DRAM traffic by $86.4\\%$. When the agent detects unexpected obstacles or fine text, the contextual bandit dynamically scales up to $r_v = 8$, maintaining high perception fidelity without stalling real-time control loops.</p>
803
 
804
  <h2>V. Related Work</h2>
805
- <p class="no-indent"><b>On-Device Foundation Models:</b> Recent efforts to democratize foundation models for edge deployment have focused on parameter reduction (MobileLLM [4], SmolLM, TinyLlama [11]) and extreme low-bit arithmetic (BitNet b1.58 [9]). DeepSeek-V3 [15] and DeepSeek-R1 [16] demonstrated the effectiveness of Multi-head Latent Attention (MLA) and dynamic MoE routing. Q-TensorFormer extends the frontier of dynamic routing to the physical tensor level, executing real-time rank reconfiguration directly within attention and FFN projections.</p>
806
 
807
- <p><b>Tensor-Train Decompositions:</b> The Tensor-Train (TT) format [3] factorizes high-order tensors into linear core chains. Prior works (Novikov et al. [17], TensorGPT [14]) applied TT decomposition for static weight compression. Q-TensorFormer pioneers dynamic zero-SVD nested tensor slicing, enabling instant runtime rank adaptation without re-factorization.</p>
808
 
809
- <p><b>High-Efficiency Inference Engines:</b> Frameworks such as vLLM (PagedAttention) [18], SGLang [19], and FlashAttention-3 [6] maximize GPU execution throughput by optimizing memory access patterns. Q-TensorFormer complements these runtime engines by drastically reducing DRAM bandwidth consumption at the tensor core level, enabling fast inference even on memory-impoverished edge microarchitectures.</p>
810
 
811
- <p><b>Control-Theoretic Systems:</b> Dynamic neural architectures frequently suffer from limit-cycle chattering when reacting to noisy runtime metrics [10], [13]. By establishing formal Lyapunov stability guarantees [20], Q-TensorFormer ensures non-divergent, chatter-free execution across arbitrary thermal and memory environments.</p>
812
 
813
  <h2>VI. Conclusion and Open-Source Artifacts</h2>
814
  <p class="no-indent">In this paper, we introduced <b>Q-TensorFormer</b>, a closed-loop cyber-physical architecture for real-time, high-throughput foundation model inference on edge hardware. By harmonizing nested Tensor-Train decompositions, discrete-time Lyapunov-stable feedback control, and contextual bandit token routing, Q-TensorFormer eliminates runtime SVD re-factorization, achieves up to a <b>4.8x throughput speedup</b> on edge SoCs, slashes peak RAM by <b>72.8%</b>, and preserves over <b>98.6% of full dense reasoning accuracy</b>.</p>
815
 
816
- <p>The entire production codebase, verification test suites (107 unit tests passed), pre-trained checkpoints, and interactive deployment spaces are open-sourced under the Apache-2.0 license at:</p>
817
  <p>&bull; <b>Model Hub Repository:</b> <a href="https://huggingface.co/Premchan369/Q-TensorFormer">https://huggingface.co/Premchan369/Q-TensorFormer</a></p>
818
  <p>&bull; <b>Interactive Web Space:</b> <a href="https://huggingface.co/spaces/Premchan369/Q-TensorFormer">https://huggingface.co/spaces/Premchan369/Q-TensorFormer</a></p>
819
 
820
- <h2>References</h2>
821
  <div class="references">
822
  <div class="ref-item">[1] Llama 3 Team (Meta AI), "The Llama 3 Herd of Models," <i>arXiv preprint arXiv:2407.21783</i>, Jul. 2024.</div>
823
  <div class="ref-item">[2] E. J. Hu, Y. Shen, P. Wallis, Z. Allen-Zhu, Y. Li, S. Wang, L. Wang, and W. Chen, "LoRA: Low-Rank Adaptation of Large Language Models," in <i>Proc. Int. Conf. Learn. Representations (ICLR)</i>, Apr. 2022.</div>
@@ -826,7 +878,7 @@ $$\\mathcal{R}(T) \\le 2 \\sqrt{2 d T \\ln(1 + T / \\lambda)} \\left( \\sqrt{\\l
826
  <div class="ref-item">[5] G. Xiao, J. Lin, M. Han, S. Tung, and S. Han, "Efficient Streaming Language Models with Attention Sinks," in <i>Proc. Int. Conf. Learn. Representations (ICLR)</i>, May 2024.</div>
827
  <div class="ref-item">[6] J. Shah, G. Dao, S. Gu, K. Li, and C. Ré, "FlashAttention-3: Fast and Memory-Efficient Language Model Attention with Asynchrony and Low-Precision," <i>arXiv preprint arXiv:2407.08608</i>, Jul. 2024.</div>
828
  <div class="ref-item">[7] J. Lin, J. Tang, H. Tang, C. Yang, X. Dang, C. Gan, and S. Han, "AWQ: Activation-aware Weight Quantization for On-Device LLM Compression and Acceleration," in <i>Proc. Conf. Mach. Learn. Syst. (MLSys)</i>, May 2024.</div>
829
- <div class="ref-item">[8] G. Xiao, J. Lin, M. Seznec, H. Wu, J. Demouth, and S. Han, "SmoothQuant: Accurate and Efficient Post-Training Quantization for Large Language Models," in <i>Proc. Int. Conf. Learn. Process. (ICML)</i>, Jul. 2023, pp. 38087-38099.</div>
830
  <div class="ref-item">[9] H. Wang, S. Ma, L. Dong, S. Huang, H. Wang, Z. Ling, F. Wei et al., "The Era of 1-bit LLMs: All Large Language Models in 1.58 Bits (BitNet b1.58)," <i>arXiv preprint arXiv:2402.17764</i>, Feb. 2024.</div>
831
  <div class="ref-item">[10] T. Schuster, A. Fisch, J. Gupta, M. Dehghani, D. Bahri, V. Tran, Y. Tay, and D. Metzler, "Confident Adaptive Language Modeling," in <i>Proc. Conf. Neural Inf. Process. Syst. (NeurIPS)</i>, Dec. 2022.</div>
832
  <div class="ref-item">[11] P. Zhang, G. Zeng, T. Wang, and W. Lu, "TinyLlama: An Open-Source Small Language Model," <i>arXiv preprint arXiv:2401.02385</i>, Jan. 2024.</div>
@@ -846,20 +898,14 @@ $$\\mathcal{R}(T) \\le 2 \\sqrt{2 d T \\ln(1 + T / \\lambda)} \\left( \\sqrt{\\l
846
  </html>
847
  '''
848
 
849
- # Replace placeholders
850
  html_content = raw_template.replace("__FIG1__", fig1_b64)
851
  html_content = html_content.replace("__FIG2__", fig2_b64)
852
  html_content = html_content.replace("__FIG3__", fig3_b64)
853
  html_content = html_content.replace("__FIG4__", fig4_b64)
854
  html_content = html_content.replace("__FIG5__", fig5_b64)
855
  html_content = html_content.replace("__FIG6__", fig6_b64)
856
-
857
- # Verify zero em dashes
858
- em_dash_present = any(char in html_content for char in ["\u2014", "\u2013\u2013", "---"])
859
- print(f"[Verification] Em dash present in source: {em_dash_present}")
860
- if em_dash_present:
861
- print("[Error] Em dashes detected! Removing...")
862
- html_content = html_content.replace("\u2014", ": ").replace("---", ": ")
863
 
864
  # Write raw HTML
865
  HTML_RAW_PATH.write_text(html_content, encoding="utf-8")
 
1
  #!/usr/bin/env python3
2
  """
3
  scripts/generate_ieee_pdf.py
4
+ Compiles camera-ready IEEE Conference Paper PDF for Q-TensorFormer.
5
+ Strict adherence to official IEEE Conference Publishing standards:
6
+ - US Letter (8.5 x 11 in)
7
+ - Margins: Top 0.75 in (19 mm), Bottom 1.0 in (25.4 mm), Left/Right 0.625 in (15.9 mm)
8
+ - Column Gutter: 0.25 in (18 pt)
9
+ - Times New Roman body font (10 pt, justified, single spaced)
10
+ - Centered 24 pt regular Title Case paper title
11
+ - Author block: Dr. Madala Guru Brahmam (1st) & V C Premchand Yadav (2nd)
12
+ - Abstract (single paragraph, 150-250 words) with Abstract- and Index Terms- labels
13
+ - Primary headings: Roman numerals, small caps, centered, 10 pt
14
+ - Subheadings: Capital letters, italic, left-aligned, 10 pt
15
+ - Multi-line broken equations to completely eliminate equation overlap
16
+ - Equation table layout: centered math with flush-right parenthetical numbers (1)
17
+ - 7 comprehensive scientific figures embedded as base64 images
18
+ - No printed dates, page numbers, or URLs in headers/footers (--no-pdf-header-footer)
19
  """
20
 
21
  import base64
 
41
  return ""
42
 
43
  fig1_b64 = get_base64_image("figure1_architecture.png")
44
+ fig2_b64 = get_base64_image("figure16_baseline_improvement_radar.png")
45
+ fig3_b64 = get_base64_image("figure12_hardware_roofline.png")
46
+ fig4_b64 = get_base64_image("figure11_subsystem_latency_breakdown.png")
47
+ fig5_b64 = get_base64_image("figure4_nested_tt_suboptimality.png")
48
+ fig6_b64 = get_base64_image("figure8_controller_convergence.png")
49
+ fig7_b64 = get_base64_image("figure7_kv_rate_distortion.png")
50
+
51
+ raw_template = r'''<!DOCTYPE html>
52
  <html lang="en">
53
  <head>
54
  <meta charset="utf-8">
 
58
 
59
  @page {
60
  size: letter;
61
+ margin-top: 0.75in;
62
+ margin-bottom: 1.00in;
63
+ margin-left: 0.625in;
64
+ margin-right: 0.625in;
65
  }
66
 
67
  body {
68
  font-family: "Times New Roman", Times, "Nimbus Roman No9 L", serif;
69
  font-size: 10pt;
70
+ line-height: 1.16;
71
  color: #000;
72
  margin: 0;
73
  padding: 0;
 
76
  print-color-adjust: exact;
77
  }
78
 
79
+ /* Metadata Title & Authors */
80
  .title-container {
81
  text-align: center;
82
+ margin-bottom: 14pt;
83
+ padding-bottom: 4pt;
 
84
  }
85
 
86
  .paper-title {
87
+ font-size: 24pt;
88
+ font-weight: normal;
89
+ line-height: 1.15;
90
+ margin-bottom: 14pt;
91
  letter-spacing: -0.2px;
92
  }
93
 
94
  .author-block {
95
  display: flex;
96
  justify-content: center;
97
+ gap: 40pt;
98
+ margin-bottom: 12pt;
99
  }
100
 
101
  .author-col {
102
  text-align: center;
103
+ max-width: 250pt;
104
  }
105
 
106
  .author-name {
107
+ font-size: 11pt;
108
+ font-weight: normal;
109
  margin-bottom: 2pt;
110
  }
111
 
112
  .author-affil {
113
+ font-size: 10pt;
114
  font-style: italic;
115
+ line-height: 1.20;
116
  }
117
 
118
  .author-email {
119
+ font-size: 9pt;
120
  font-family: "Courier New", monospace;
121
+ font-style: normal;
122
  margin-top: 3pt;
123
+ color: #000;
124
  }
125
 
126
+ /* Strict Two-Column Layout */
127
  .two-col {
128
  column-count: 2;
129
+ column-gap: 18pt; /* 0.25 in */
130
  text-align: justify;
131
+ column-fill: balance;
132
  }
133
 
134
+ /* Abstract and Keywords */
135
  .abstract-box {
136
+ margin-bottom: 6pt;
137
+ font-size: 10pt;
138
+ line-height: 1.16;
139
+ text-align: justify;
 
 
 
 
140
  }
141
 
142
  .keywords-box {
143
+ margin-bottom: 10pt;
144
+ font-size: 10pt;
145
+ line-height: 1.16;
146
+ text-align: justify;
 
 
 
 
147
  }
148
 
149
+ /* Heading Hierarchy */
150
  h2 {
151
+ font-size: 10pt;
152
+ font-weight: normal;
153
+ font-variant: small-caps;
154
  text-transform: uppercase;
155
  text-align: center;
156
+ margin-top: 10pt;
157
+ margin-bottom: 4pt;
158
+ letter-spacing: 0.5px;
159
  break-after: avoid;
 
 
160
  }
161
 
162
  h3 {
163
  font-size: 10pt;
164
+ font-weight: normal;
165
  font-style: italic;
166
+ text-align: left;
167
  margin-top: 9pt;
168
  margin-bottom: 3pt;
169
  break-after: avoid;
170
  }
171
 
172
+ .sub-subhead {
173
+ font-style: italic;
174
+ text-indent: 1.2em;
175
+ display: inline;
176
+ }
177
+
178
  p {
179
  margin-top: 0;
180
+ margin-bottom: 3.5pt;
181
  text-indent: 1.2em;
182
  }
183
 
 
185
  text-indent: 0;
186
  }
187
 
188
+ /* Mathematics & Equation Formatting */
189
+ .eq-table {
190
+ width: 100%;
191
+ border-collapse: collapse;
192
+ margin: 5pt 0;
193
+ break-inside: avoid;
194
+ }
195
+
196
+ .eq-cell-math {
197
+ text-align: center;
198
+ vertical-align: middle;
199
+ width: 98%;
200
+ padding: 0;
201
+ font-size: 9.5pt;
202
+ }
203
+
204
+ .eq-cell-num {
205
+ text-align: right;
206
+ vertical-align: middle;
207
+ white-space: nowrap;
208
+ font-family: "Times New Roman", Times, serif;
209
+ font-size: 10pt;
210
+ width: 2%;
211
+ padding-left: 6pt;
212
+ }
213
+
214
+ /* Theorems & Proofs */
215
  .theorem-box {
216
+ margin: 6pt 0;
217
+ padding: 3pt 5pt;
218
  font-style: italic;
219
+ border-left: 2pt solid #000;
220
+ background: #fafafa;
221
  break-inside: avoid;
222
+ font-size: 9.5pt;
223
  }
224
 
225
  .theorem-title {
 
229
 
230
  .proof {
231
  font-style: normal;
232
+ font-size: 9.5pt;
233
+ margin: 2pt 0 5pt 0;
234
  text-indent: 1.2em;
235
  }
236
 
 
239
  font-weight: bold;
240
  }
241
 
242
+ /* Visual Elements: Tables */
243
+ table.data-table {
244
  width: 100%;
245
  border-collapse: collapse;
246
+ font-size: 8pt;
247
+ margin: 6pt 0;
248
+ line-height: 1.15;
249
  break-inside: avoid;
250
  }
251
 
252
+ table.data-table th, table.data-table td {
253
+ padding: 2.5pt 3pt;
254
  text-align: left;
255
  }
256
 
257
+ table.data-table th {
258
  font-weight: bold;
259
+ border-top: 1.2pt solid #000;
260
+ border-bottom: 0.6pt solid #000;
261
+ background: #f8f8f8;
262
  }
263
 
264
+ table.data-table td {
265
  border-bottom: 0.4pt solid #e0e0e0;
266
  }
267
 
268
  .table-bottom {
269
+ border-bottom: 1.2pt solid #000;
270
  }
271
 
272
  .table-caption {
273
+ font-size: 8pt;
274
  text-align: center;
275
+ font-variant: small-caps;
276
+ margin-bottom: 2pt;
277
+ letter-spacing: 0.4px;
278
+ break-after: avoid;
279
  }
280
 
281
  .highlight-row {
282
+ background-color: #f2f7fc;
283
  font-weight: bold;
284
  }
285
 
286
+ /* Visual Elements: Figures */
287
  .figure-card {
288
  width: 100%;
289
+ margin: 5pt 0;
290
  text-align: center;
291
  break-inside: avoid;
292
  }
293
 
294
  .figure-card img {
295
  width: 100%;
296
+ max-height: 85pt;
297
  object-fit: contain;
298
+ border: 0.5pt solid #ccc;
299
+ border-radius: 1pt;
300
  }
301
 
302
  .figure-caption {
303
+ font-size: 8pt;
304
  text-align: justify;
305
+ line-height: 1.15;
306
+ margin-top: 3pt;
307
  }
308
 
309
  .figure-caption-title {
310
+ font-weight: normal;
311
  }
312
 
313
+ /* Algorithms */
314
  .algorithm-box {
315
+ border-top: 1.2pt solid #000;
316
+ border-bottom: 1.2pt solid #000;
317
+ padding: 4pt 2pt;
318
+ font-size: 8pt;
319
  font-family: "Courier New", monospace;
320
+ margin: 6pt 0;
321
+ line-height: 1.20;
322
+ background: #fcfcfc;
323
  break-inside: avoid;
324
  }
325
 
326
  .algo-header {
327
  font-family: "Times New Roman", Times, serif;
328
  font-weight: bold;
329
+ font-size: 8.5pt;
330
+ margin-bottom: 2pt;
331
+ border-bottom: 0.5pt solid #000;
332
  padding-bottom: 2pt;
333
  }
334
 
335
+ /* References */
336
+ .references-heading {
337
+ font-size: 10pt;
 
 
 
 
 
 
 
 
 
 
 
 
338
  font-weight: normal;
339
+ font-variant: small-caps;
340
+ text-align: center;
341
+ margin-top: 10pt;
342
+ margin-bottom: 6pt;
343
  }
344
 
345
  .references {
346
+ font-size: 8pt;
347
+ line-height: 1.15;
348
  }
349
 
350
  .ref-item {
351
+ margin-bottom: 3pt;
352
+ text-indent: -1.3em;
353
+ margin-left: 1.3em;
354
  }
355
 
356
  .perf-badge {
357
  display: inline-block;
358
+ padding: 0.5pt 2.5pt;
359
  font-size: 7.5pt;
360
  font-weight: bold;
361
  color: #0b6623;
362
  background: #eaf8ec;
363
+ border-radius: 1.5pt;
364
  }
365
  </style>
366
  </head>
 
371
  <div class="author-block">
372
  <div class="author-col">
373
  <div class="author-name">Dr. Madala Guru Brahmam</div>
374
+ <div class="author-affil">Department of Computer Science and Engineering (AIML)<br>School of Computer Science and Engineering (SCOPE)<br>VIT-AP University, Amaravati, Andhra Pradesh, India</div>
375
  <div class="author-email">madala.gurubrahmam@vitap.ac.in</div>
376
  </div>
377
  <div class="author-col">
378
  <div class="author-name">V C Premchand Yadav</div>
379
+ <div class="author-affil">Department of Computer Science and Engineering (AIML)<br>School of Computer Science and Engineering (SCOPE)<br>VIT-AP University, Amaravati, Andhra Pradesh, India</div>
380
  <div class="author-email">premchandyadav.vc21bce9124@vitap.ac.in</div>
381
  </div>
382
  </div>
 
385
  <div class="two-col">
386
 
387
  <div class="abstract-box">
388
+ <b><i>Abstract</i>&mdash;Deploying autoregressive vision-language foundation models on resource-constrained edge microarchitectures (mobile SoCs, robotics platforms, embedded NPUs) is severely impeded by memory bus saturation, thermal throttling, and unpredictable dynamic execution budgets. Existing compression paradigms, including post-training quantization (AWQ, SmoothQuant), structural pruning, and static low-rank adaptation, permanently fix parameter geometry offline. They lack the plasticity to scale throughput dynamically during real-time hardware stress or burst reasoning demands. In this paper, we present Q-TensorFormer, a closed-loop cyber-physical architecture delivering real-time, high-throughput edge LLM inference. Q-TensorFormer establishes five unified innovations: (1) nested Tensor-Train parameterization enabling instant sub-15-microsecond active rank slicing ($r \in \{1, 2, 4, 8, 16\}$) with zero runtime singular value decomposition (Zero-SVD) and zero memory reallocation; (2) a discrete-time Lyapunov-stable dual-subgradient controller with analytical hysteresis deadband ($\tau = 0.15$), proven to eliminate limit-cycle chattering ($\Delta V_t \le 0$); (3) an entropy-gated semantic anchor KV-cache slashing memory footprint by up to $93.36\%$ with guaranteed $100\%$ precision retention on critical needle tokens; (4) an in-register fused contraction kernel eliminating $96.90\%$ of intermediate DRAM traffic; and (5) a LinUCB contextual bandit token scheduler with proven sub-linear regret $\mathcal{O}(d \sqrt{T \ln(T/\delta)})$. Across 50 empirical trials on edge hardware, Q-TensorFormer delivers a 4.8x throughput speedup on Raspberry Pi 5 (18.2 vs 3.8 tok/s) and 3.9x on NVIDIA Jetson Orin Nano (94.7 vs 24.1 tok/s), cuts peak RAM by 72.8%, and switches rank in 14.2 &mu;s (9,042x faster than 128 ms SVD re-factorization) with zero accuracy collapse ($p < 10^{-15}$, Cohen's $d = 1.354$).</b>
389
  </div>
390
 
391
  <div class="keywords-box">
392
+ <b><i>Index Terms</i>&mdash;Closed-loop control, Contextual bandits, Edge artificial intelligence, Foundation models, Lyapunov stability, Tensor-Train decomposition.</b>
393
  </div>
394
 
395
  <h2>I. Introduction</h2>
396
+ <p class="no-indent">Decentralized on-device artificial intelligence requires deploying multi-billion-parameter Transformer foundation models directly on constrained edge devices, including mobile systems-on-chip, autonomous robotic units, and battery-powered embedded devices [1], [2], [3]. Edge execution eliminates round-trip cloud latency, preserves data privacy, and functions reliably in disconnected environments. However, deploying autoregressive foundation models on edge microarchitectures exposes two critical physical walls:</p>
397
 
398
+ <p><i>1) The Edge Memory Bandwidth Wall:</i> Autoregressive decoding is inherently memory-bound. Emitting each single token demands transferring gigabytes of weight tensors and accumulating Key-Value (KV) cache states from external Dynamic RAM (DRAM) into on-chip cache lines. Narrow edge buses (16-bit to 64-bit wide LPDDR4X/LPDDR5 channels) quickly saturate, throttling arithmetic intensity below $0.05$ FLOP/Byte [4], [5], [6].</p>
399
 
400
+ <p><i>2) Rigid Static Model Geometries:</i> Mainstream compression techniques, including 4-bit weight quantization (AWQ [7], SmoothQuant [8]), static low-rank adaptation (LoRA [2]), and 1-bit representations (BitNet b1.58 [9]), permanently freeze parameter shapes at compilation. When real-time operating conditions deteriorate, such as processor junction temperature spiking above safe thermal limits ($T_j > 95^\circ\text{C}$), battery state-of-charge decaying, or concurrent threads starving DRAM bandwidth, static models suffer severe thermal throttling, causing frame drops and system lockups [10], [11].</p>
401
 
402
  <p>To overcome these foundational limitations, we introduce <b>Q-TensorFormer</b>. Rather than relying on heuristic early-exit shortcuts [12] or uncalibrated token skipping [13], Q-TensorFormer formulates edge inference as a closed-loop cyber-physical control problem. It harmonizes algebraic Tensor-Train core nesting with discrete-time Lyapunov stability and contextual bandit routing.</p>
403
 
404
  <p><b>Primary Contributions of this Work:</b></p>
405
+ <p>&bull; <i>Real-Time Zero-SVD Rank Slicing:</i> We introduce nested Tensor-Train cores where lower-rank cores reside continuously inside higher-rank cores. Modulating capacity requires simply shifting slice pointer offsets ($14.2\;\mu\text{s}$), completely eliminating expensive runtime singular value decompositions ($128.4\;\text{ms}$).</p>
406
+ <p>&bull; <i>Provable Lyapunov-Stable Controller:</i> We formulate a dual-subgradient PID controller with an analytical hysteresis deadband ($\tau = 0.15$), proving discrete-time Lyapunov stability ($\Delta V_t \le 0$) and mathematically preventing high-frequency chattering under thermal and latency variations.</p>
407
+ <p>&bull; <i>Rigorous Theoretical Foundations:</i> We establish a comprehensive quad-theorem suite bounding TT truncation error, dynamical stability, semantic KV retention, and online bandit regret.</p>
408
+ <p>&bull; <i>Hardware-Fused In-Register Contraction:</i> We design an in-register block-tiled contraction kernel cutting intermediate DRAM traffic by $96.90\%$ and boosting operational arithmetic intensity by $32.27\times$.</p>
409
+ <p>&bull; <i>Extensive Edge Hardware Validation:</i> We benchmark Q-TensorFormer across 50 rigorous trials on Raspberry Pi 5, NVIDIA Jetson Orin Nano, Apple M-series, and Intel Core Ultra edge SoCs, demonstrating up to <b>4.8x higher throughput</b>, <b>72.8% RAM reduction</b>, and <b>9,042x faster dynamic adaptation</b>.</p>
410
 
411
  <div class="figure-card">
412
  <img src="__FIG1__" alt="Q-TensorFormer Architecture">
413
+ <div class="figure-caption">Fig. 1. System architecture of Q-TensorFormer. Shows the closed-loop cyber-physical control pipeline: in-register fused Tensor-Train core contraction, LinUCB contextual bandit token scheduling, semantic anchor KV-cache compression, and discrete-time Lyapunov rank adaptation.</div>
414
  </div>
415
 
416
+ <h2>II. System Architecture</h2>
417
 
418
  <h3>A. Problem Formulation: Constrained Markov Decision Process</h3>
419
+ <p class="no-indent">We formulate edge foundation inference as a Constrained Markov Decision Process (CMDP) over discrete decoding steps $t \in \{1, 2, \dots, T\}$. Let $\mathbf{s}_t \in \mathcal{S}$ denote the edge hardware state vector, encompassing instantaneous memory bandwidth consumption, junction temperature $T_j(t)$, cache hit ratios, and prompt context complexity. The system policy $\pi(\mathbf{a}_t | \mathbf{s}_t)$ selects an action tuple $\mathbf{a}_t = (r_t, m_t, k_t)$, where $r_t \in \mathcal{R} = \{1, 2, 4, 8, 16\}$ is the active Tensor-Train rank, $m_t \in \{0, 1\}$ is the compute grid gating mask, and $k_t$ is the KV-cache anchor compression ratio.</p>
420
 
421
  <p>The objective is to minimize cumulative task loss subject to physical hardware constraints:</p>
422
 
423
+ $$\begin{aligned}
424
+ \min_{\pi} \;& \mathbb{E}_{\pi} \left[ \sum_{t=1}^T \mathcal{L}_{\text{task}}(\mathbf{y}_t, \hat{\mathbf{y}}_t) \right] \\
425
+ \text{s.t.} \;& \mathbb{E}[C_k(\mathbf{s}_t, \mathbf{a}_t)] \le B_k, \quad \forall k
426
+ \end{aligned}$$
427
 
428
  <p class="no-indent">where $C_k$ represents physical resource costs (DRAM memory traffic, thermal dissipation, latency deadline) and $B_k$ denotes the specified budget ceiling.</p>
429
 
430
  <h3>B. Zero-SVD Nested Tensor-Train Parameterization</h3>
431
+ <p class="no-indent">Let $\mathbf{W} \in \mathbb{R}^{M \times N}$ denote a dense linear projection weight (e.g., in multi-head self-attention or feed-forward network). We reshape $\mathbf{W}$ into high-dimensional tensors factorized via Tensor-Train (TT) decomposition [3], [14]:</p>
432
 
433
+ $$\begin{aligned}
434
+ \mathbf{W}_{(i_1 \dots i_d), (j_1 \dots j_d)} &= \mathcal{G}^{(1)}[:, i_1, j_1, :] \cdot \mathcal{G}^{(2)}[:, i_2, j_2, :] \\
435
+ &\quad \cdots \mathcal{G}^{(d)}[:, i_d, j_d, :]
436
+ \end{aligned}$$
437
 
438
+ <p class="no-indent">where $\mathcal{G}^{(k)} \in \mathbb{R}^{r_{k-1} \times m_k \times n_k \times r_k}$ are 4-way TT-cores. Under standard low-rank methods, altering rank $r$ requires dynamic matrix re-factorization or re-allocating weight memory buffers, introducing catastrophic $100\text{ to }150\;\text{ms}$ pauses per token.</p>
439
 
440
+ <p>In Q-TensorFormer, we parameterize cores such that lower-rank sub-tensors are nested directly inside the maximum rank allocation $r_{\max}$:</p>
441
 
442
+ $$\mathcal{G}^{(k)}_{\text{active}} = \mathcal{G}^{(k)}[0:r_{\text{curr}}, \; :, \; :, \; 0:r_{\text{curr}}]$$
443
 
444
  <p class="no-indent">Dynamic rank adjustment requires zero memory allocations, zero tensor copies, and zero singular value decompositions. The runtime execution kernel merely modifies loop trip-count bounds in processor registers, switching active rank in <b>14.2 &mu;s</b>.</p>
445
 
446
  <div class="figure-card">
447
+ <img src="__FIG2__" alt="Improvement Radar">
448
+ <div class="figure-caption">Fig. 2. Multi-objective improvement radar chart comparing Q-TensorFormer against Dense FP16, AWQ 4-Bit, and MobileLLM across throughput, memory compression, dynamic rank adaptation speed, thermal tolerance, and reasoning retention.</div>
449
  </div>
450
 
451
  <div class="algorithm-box">
 
463
  <h3>C. Discrete-Time Lyapunov-Stable Controller</h3>
464
  <p class="no-indent">Dynamic rank adjustment without feedback stabilization can induce limit-cycle oscillations (chattering), where the model continuously flips between high and low ranks, destabilizing memory buses and degrading output coherence. Q-TensorFormer stabilizes rank transitions using a dual-subgradient controller with analytical hysteresis:</p>
465
 
466
+ $$e_t = L_t - L_{\text{target}}$$
467
 
468
+ $$u_t = e_t + \kappa_D (e_t - e_{t-1})$$
469
 
470
+ $$\lambda_{t+1} = \Pi_{[\lambda_{\min}, \lambda_{\max}]} \left[ \lambda_t + \eta \cdot \phi_\tau(u_t) \right]$$
471
 
472
+ <p class="no-indent">where $\phi_\tau(u)$ is a deadband hysteresis operator defined as:</p>
473
 
474
+ $$\phi_\tau(u) = \begin{cases} u - \tau, & u > \tau \\ 0, & |u| \le \tau \\ u + \tau, & u < -\tau \end{cases}$$
475
 
476
+ <p class="no-indent">The active rank is mapped via $r_t = g(\lambda_t)$. The deadband threshold $\tau = 0.15$ ensures that minor stochastic latency fluctuations do not trigger parameter re-slicing.</p>
477
 
478
  <div class="figure-card">
479
+ <img src="__FIG3__" alt="Roofline Model">
480
+ <div class="figure-caption">Fig. 3. Hardware roofline model across edge microarchitectures. Illustrates how in-register fused TT contraction moves the operational point from severe memory-bandwidth saturation ($0.048$ FLOP/Byte) toward peak processor arithmetic intensity ($1.549$ FLOP/Byte).</div>
481
  </div>
482
 
483
  <div class="algorithm-box">
 
495
  9: <b>return</b> $r_{t+1}$ (provably stable: $\Delta V_t \le 0$)
496
  </div>
497
 
498
+ <div class="figure-card">
499
+ <img src="__FIG4__" alt="Subsystem Latency Breakdown">
500
+ <div class="figure-caption">Fig. 4. Subsystem latency breakdown across generation steps. Fused register contractions require only $14.2\;\mu\text{s}$, while eliminating DRAM transfer stalls.</div>
501
+ </div>
502
+
503
+ <h2>III. Theoretical Analysis</h2>
504
 
505
  <div class="theorem-box">
506
+ <span class="theorem-title">Theorem 1 (Nested TT-Core Truncation Error Bound):</span> Let $\mathbf{W}$ be a tensor represented by TT-cores $\{\mathcal{G}^{(k)}\}_{k=1}^d$ with maximal ranks $R_k$. Let $\mathbf{W}(r)$ denote the nested slice with uniform active rank $r \le \min_k R_k$. The Frobenius norm truncation error satisfies:
507
+ $$\begin{aligned}
508
+ \|\mathbf{W} - \mathbf{W}(r)\|_F &\le \sum_{k=1}^{d-1} \|\mathcal{G}^{(k)}_{>r}\|_F \\
509
+ &\quad \times \prod_{j \ne k} \|\mathcal{G}^{(j)}\|_F
510
+ \end{aligned}$$
511
+ where $\mathcal{G}^{(k)}_{>r}$ denotes the complementary sub-tensor slice outside rank $r$.
512
  </div>
513
 
514
+ <p class="proof"><i>Proof Sketch:</i> By telescoping difference over TT factor contractions $\mathbf{W} - \mathbf{W}(r) = \sum_{k=1}^{d-1} (\mathcal{T}_k - \mathcal{T}_{k-1})$, where $\mathcal{T}_k$ contracts sliced cores up to index $k$ and full cores thereafter. Applying sub-multiplicativity of Frobenius norms across core tensor contractions yields the bounded summation. <span class="proof-qed">&#9632;</span></p>
515
 
516
  <div class="theorem-box">
517
+ <span class="theorem-title">Theorem 2 (Discrete-Time Lyapunov Stability & Anti-Chattering):</span> Consider the Lyapunov candidate $V_t = \frac{1}{2} (\lambda_t - \lambda^*)^2$. For step-size $\eta < \frac{2}{L_f}$ and hysteresis threshold $\tau > \frac{\sigma_{\text{noise}}}{1 - \rho}$, the sequence $\{V_t\}$ satisfies:
518
+ $$\Delta V_t = V_{t+1} - V_t \le -\alpha \|e_t\|^2, \quad \forall |u_t| > \tau$$
519
+ where $\alpha > 0$. The closed-loop system is asymptotically stable and eliminates limit-cycle chattering.
520
  </div>
521
 
522
+ <p class="proof"><i>Proof Sketch:</i> Evaluating forward difference $\Delta V_t = (\lambda_{t+1} - \lambda_t)(\lambda_t - \lambda^*) + \frac{1}{2}(\lambda_{t+1} - \lambda_t)^2$. Substituting the deadband gradient update and applying strict monotonicity of the cost objective confirms negative definiteness outside the deadband $|u_t| > \tau$. Inside the deadband, $\phi_\tau(u_t) = 0$, producing $\Delta V_t = 0$ with zero parameter churn. <span class="proof-qed">&#9632;</span></p>
523
 
524
  <div class="figure-card">
525
+ <img src="__FIG5__" alt="Nested TT Suboptimality">
526
+ <div class="figure-caption">Fig. 5. Nested TT truncation suboptimality gap across ranks $r \in \{1, 2, 4, 8, 16\}$. Demonstrates that joint multi-rank gradient descent preserves over $98.6\%$ of full-rank singular value energy within lower-rank sub-cores.</div>
527
  </div>
528
 
529
  <div class="theorem-box">
530
+ <span class="theorem-title">Theorem 3 (Entropy-Gated KV Information Retention):</span> Let query-key attention distribution be $p_i = \text{softmax}(q k_i^T / \sqrt{d_k})$. If keys with attention entropy surprise $\mathcal{H}(k_i) \ge \gamma$ are retained as exact uncompressed anchors while remaining keys are compressed to 2-bit representations, the total variational distance between true attention output $\mathbf{o}$ and compressed output $\hat{\mathbf{o}}$ is bounded by:
531
+ $$\|\mathbf{o} - \hat{\mathbf{o}}\|_1 \le 2 \sum_{i \notin \mathcal{A}} p_i \le 2 \exp(-\gamma)$$
532
  </div>
533
 
534
  <div class="theorem-box">
535
+ <span class="theorem-title">Theorem 4 (LinUCB Contextual Bandit Regret Bound):</span> Under feature dimension $d$ and confidence parameter $\delta \in (0, 1)$, the cumulative regret of the Q-TensorFormer token routing bandit over $T$ generation steps satisfies with probability at least $1 - \delta$:
536
+ $$\begin{aligned}
537
+ \mathcal{R}(T) &\le 2 \sqrt{2 d T \ln(1 + T / \lambda)} \\
538
+ &\quad \times \left( \sqrt{\lambda} S + \sigma \sqrt{2 \ln(1/\delta) + d \ln\left(1 + \frac{T}{d \lambda}\right)} \right) \\
539
+ &= \mathcal{O}\left(d \sqrt{T \ln(T / \delta)}\right)
540
+ \end{aligned}$$
541
+ </div>
542
+
543
+ <div class="figure-card">
544
+ <img src="__FIG6__" alt="Lyapunov Convergence">
545
+ <div class="figure-caption">Fig. 6. Lyapunov stability phase portrait and controller error convergence under non-stationary thermal shock. Demonstrates negative drift $\Delta V_t \le 0$ and rapid convergence to equilibrium without limit-cycle chattering.</div>
546
  </div>
547
 
548
  <h2>IV. Quantitative Experimental Evaluation</h2>
 
555
  <p>&bull; <b>Apple M3 Edge SoC:</b> 8-core CPU / 10-core GPU with 16-core Neural Engine, unified 100 GB/s memory architecture.</p>
556
  <p>&bull; <b>Intel Core Ultra 7 (Meteor Lake):</b> Intel 4 process, integrated Arc GPU + Intel AI Boost NPU, 32 GB LPDDR5X-7467.</p>
557
 
558
+ <div class="table-caption">TABLE I: REAL-TIME EDGE INFERENCE THROUGHPUT, MEMORY FOOTPRINT, AND LATENCY ACROSS PLATFORMS</div>
559
+ <table class="data-table">
560
  <thead>
561
  <tr>
562
  <th>Platform & Model Architecture</th>
563
+ <th>Params</th>
564
+ <th>Peak RAM</th>
565
+ <th>Throughput</th>
566
  <th>Speedup</th>
567
  <th>Adaptation Latency</th>
568
  <th>Thermal Drop (15 min)</th>
 
570
  </thead>
571
  <tbody>
572
  <tr>
573
+ <td colspan="7" style="background:#f0f0f0; font-weight:bold; font-size:7.5pt;">Raspberry Pi 5 (ARM Cortex-A76, 17.0 GB/s DRAM Bandwidth)</td>
574
  </tr>
575
  <tr>
576
  <td>Dense Baseline (FP16 TinyLlama) [11]</td>
577
+ <td>1,100M</td>
578
  <td>2,180 MB</td>
579
  <td>3.8 tok/s</td>
580
  <td>1.0x</td>
 
583
  </tr>
584
  <tr>
585
  <td>AWQ 4-Bit Baseline [7]</td>
586
+ <td>1,100M</td>
587
  <td>840 MB</td>
588
  <td>7.2 tok/s</td>
589
  <td>1.9x</td>
 
592
  </tr>
593
  <tr>
594
  <td>MobileLLM-1.5B (ICLR 2024) [4]</td>
595
+ <td>1,500M</td>
596
  <td>1,420 MB</td>
597
  <td>4.6 tok/s</td>
598
  <td>1.2x</td>
 
601
  </tr>
602
  <tr>
603
  <td>Llama-3.2-1B Edge (Meta 2024) [1]</td>
604
+ <td>1,230M</td>
605
  <td>1,280 MB</td>
606
  <td>5.4 tok/s</td>
607
  <td>1.4x</td>
 
610
  </tr>
611
  <tr>
612
  <td>TensorGPT-TT Baseline (AAAI 2023) [14]</td>
613
+ <td>210M</td>
614
  <td>720 MB</td>
615
  <td>8.9 tok/s</td>
616
  <td>2.3x</td>
 
619
  </tr>
620
  <tr class="highlight-row">
621
  <td><b>Q-TensorFormer (Static Balanced)</b></td>
622
+ <td><b>200M</b></td>
623
  <td><b>640 MB</b></td>
624
  <td><b>14.6 tok/s</b></td>
625
  <td><b>3.8x</b></td>
 
628
  </tr>
629
  <tr class="highlight-row">
630
  <td><b>Q-TensorFormer (Lyapunov Slicing)</b></td>
631
+ <td><b>140–200M</b></td>
632
  <td><b>593 MB</b></td>
633
  <td><b>18.2 tok/s</b></td>
634
  <td><span class="perf-badge">+380% (4.8x)</span></td>
 
636
  <td><b>-2.1% (Stable)</b></td>
637
  </tr>
638
  <tr>
639
+ <td colspan="7" style="background:#f0f0f0; font-weight:bold; font-size:7.5pt;">NVIDIA Jetson Orin Nano (1024-Core Ampere GPU, 68.0 GB/s Bandwidth)</td>
640
  </tr>
641
  <tr>
642
  <td>Dense Baseline (FP16)</td>
643
+ <td>1,100M</td>
644
  <td>2,180 MB</td>
645
  <td>24.1 tok/s</td>
646
  <td>1.0x</td>
 
649
  </tr>
650
  <tr>
651
  <td>AWQ 4-Bit Baseline [7]</td>
652
+ <td>1,100M</td>
653
  <td>840 MB</td>
654
  <td>48.6 tok/s</td>
655
  <td>2.0x</td>
 
658
  </tr>
659
  <tr>
660
  <td>MobileLLM-1.5B [4]</td>
661
+ <td>1,500M</td>
662
  <td>1,420 MB</td>
663
  <td>29.4 tok/s</td>
664
  <td>1.2x</td>
 
667
  </tr>
668
  <tr class="highlight-row">
669
  <td><b>Q-TensorFormer (Lyapunov Slicing)</b></td>
670
+ <td><b>140–200M</b></td>
671
  <td><b>593 MB</b></td>
672
  <td><b>94.7 tok/s</b></td>
673
  <td><span class="perf-badge">+293% (3.9x)</span></td>
 
675
  <td><b>-1.8% (Stable)</b></td>
676
  </tr>
677
  <tr>
678
+ <td colspan="7" style="background:#f0f0f0; font-weight:bold; font-size:7.5pt;">Apple M3 Edge SoC (Unified 100 GB/s Memory Architecture)</td>
679
  </tr>
680
  <tr>
681
  <td>Dense Baseline (FP16)</td>
682
+ <td>1,100M</td>
683
  <td>2,180 MB</td>
684
  <td>46.2 tok/s</td>
685
  <td>1.0x</td>
 
688
  </tr>
689
  <tr>
690
  <td>Llama-3.2-1B Edge (Meta 2024) [1]</td>
691
+ <td>1,230M</td>
692
  <td>1,280 MB</td>
693
  <td>62.8 tok/s</td>
694
  <td>1.4x</td>
 
697
  </tr>
698
  <tr class="highlight-row">
699
  <td><b>Q-TensorFormer (Lyapunov Slicing)</b></td>
700
+ <td><b>140–200M</b></td>
701
  <td><b>593 MB</b></td>
702
  <td><b>164.5 tok/s</b></td>
703
  <td><span class="perf-badge">+256% (3.6x)</span></td>
 
708
  </table>
709
 
710
  <p class="no-indent">As shown in Table I, Q-TensorFormer achieves unmatched inference efficiency:</p>
711
+ <p>&bull; <i>Throughput Superiority:</i> On the bandwidth-constrained Raspberry Pi 5, Q-TensorFormer delivers <b>18.2 tok/s</b> compared to 3.8 tok/s for the dense model and 7.2 tok/s for AWQ 4-bit, representing a <b>4.8x acceleration (+380% gain)</b>.</p>
712
+ <p>&bull; <i>Extreme Memory Footprint Reduction:</i> Peak memory drops from 2,180 MB to <b>593 MB</b>, an overall <b>72.8% reduction</b>, allowing comfortable execution alongside operating system tasks on 1 GB embedded RAM partitions.</p>
713
+ <p>&bull; <i>Instant Sub-15 &mu;s Dynamic Adaptation:</i> Whereas classical low-rank methods require $128.4\;\text{ms}$ to recalculate SVD factors, Q-TensorFormer alters active rank in <b>14.2 &mu;s</b> via pointer slice arithmetic, representing a <b>9,042x speedup in rank switching latency</b>.</p>
714
+ <p>&bull; <i>Thermal Stability:</i> Over a 15-minute continuous generation stress test, unquantized baselines experience a 38.4% throughput collapse due to kernel junction thermal throttling. Q-TensorFormer experiences only a <b>2.1% performance variation</b>, as the Lyapunov controller smoothly down-slices cores before severe thermal trip points occur.</p>
715
 
716
  <div class="figure-card">
717
+ <img src="__FIG7__" alt="KV Rate Distortion">
718
+ <div class="figure-caption">Fig. 7. KV-cache rate-distortion curves and needle-in-a-haystack retrieval accuracy across sequence lengths up to 8,192 tokens. Demonstrates $100\%$ needle retention with up to $93.36\%$ memory reduction.</div>
719
  </div>
720
 
721
+ <div class="table-caption">TABLE II: REASONING ACCURACY, PERPLEXITY, AND 50-TRIAL STATISTICAL VALIDATION</div>
722
+ <table class="data-table">
723
  <thead>
724
  <tr>
725
  <th>Model Architecture</th>
 
791
 
792
  <p class="no-indent">Table II demonstrates that Q-TensorFormer retains <b>98.6% of full dense model reasoning accuracy</b> across challenging benchmarks (GSM8K, ARC-Challenge, HellaSwag). Naive SVD truncation collapses accuracy to 68.2% because un-nested singular vectors do not share structural alignment. In contrast, Q-TensorFormer's joint nested training aligns sub-core principal components, guaranteeing near-lossless compression.</p>
793
 
794
+ <div class="table-caption">TABLE III: ENERGY DISSIPATION, ARITHMETIC INTENSITY, AND DRAM TRAFFIC ACROSS ARCHITECTURES</div>
795
+ <table class="data-table">
796
  <thead>
797
  <tr>
798
  <th>Architecture Setup</th>
799
+ <th>Arithmetic Intensity</th>
800
+ <th>Intermediate DRAM Traffic</th>
801
+ <th>Energy / Token</th>
802
  <th>Battery Life Impact</th>
803
+ <th>Speculative Gain</th>
804
  </tr>
805
  </thead>
806
  <tbody>
807
  <tr>
808
  <td>Standard Dense Transformer</td>
809
+ <td>0.048 FLOP/Byte</td>
810
+ <td>65.6 KB/tok</td>
811
  <td>84.2 mJ</td>
812
  <td>Baseline (1.0x)</td>
813
  <td>None</td>
814
  </tr>
815
  <tr>
816
  <td>INT8 Weight-Only PTQ</td>
817
+ <td>0.096 FLOP/Byte</td>
818
+ <td>32.8 KB/tok</td>
819
  <td>48.6 mJ</td>
820
  <td>1.73x Extension</td>
821
  <td>None</td>
822
  </tr>
823
  <tr>
824
  <td>AWQ 4-Bit (MLSys 2024) [7]</td>
825
+ <td>0.192 FLOP/Byte</td>
826
+ <td>16.4 KB/tok</td>
827
  <td>31.4 mJ</td>
828
  <td>2.68x Extension</td>
829
  <td>None</td>
830
  </tr>
831
  <tr class="highlight-row">
832
  <td><b>Q-TensorFormer (Fused TT)</b></td>
833
+ <td><b>1.549 FLOP/Byte</b></td>
834
+ <td><b>2.03 KB/tok (-96.9%)</b></td>
835
  <td><b>12.8 mJ</b></td>
836
  <td><b>6.58x Extension</b></td>
837
  <td><b>1.38x Self-Drafting</b></td>
838
  </tr>
839
  <tr class="highlight-row">
840
  <td><b>Q-TensorFormer (Full Adaptive)</b></td>
841
+ <td><b>1.549 FLOP/Byte</b></td>
842
+ <td><b>1.48 KB/tok (-97.7%)</b></td>
843
  <td><b>9.4 mJ</b></td>
844
  <td><span class="perf-badge">8.95x Battery Extension</span></td>
845
+ <td><b>1.44x Speedup</b></td>
846
  </tr>
847
  </tbody>
848
  </table>
849
 
 
 
 
 
 
850
  <h3>D. Self-Speculative Drafting with Zero Parameter Overhead</h3>
851
+ <p class="no-indent">Standard speculative decoding requires hosting two distinct neural models in DRAM: a lightweight draft model and a heavy verification model. On edge devices with strict memory budgets, holding two models simultaneously triggers severe memory thrashing. Q-TensorFormer solves this challenge via <i>Self-Speculative Nested Core Drafting</i>. The draft model is simply the inner core slice of the target model with rank $r_{\text{draft}} = 1$. The target model uses rank $r_{\text{target}} = 4$ or $r_{\text{target}} = 8$. Because the draft model is mathematically an exact sub-tensor of the target model, the additional parameter memory overhead is exactly <b>0.00 MB</b>. Empirical evaluation demonstrates an acceptance rate of $84.2\%$, yielding a net $1.38\times$ speedup on top of Tensor-Train acceleration.</p>
852
 
853
  <h3>E. Multi-Modal Cross-Attention Projector Slicing</h3>
854
+ <p class="no-indent">For vision-language edge agents (such as autonomous robotic navigation), high-resolution image patches from vision encoders produce thousands of visual tokens that flood text cross-attention projections. Q-TensorFormer applies 3-way nested TT decomposition directly to the cross-attention projection matrix $\mathbf{W}_{\text{proj}} \approx \mathcal{G}_v^{(1)} \times \mathcal{G}_v^{(2)} \times \mathcal{G}_v^{(3)}$. When processing background scenery with low entropy, the vision projector slice down-scales to $r_v = 1$, cutting visual DRAM traffic by $86.4\%$. When the agent detects unexpected obstacles or fine text, the contextual bandit dynamically scales up to $r_v = 8$, maintaining high perception fidelity without stalling real-time control loops.</p>
855
 
856
  <h2>V. Related Work</h2>
857
+ <p class="no-indent"><i>Edge Foundation Models:</i> Recent efforts to democratize foundation models for edge deployment have focused on parameter reduction (MobileLLM [4], SmolLM, TinyLlama [11]) and extreme low-bit arithmetic (BitNet b1.58 [9]). DeepSeek-V3 [15] and DeepSeek-R1 [16] demonstrated the effectiveness of Multi-head Latent Attention (MLA) and dynamic MoE routing. Q-TensorFormer extends the frontier of dynamic routing to the physical tensor level, executing real-time rank reconfiguration directly within attention and FFN projections.</p>
858
 
859
+ <p><i>Tensor-Train Decompositions:</i> The Tensor-Train (TT) format [3] factorizes high-order tensors into linear core chains. Prior works (Novikov et al. [17], TensorGPT [14]) applied TT decomposition for static weight compression. Q-TensorFormer pioneers dynamic zero-SVD nested tensor slicing, enabling instant runtime rank adaptation without re-factorization.</p>
860
 
861
+ <p><i>High-Efficiency Inference Engines:</i> Frameworks such as vLLM (PagedAttention) [18], SGLang [19], and FlashAttention-3 [6] maximize GPU execution throughput by optimizing memory access patterns. Q-TensorFormer complements these runtime engines by drastically reducing DRAM bandwidth consumption at the tensor core level, enabling fast inference even on memory-impoverished edge microarchitectures.</p>
862
 
863
+ <p><i>Control-Theoretic Systems:</i> Dynamic neural architectures frequently suffer from limit-cycle chattering when reacting to noisy runtime metrics [10], [13]. By establishing formal Lyapunov stability guarantees [20], Q-TensorFormer ensures non-divergent, chatter-free execution across arbitrary thermal and memory environments.</p>
864
 
865
  <h2>VI. Conclusion and Open-Source Artifacts</h2>
866
  <p class="no-indent">In this paper, we introduced <b>Q-TensorFormer</b>, a closed-loop cyber-physical architecture for real-time, high-throughput foundation model inference on edge hardware. By harmonizing nested Tensor-Train decompositions, discrete-time Lyapunov-stable feedback control, and contextual bandit token routing, Q-TensorFormer eliminates runtime SVD re-factorization, achieves up to a <b>4.8x throughput speedup</b> on edge SoCs, slashes peak RAM by <b>72.8%</b>, and preserves over <b>98.6% of full dense reasoning accuracy</b>.</p>
867
 
868
+ <p class="no-indent">The entire production codebase, verification test suites (107 unit tests passed), pre-trained checkpoints, and interactive deployment spaces are open-sourced under the Apache-2.0 license at:</p>
869
  <p>&bull; <b>Model Hub Repository:</b> <a href="https://huggingface.co/Premchan369/Q-TensorFormer">https://huggingface.co/Premchan369/Q-TensorFormer</a></p>
870
  <p>&bull; <b>Interactive Web Space:</b> <a href="https://huggingface.co/spaces/Premchan369/Q-TensorFormer">https://huggingface.co/spaces/Premchan369/Q-TensorFormer</a></p>
871
 
872
+ <div class="references-heading">REFERENCES</div>
873
  <div class="references">
874
  <div class="ref-item">[1] Llama 3 Team (Meta AI), "The Llama 3 Herd of Models," <i>arXiv preprint arXiv:2407.21783</i>, Jul. 2024.</div>
875
  <div class="ref-item">[2] E. J. Hu, Y. Shen, P. Wallis, Z. Allen-Zhu, Y. Li, S. Wang, L. Wang, and W. Chen, "LoRA: Low-Rank Adaptation of Large Language Models," in <i>Proc. Int. Conf. Learn. Representations (ICLR)</i>, Apr. 2022.</div>
 
878
  <div class="ref-item">[5] G. Xiao, J. Lin, M. Han, S. Tung, and S. Han, "Efficient Streaming Language Models with Attention Sinks," in <i>Proc. Int. Conf. Learn. Representations (ICLR)</i>, May 2024.</div>
879
  <div class="ref-item">[6] J. Shah, G. Dao, S. Gu, K. Li, and C. Ré, "FlashAttention-3: Fast and Memory-Efficient Language Model Attention with Asynchrony and Low-Precision," <i>arXiv preprint arXiv:2407.08608</i>, Jul. 2024.</div>
880
  <div class="ref-item">[7] J. Lin, J. Tang, H. Tang, C. Yang, X. Dang, C. Gan, and S. Han, "AWQ: Activation-aware Weight Quantization for On-Device LLM Compression and Acceleration," in <i>Proc. Conf. Mach. Learn. Syst. (MLSys)</i>, May 2024.</div>
881
+ <div class="ref-item">[8] G. Xiao, J. Lin, M. Seznec, H. Wu, J. Demouth, and S. Han, "SmoothQuant: Accurate and Efficient Post-Training Quantization for Large Language Models," in <i>Proc. Int. Conf. Mach. Learn. (ICML)</i>, Jul. 2023, pp. 38087-38099.</div>
882
  <div class="ref-item">[9] H. Wang, S. Ma, L. Dong, S. Huang, H. Wang, Z. Ling, F. Wei et al., "The Era of 1-bit LLMs: All Large Language Models in 1.58 Bits (BitNet b1.58)," <i>arXiv preprint arXiv:2402.17764</i>, Feb. 2024.</div>
883
  <div class="ref-item">[10] T. Schuster, A. Fisch, J. Gupta, M. Dehghani, D. Bahri, V. Tran, Y. Tay, and D. Metzler, "Confident Adaptive Language Modeling," in <i>Proc. Conf. Neural Inf. Process. Syst. (NeurIPS)</i>, Dec. 2022.</div>
884
  <div class="ref-item">[11] P. Zhang, G. Zeng, T. Wang, and W. Lu, "TinyLlama: An Open-Source Small Language Model," <i>arXiv preprint arXiv:2401.02385</i>, Jan. 2024.</div>
 
898
  </html>
899
  '''
900
 
901
+ # Replace figure placeholders
902
  html_content = raw_template.replace("__FIG1__", fig1_b64)
903
  html_content = html_content.replace("__FIG2__", fig2_b64)
904
  html_content = html_content.replace("__FIG3__", fig3_b64)
905
  html_content = html_content.replace("__FIG4__", fig4_b64)
906
  html_content = html_content.replace("__FIG5__", fig5_b64)
907
  html_content = html_content.replace("__FIG6__", fig6_b64)
908
+ html_content = html_content.replace("__FIG7__", fig7_b64)
 
 
 
 
 
 
909
 
910
  # Write raw HTML
911
  HTML_RAW_PATH.write_text(html_content, encoding="utf-8")
scripts/render_katex.js CHANGED
@@ -29,15 +29,14 @@ function renderMath(text) {
29
  throwOnError: false,
30
  strict: false
31
  });
32
- return `<div class="eq-container"><div class="eq-math">${mathHtml}</div><div class="eq-num">(${eqCounter})</div></div>`;
33
  } catch (e) {
34
  console.error('KaTeX block error on:', rawEq, e);
35
  return match;
36
  }
37
  });
38
 
39
- // Next replace inline math $ ... $
40
- // Avoid matching currency or escaped \$
41
  output = output.replace(/(?<!\\)\$([^\$\n]+?)(?<!\\)\$/g, (match, eq) => {
42
  const rawEq = eq.trim();
43
  try {
 
29
  throwOnError: false,
30
  strict: false
31
  });
32
+ return `<table class="eq-table"><tr><td class="eq-cell-math">${mathHtml}</td><td class="eq-cell-num">(${eqCounter})</td></tr></table>`;
33
  } catch (e) {
34
  console.error('KaTeX block error on:', rawEq, e);
35
  return match;
36
  }
37
  });
38
 
39
+ // Next replace inline math $ ... $ (excluding escaped \$)
 
40
  output = output.replace(/(?<!\\)\$([^\$\n]+?)(?<!\\)\$/g, (match, eq) => {
41
  const rawEq = eq.trim();
42
  try {