Text Generation
Transformers
Safetensors
PyTorch
ONNX
English
qtensorformer
qtf
q-tensorformer
qtensor
high-throughput-inference
tensor-train
tensor-networks
tensorrt-llm
vllm
continuous-batching
paged-attention
speculative-decoding
zero-svd
adaptive-computation
dynamic-neural-networks
kv-cache
kv-cache-quantization
attention-sinks
lyapunov-stability
control-theory
contextual-bandits
edge-ai
edge-inference
on-device-ai
model-compression
hopper-h100
blackwell-b200
jetson-orin
jetson-thor
grouped-query-attention
rotary-position-embeddings
custom_code
academic-paper
ieee
neurips
vit-ap-university
deepseek
deepseek-r1
reasoning
chain-of-thought
gsm8k
openai-compatible
fastapi
rest-api
sse-streaming
onnx-runtime
embedded-ai
hardware-telemetry
power-efficiency
green-ai
raspberry-pi
smollm2
qwen2.5
llama-3.2
apple-silicon
Instructions to use Premchan369/Q-TensorFormer with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Premchan369/Q-TensorFormer with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Premchan369/Q-TensorFormer", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("Premchan369/Q-TensorFormer", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Premchan369/Q-TensorFormer with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Premchan369/Q-TensorFormer" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Premchan369/Q-TensorFormer", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/Premchan369/Q-TensorFormer
- SGLang
How to use Premchan369/Q-TensorFormer with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "Premchan369/Q-TensorFormer" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Premchan369/Q-TensorFormer", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "Premchan369/Q-TensorFormer" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Premchan369/Q-TensorFormer", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use Premchan369/Q-TensorFormer with Docker Model Runner:
docker model run hf.co/Premchan369/Q-TensorFormer
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 filesFiles changed (6)
123version https://git-lfs.github.com/spec/v1oid sha256:693d1128cc7d93ea341c95a12f0c3789297f21e255cd1c994fdd59dba62a73e3size 1641126123version https://git-lfs.github.com/spec/v1oid sha256:b978b9c212c2ab6c7b09e696e4c5e5968d50b66fb40b1f1de454931413b7c31csize 1805737
123version https://git-lfs.github.com/spec/v1oid sha256:693d1128cc7d93ea341c95a12f0c3789297f21e255cd1c994fdd59dba62a73e3size 1641126123version https://git-lfs.github.com/spec/v1oid sha256:b978b9c212c2ab6c7b09e696e4c5e5968d50b66fb40b1f1de454931413b7c31csize 1805737
12345678910111213141519 unmodified lines353637383940414243444546473 unmodified lines515253545556575859606162632 unmodified lines666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701 unmodified line1721731741751761771781791801811821831843 unmodified lines1881891901911921931941952 unmodified lines1981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313324 unmodified lines3373383393403413423433443453463473482 unmodified lines35135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041111 unmodified lines42342442542642742842943043143243343443543643743843944044144244311 unmodified lines4554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904916 unmodified lines4984995005015025035045055065075085095105111 unmodified line5135145155165175185195205215225232 unmodified lines5265275285295305315322 unmodified lines5355365375385395405412 unmodified lines5445455465475485495502 unmodified lines5535545555565575585592 unmodified lines5625635645655665675682 unmodified lines5715725735745755765771 unmodified line5795805815825835845855865875885892 unmodified lines5925935945955965975982 unmodified lines6016026036046056066072 unmodified lines6106116126136146156161 unmodified line6186196206216226236246256266276282 unmodified lines6316326336346356366372 unmodified lines6406416426436446456464 unmodified lines65165265365465565665765865966066166266366466566666766865 unmodified lines7347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228232 unmodified lines82682782882983083183213 unmodified lines846847848849850851852853854855856857858859860861862863864865#!/usr/bin/env python3"""scripts/generate_ieee_pdf.pyGenerates camera-ready 6-page IEEE Conference PDF for Q-TensorFormer.Paper Title: Q-TensorFormer: Real-Time High-Throughput Edge LLM Inference viaZero-SVD Dynamic Tensor-Train Slicing and Provable Lyapunov-Stable ControlAuthors: Dr. Madala Guru Brahmam (1st) & V C Premchand Yadav (2nd) - VIT-AP University.Pre-renders all LaTeX math offline using KaTeX into MathML + HTML spans,inlines KaTeX CSS and base64 vector figures, and compiles via Headless Chromewith --no-pdf-header-footer to eliminate dates, URLs, and browser headers.Strict constraint: Zero em dashes anywhere in manuscript."""import base6419 unmodified linesreturn ""fig1_b64 = get_base64_image("figure1_architecture.png")fig2_b64 = get_base64_image("figure4_nested_tt_suboptimality.png")fig3_b64 = get_base64_image("figure8_controller_convergence.png")fig4_b64 = get_base64_image("figure7_kv_rate_distortion.png")fig5_b64 = get_base64_image("figure16_baseline_improvement_radar.png")fig6_b64 = get_base64_image("figure12_hardware_roofline.png")raw_template = '''<!DOCTYPE html><html lang="en"><head><meta charset="utf-8">3 unmodified lines@page {size: letter;margin: 0.65in 0.55in 0.65in 0.55in;}body {font-family: "Times New Roman", Times, "Nimbus Roman No9 L", serif;font-size: 10pt;line-height: 1.30;color: #000;margin: 0;padding: 0;2 unmodified linesprint-color-adjust: exact;}.title-container {text-align: center;margin-bottom: 15pt;padding-bottom: 7pt;border-bottom: 0.5pt solid #ddd;}.paper-title {font-size: 19.5pt;font-weight: bold;line-height: 1.22;margin-bottom: 13pt;letter-spacing: -0.2px;}.author-block {display: flex;justify-content: center;gap: 50pt;margin-bottom: 11pt;}.author-col {text-align: center;max-width: 270pt;}.author-name {font-size: 11.5pt;font-weight: bold;margin-bottom: 2pt;}.author-affil {font-size: 9pt;font-style: italic;line-height: 1.25;}.author-email {font-size: 8.5pt;font-family: "Courier New", monospace;margin-top: 3pt;color: #111;}.two-col {column-count: 2;column-gap: 18pt;text-align: justify;}.abstract-box {margin-bottom: 11pt;font-size: 9.5pt;line-height: 1.25;}.abstract-title {font-weight: bold;font-style: italic;}.keywords-box {margin-bottom: 13pt;font-size: 9.5pt;line-height: 1.25;}.keywords-title {font-weight: bold;font-style: italic;}h2 {font-size: 10.5pt;font-weight: bold;text-transform: uppercase;text-align: center;margin-top: 15pt;margin-bottom: 5pt;letter-spacing: 0.4px;break-after: avoid;border-bottom: 0.5pt solid #ccc;padding-bottom: 2pt;}h3 {font-size: 10pt;font-weight: bold;font-style: italic;margin-top: 9pt;margin-bottom: 3pt;break-after: avoid;}p {margin-top: 0;margin-bottom: 5pt;text-indent: 1.2em;}1 unmodified linetext-indent: 0;}.theorem-box {margin: 7pt 0;padding: 4pt 6pt;font-style: italic;border-left: 2.5pt solid #000;background: #fbfbfb;break-inside: avoid;}.theorem-title {3 unmodified lines.proof {font-style: normal;font-size: 9.2pt;margin: 3pt 0 6pt 0;text-indent: 1.2em;}2 unmodified linesfont-weight: bold;}table {width: 100%;border-collapse: collapse;font-size: 8.5pt;margin: 8pt 0;line-height: 1.20;break-inside: avoid;}th, td {padding: 3.2pt 4pt;text-align: left;}th {font-weight: bold;border-top: 1.4pt solid #000;border-bottom: 0.8pt solid #000;background: #f4f4f4;}td {border-bottom: 0.4pt solid #e0e0e0;}.table-bottom {border-bottom: 1.4pt solid #000;}.table-caption {font-size: 8.5pt;text-align: center;font-weight: bold;margin-bottom: 3pt;text-transform: uppercase;letter-spacing: 0.3px;}.highlight-row {background-color: #f0f7ff;font-weight: bold;}.figure-card {width: 100%;margin: 9pt 0;text-align: center;break-inside: avoid;}.figure-card img {width: 100%;max-height: 185pt;object-fit: contain;border: 0.5pt solid #ddd;border-radius: 2pt;}.figure-caption {font-size: 8.5pt;text-align: justify;line-height: 1.20;margin-top: 4pt;}.figure-caption-title {font-weight: bold;}.algorithm-box {border-top: 1.4pt solid #000;border-bottom: 1.4pt solid #000;padding: 5pt 3pt;font-size: 8.5pt;font-family: "Courier New", monospace;margin: 8pt 0;line-height: 1.24;background: #fdfdfd;break-inside: avoid;}.algo-header {font-family: "Times New Roman", Times, serif;font-weight: bold;font-size: 9pt;margin-bottom: 3pt;border-bottom: 0.6pt solid #000;padding-bottom: 2pt;}.eq-container {display: flex;justify-content: space-between;align-items: center;margin: 5pt 0;break-inside: avoid;}.eq-math {flex-grow: 1;text-align: center;}.eq-num {font-size: 9.5pt;font-weight: normal;padding-left: 8pt;white-space: nowrap;}.references {font-size: 8.5pt;line-height: 1.20;}.ref-item {margin-bottom: 3.5pt;text-indent: -1.4em;margin-left: 1.4em;}.perf-badge {display: inline-block;padding: 1pt 3pt;font-size: 7.5pt;font-weight: bold;color: #0b6623;background: #eaf8ec;border-radius: 2pt;}</style></head>4 unmodified lines<div class="author-block"><div class="author-col"><div class="author-name">Dr. Madala Guru Brahmam</div><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><div class="author-email">madala.gurubrahmam@vitap.ac.in</div></div><div class="author-col"><div class="author-name">V C Premchand Yadav</div><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><div class="author-email">premchandyadav.vc21bce9124@vitap.ac.in</div></div></div>2 unmodified lines<div class="two-col"><div class="abstract-box"><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 μs</b> (9,042x faster than 128 ms SVD re-factorization) with zero accuracy collapse ($p < 10^{-15}$, Cohen's $d = 1.354$).</div><div class="keywords-box"><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.</div><h2>I. Introduction</h2><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><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><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><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><p><b>Primary Contributions of this Work:</b></p><p>• <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><p>• <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><p>• <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><p>• <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><p>• <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><div class="figure-card"><img src="__FIG1__" alt="Q-TensorFormer Architecture"><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></div><h2>II. Q-TensorFormer System Architecture</h2><h3>A. Problem Formulation: Constrained Markov Decision Process</h3><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><p>The objective is to minimize cumulative task loss subject to physical hardware constraints:</p>$$\\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$$<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><h3>B. Zero-SVD Nested Tensor-Train Parameterization</h3><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>$$\\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, :]$$<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><p>In Q-TensorFormer, we parameterize cores such that lower-rank sub-tensors are nested directly inside the maximum rank allocation $r_{\\max}$:</p>$$\\mathcal{G}^{(k)}_{\\text{active}} = \\mathcal{G}^{(k)}[0:r_{\\text{curr}}, \\; :, \\; :, \\; 0:r_{\\text{curr}}]$$<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 μs</b>.</p><div class="figure-card"><img src="__FIG2__" alt="Nested TT Suboptimality"><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></div><div class="algorithm-box">11 unmodified lines<h3>C. Discrete-Time Lyapunov-Stable Controller</h3><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>$$e_t = L_t - L_{\\text{target}}$$$$u_t = e_t + \\kappa_D (e_t - e_{t-1})$$$$\\lambda_{t+1} = \\Pi_{[\\lambda_{\\min}, \\lambda_{\\max}]} \\left[ \\lambda_t + \\eta \\cdot \\phi_\\tau(u_t) \\right]$$<p class="no-indent">where $\\phi_\\tau(u)$ is a deadband hysteresis operator defined as:</p>$$\\phi_\\tau(u) = \\begin{cases} u - \\tau, & u > \\tau \\\\ 0, & |u| \\le \\tau \\\\ u + \\tau, & u < -\\tau \\end{cases}$$<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><div class="figure-card"><img src="__FIG3__" alt="Lyapunov Convergence"><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></div><div class="algorithm-box">11 unmodified lines9: <b>return</b> $r_{t+1}$ (provably stable: $\Delta V_t \le 0$)</div><h2>III. Formal Theoretical Analysis</h2><div class="theorem-box"><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:$$\\|\\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$$where $\\mathcal{G}^{(k)}_{>r}$ denotes the complementary sub-tensor slice outside rank $r$.</div><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">■</span></p><div class="theorem-box"><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:$$\\Delta V_t = V_{t+1} - V_t \\le -\\alpha \\|e_t\\|^2, \\quad \\forall |u_t| > \\tau$$where $\\alpha > 0$. The closed-loop system is asymptotically stable and eliminates limit-cycle chattering.</div><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">■</span></p><div class="figure-card"><img src="__FIG4__" alt="KV Rate Distortion"><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></div><div class="theorem-box"><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:$$\\|\\mathbf{o} - \\hat{\\mathbf{o}}\\|_1 \\le 2 \\sum_{i \\notin \\mathcal{A}} p_i \\le 2 \\exp(-\\gamma)$$</div><div class="theorem-box"><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$:$$\\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)$$</div><h2>IV. Quantitative Experimental Evaluation</h2>6 unmodified lines<p>• <b>Apple M3 Edge SoC:</b> 8-core CPU / 10-core GPU with 16-core Neural Engine, unified 100 GB/s memory architecture.</p><p>• <b>Intel Core Ultra 7 (Meteor Lake):</b> Intel 4 process, integrated Arc GPU + Intel AI Boost NPU, 32 GB LPDDR5X-7467.</p><div class="table-caption">Table I: Real-Time Edge Inference Throughput, Memory Footprint, and Latency Across Platforms</div><table><thead><tr><th>Platform & Model Architecture</th><th>Params (M)</th><th>Peak RAM (MB)</th><th>Throughput (tok/s)</th><th>Speedup</th><th>Adaptation Latency</th><th>Thermal Drop (15 min)</th>1 unmodified line</thead><tbody><tr><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></tr><tr><td>Dense Baseline (FP16 TinyLlama) [11]</td><td>1,100</td><td>2,180 MB</td><td>3.8 tok/s</td><td>1.0x</td>2 unmodified lines</tr><tr><td>AWQ 4-Bit Baseline [7]</td><td>1,100</td><td>840 MB</td><td>7.2 tok/s</td><td>1.9x</td>2 unmodified lines</tr><tr><td>MobileLLM-1.5B (ICLR 2024) [4]</td><td>1,500</td><td>1,420 MB</td><td>4.6 tok/s</td><td>1.2x</td>2 unmodified lines</tr><tr><td>Llama-3.2-1B Edge (Meta 2024) [1]</td><td>1,230</td><td>1,280 MB</td><td>5.4 tok/s</td><td>1.4x</td>2 unmodified lines</tr><tr><td>TensorGPT-TT Baseline (AAAI 2023) [14]</td><td>210</td><td>720 MB</td><td>8.9 tok/s</td><td>2.3x</td>2 unmodified lines</tr><tr class="highlight-row"><td><b>Q-TensorFormer (Static Balanced)</b></td><td><b>200</b></td><td><b>640 MB</b></td><td><b>14.6 tok/s</b></td><td><b>3.8x</b></td>2 unmodified lines</tr><tr class="highlight-row"><td><b>Q-TensorFormer (Lyapunov Slicing)</b></td><td><b>140–200</b></td><td><b>593 MB</b></td><td><b>18.2 tok/s</b></td><td><span class="perf-badge">+380% (4.8x)</span></td>1 unmodified line<td><b>-2.1% (Stable)</b></td></tr><tr><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></tr><tr><td>Dense Baseline (FP16)</td><td>1,100</td><td>2,180 MB</td><td>24.1 tok/s</td><td>1.0x</td>2 unmodified lines</tr><tr><td>AWQ 4-Bit Baseline [7]</td><td>1,100</td><td>840 MB</td><td>48.6 tok/s</td><td>2.0x</td>2 unmodified lines</tr><tr><td>MobileLLM-1.5B [4]</td><td>1,500</td><td>1,420 MB</td><td>29.4 tok/s</td><td>1.2x</td>2 unmodified lines</tr><tr class="highlight-row"><td><b>Q-TensorFormer (Lyapunov Slicing)</b></td><td><b>140–200</b></td><td><b>593 MB</b></td><td><b>94.7 tok/s</b></td><td><span class="perf-badge">+293% (3.9x)</span></td>1 unmodified line<td><b>-1.8% (Stable)</b></td></tr><tr><td colspan="7" style="background:#eaeaea; font-weight:bold; font-size:8pt;">Apple M3 Edge SoC (Unified 100 GB/s Memory Architecture)</td></tr><tr><td>Dense Baseline (FP16)</td><td>1,100</td><td>2,180 MB</td><td>46.2 tok/s</td><td>1.0x</td>2 unmodified lines</tr><tr><td>Llama-3.2-1B Edge (Meta 2024) [1]</td><td>1,230</td><td>1,280 MB</td><td>62.8 tok/s</td><td>1.4x</td>2 unmodified lines</tr><tr class="highlight-row"><td><b>Q-TensorFormer (Lyapunov Slicing)</b></td><td><b>140–200</b></td><td><b>593 MB</b></td><td><b>164.5 tok/s</b></td><td><span class="perf-badge">+256% (3.6x)</span></td>4 unmodified lines</table><p class="no-indent">As shown in Table I, Q-TensorFormer achieves unmatched inference efficiency:</p><p>• <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><p>• <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><p>• <b>Instant Sub-15 μ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 μs</b> via pointer slice arithmetic, representing a <b>9,042x speedup in rank switching latency</b>.</p><p>• <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><div class="figure-card"><img src="__FIG5__" alt="Multi-Objective Radar Benchmark"><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></div><div class="table-caption">Table II: Reasoning Accuracy, Perplexity, and 50-Trial Statistical Validation</div><table><thead><tr><th>Model Architecture</th>65 unmodified lines<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><div class="table-caption">Table III: Energy Dissipation, Arithmetic Intensity, and DRAM Traffic Across Architectures</div><table><thead><tr><th>Architecture Setup</th><th>Arithmetic Intensity (FLOP/Byte)</th><th>Intermediate DRAM Traffic (KB/tok)</th><th>Energy / Token (mJ)</th><th>Battery Life Impact</th><th>Sub-SVD Speculative Gain</th></tr></thead><tbody><tr><td>Standard Dense Transformer</td><td>0.048</td><td>65.6 KB</td><td>84.2 mJ</td><td>Baseline (1.0x)</td><td>None</td></tr><tr><td>INT8 Weight-Only PTQ</td><td>0.096</td><td>32.8 KB</td><td>48.6 mJ</td><td>1.73x Extension</td><td>None</td></tr><tr><td>AWQ 4-Bit (MLSys 2024) [7]</td><td>0.192</td><td>16.4 KB</td><td>31.4 mJ</td><td>2.68x Extension</td><td>None</td></tr><tr class="highlight-row"><td><b>Q-TensorFormer (Fused TT)</b></td><td><b>1.549</b></td><td><b>2.03 KB (-96.9%)</b></td><td><b>12.8 mJ</b></td><td><b>6.58x Extension</b></td><td><b>1.38x Self-Drafting</b></td></tr><tr class="highlight-row"><td><b>Q-TensorFormer (Full Adaptive)</b></td><td><b>1.549</b></td><td><b>1.48 KB (-97.7%)</b></td><td><b>9.4 mJ</b></td><td><span class="perf-badge">8.95x Battery Extension</span></td><td><b>1.44x Speculative Speedup</b></td></tr></tbody></table><div class="figure-card"><img src="__FIG6__" alt="Hardware Roofline Model"><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></div><h3>D. Self-Speculative Drafting with Zero Parameter Overhead</h3><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><h3>E. Multi-Modal Cross-Attention Projector Slicing</h3><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><h2>V. Related Work</h2><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><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><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><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><h2>VI. Conclusion and Open-Source Artifacts</h2><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><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><p>• <b>Model Hub Repository:</b> <a href="https://huggingface.co/Premchan369/Q-TensorFormer">https://huggingface.co/Premchan369/Q-TensorFormer</a></p><p>• <b>Interactive Web Space:</b> <a href="https://huggingface.co/spaces/Premchan369/Q-TensorFormer">https://huggingface.co/spaces/Premchan369/Q-TensorFormer</a></p><h2>References</h2><div class="references"><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><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>2 unmodified lines<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><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><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><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><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><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><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>13 unmodified lines</html>'''# Replace placeholdershtml_content = raw_template.replace("__FIG1__", fig1_b64)html_content = html_content.replace("__FIG2__", fig2_b64)html_content = html_content.replace("__FIG3__", fig3_b64)html_content = html_content.replace("__FIG4__", fig4_b64)html_content = html_content.replace("__FIG5__", fig5_b64)html_content = html_content.replace("__FIG6__", fig6_b64)# Verify zero em dashesem_dash_present = any(char in html_content for char in ["\u2014", "\u2013\u2013", "---"])print(f"[Verification] Em dash present in source: {em_dash_present}")if em_dash_present:print("[Error] Em dashes detected! Removing...")html_content = html_content.replace("\u2014", ": ").replace("---", ": ")# Write raw HTMLHTML_RAW_PATH.write_text(html_content, encoding="utf-8")12345678910111213141516171819202119 unmodified lines41424344454647484950515253543 unmodified lines585960616263646566676869707172732 unmodified lines7677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831 unmodified line1851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242253 unmodified lines2292302312322332342352362 unmodified lines2392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653664 unmodified lines3713723733743753763773783793803813822 unmodified lines38538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045111 unmodified lines46346446546646746846947047147247347447547647747847948048148248311 unmodified lines4954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475486 unmodified lines5555565575585595605615625635645655665675681 unmodified line5705715725735745755765775785795802 unmodified lines5835845855865875885892 unmodified lines5925935945955965975982 unmodified lines6016026036046056066072 unmodified lines6106116126136146156162 unmodified lines6196206216226236246252 unmodified lines6286296306316326336341 unmodified line6366376386396406416426436446456462 unmodified lines6496506516526536546552 unmodified lines6586596606616626636642 unmodified lines6676686696706716726731 unmodified line6756766776786796806816826836846852 unmodified lines6886896906916926936942 unmodified lines6976986997007017027034 unmodified lines70870971071171271371471571671771871972072172272372472565 unmodified lines7917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748752 unmodified lines87887988088188288388413 unmodified lines898899900901902903904905906907908909910911#!/usr/bin/env python3"""scripts/generate_ieee_pdf.pyCompiles camera-ready IEEE Conference Paper PDF for Q-TensorFormer.Strict adherence to official IEEE Conference Publishing standards:- US Letter (8.5 x 11 in)- Margins: Top 0.75 in (19 mm), Bottom 1.0 in (25.4 mm), Left/Right 0.625 in (15.9 mm)- Column Gutter: 0.25 in (18 pt)- Times New Roman body font (10 pt, justified, single spaced)- Centered 24 pt regular Title Case paper title- Author block: Dr. Madala Guru Brahmam (1st) & V C Premchand Yadav (2nd)- Abstract (single paragraph, 150-250 words) with Abstract- and Index Terms- labels- Primary headings: Roman numerals, small caps, centered, 10 pt- Subheadings: Capital letters, italic, left-aligned, 10 pt- Multi-line broken equations to completely eliminate equation overlap- Equation table layout: centered math with flush-right parenthetical numbers (1)- 7 comprehensive scientific figures embedded as base64 images- No printed dates, page numbers, or URLs in headers/footers (--no-pdf-header-footer)"""import base6419 unmodified linesreturn ""fig1_b64 = get_base64_image("figure1_architecture.png")fig2_b64 = get_base64_image("figure16_baseline_improvement_radar.png")fig3_b64 = get_base64_image("figure12_hardware_roofline.png")fig4_b64 = get_base64_image("figure11_subsystem_latency_breakdown.png")fig5_b64 = get_base64_image("figure4_nested_tt_suboptimality.png")fig6_b64 = get_base64_image("figure8_controller_convergence.png")fig7_b64 = get_base64_image("figure7_kv_rate_distortion.png")raw_template = r'''<!DOCTYPE html><html lang="en"><head><meta charset="utf-8">3 unmodified lines@page {size: letter;margin-top: 0.75in;margin-bottom: 1.00in;margin-left: 0.625in;margin-right: 0.625in;}body {font-family: "Times New Roman", Times, "Nimbus Roman No9 L", serif;font-size: 10pt;line-height: 1.16;color: #000;margin: 0;padding: 0;2 unmodified linesprint-color-adjust: exact;}/* Metadata Title & Authors */.title-container {text-align: center;margin-bottom: 14pt;padding-bottom: 4pt;}.paper-title {font-size: 24pt;font-weight: normal;line-height: 1.15;margin-bottom: 14pt;letter-spacing: -0.2px;}.author-block {display: flex;justify-content: center;gap: 40pt;margin-bottom: 12pt;}.author-col {text-align: center;max-width: 250pt;}.author-name {font-size: 11pt;font-weight: normal;margin-bottom: 2pt;}.author-affil {font-size: 10pt;font-style: italic;line-height: 1.20;}.author-email {font-size: 9pt;font-family: "Courier New", monospace;font-style: normal;margin-top: 3pt;color: #000;}/* Strict Two-Column Layout */.two-col {column-count: 2;column-gap: 18pt; /* 0.25 in */text-align: justify;column-fill: balance;}/* Abstract and Keywords */.abstract-box {margin-bottom: 6pt;font-size: 10pt;line-height: 1.16;text-align: justify;}.keywords-box {margin-bottom: 10pt;font-size: 10pt;line-height: 1.16;text-align: justify;}/* Heading Hierarchy */h2 {font-size: 10pt;font-weight: normal;font-variant: small-caps;text-transform: uppercase;text-align: center;margin-top: 10pt;margin-bottom: 4pt;letter-spacing: 0.5px;break-after: avoid;}h3 {font-size: 10pt;font-weight: normal;font-style: italic;text-align: left;margin-top: 9pt;margin-bottom: 3pt;break-after: avoid;}.sub-subhead {font-style: italic;text-indent: 1.2em;display: inline;}p {margin-top: 0;margin-bottom: 3.5pt;text-indent: 1.2em;}1 unmodified linetext-indent: 0;}/* Mathematics & Equation Formatting */.eq-table {width: 100%;border-collapse: collapse;margin: 5pt 0;break-inside: avoid;}.eq-cell-math {text-align: center;vertical-align: middle;width: 98%;padding: 0;font-size: 9.5pt;}.eq-cell-num {text-align: right;vertical-align: middle;white-space: nowrap;font-family: "Times New Roman", Times, serif;font-size: 10pt;width: 2%;padding-left: 6pt;}/* Theorems & Proofs */.theorem-box {margin: 6pt 0;padding: 3pt 5pt;font-style: italic;border-left: 2pt solid #000;background: #fafafa;break-inside: avoid;font-size: 9.5pt;}.theorem-title {3 unmodified lines.proof {font-style: normal;font-size: 9.5pt;margin: 2pt 0 5pt 0;text-indent: 1.2em;}2 unmodified linesfont-weight: bold;}/* Visual Elements: Tables */table.data-table {width: 100%;border-collapse: collapse;font-size: 8pt;margin: 6pt 0;line-height: 1.15;break-inside: avoid;}table.data-table th, table.data-table td {padding: 2.5pt 3pt;text-align: left;}table.data-table th {font-weight: bold;border-top: 1.2pt solid #000;border-bottom: 0.6pt solid #000;background: #f8f8f8;}table.data-table td {border-bottom: 0.4pt solid #e0e0e0;}.table-bottom {border-bottom: 1.2pt solid #000;}.table-caption {font-size: 8pt;text-align: center;font-variant: small-caps;margin-bottom: 2pt;letter-spacing: 0.4px;break-after: avoid;}.highlight-row {background-color: #f2f7fc;font-weight: bold;}/* Visual Elements: Figures */.figure-card {width: 100%;margin: 5pt 0;text-align: center;break-inside: avoid;}.figure-card img {width: 100%;max-height: 85pt;object-fit: contain;border: 0.5pt solid #ccc;border-radius: 1pt;}.figure-caption {font-size: 8pt;text-align: justify;line-height: 1.15;margin-top: 3pt;}.figure-caption-title {font-weight: normal;}/* Algorithms */.algorithm-box {border-top: 1.2pt solid #000;border-bottom: 1.2pt solid #000;padding: 4pt 2pt;font-size: 8pt;font-family: "Courier New", monospace;margin: 6pt 0;line-height: 1.20;background: #fcfcfc;break-inside: avoid;}.algo-header {font-family: "Times New Roman", Times, serif;font-weight: bold;font-size: 8.5pt;margin-bottom: 2pt;border-bottom: 0.5pt solid #000;padding-bottom: 2pt;}/* References */.references-heading {font-size: 10pt;font-weight: normal;font-variant: small-caps;text-align: center;margin-top: 10pt;margin-bottom: 6pt;}.references {font-size: 8pt;line-height: 1.15;}.ref-item {margin-bottom: 3pt;text-indent: -1.3em;margin-left: 1.3em;}.perf-badge {display: inline-block;padding: 0.5pt 2.5pt;font-size: 7.5pt;font-weight: bold;color: #0b6623;background: #eaf8ec;border-radius: 1.5pt;}</style></head>4 unmodified lines<div class="author-block"><div class="author-col"><div class="author-name">Dr. Madala Guru Brahmam</div><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><div class="author-email">madala.gurubrahmam@vitap.ac.in</div></div><div class="author-col"><div class="author-name">V C Premchand Yadav</div><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><div class="author-email">premchandyadav.vc21bce9124@vitap.ac.in</div></div></div>2 unmodified lines<div class="two-col"><div class="abstract-box"><b><i>Abstract</i>—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 μs (9,042x faster than 128 ms SVD re-factorization) with zero accuracy collapse ($p < 10^{-15}$, Cohen's $d = 1.354$).</b></div><div class="keywords-box"><b><i>Index Terms</i>—Closed-loop control, Contextual bandits, Edge artificial intelligence, Foundation models, Lyapunov stability, Tensor-Train decomposition.</b></div><h2>I. Introduction</h2><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><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><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><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><p><b>Primary Contributions of this Work:</b></p><p>• <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><p>• <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><p>• <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><p>• <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><p>• <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><div class="figure-card"><img src="__FIG1__" alt="Q-TensorFormer Architecture"><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></div><h2>II. System Architecture</h2><h3>A. Problem Formulation: Constrained Markov Decision Process</h3><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><p>The objective is to minimize cumulative task loss subject to physical hardware constraints:</p>$$\begin{aligned}\min_{\pi} \;& \mathbb{E}_{\pi} \left[ \sum_{t=1}^T \mathcal{L}_{\text{task}}(\mathbf{y}_t, \hat{\mathbf{y}}_t) \right] \\\text{s.t.} \;& \mathbb{E}[C_k(\mathbf{s}_t, \mathbf{a}_t)] \le B_k, \quad \forall k\end{aligned}$$<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><h3>B. Zero-SVD Nested Tensor-Train Parameterization</h3><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>$$\begin{aligned}\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, :] \\&\quad \cdots \mathcal{G}^{(d)}[:, i_d, j_d, :]\end{aligned}$$<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><p>In Q-TensorFormer, we parameterize cores such that lower-rank sub-tensors are nested directly inside the maximum rank allocation $r_{\max}$:</p>$$\mathcal{G}^{(k)}_{\text{active}} = \mathcal{G}^{(k)}[0:r_{\text{curr}}, \; :, \; :, \; 0:r_{\text{curr}}]$$<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 μs</b>.</p><div class="figure-card"><img src="__FIG2__" alt="Improvement Radar"><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></div><div class="algorithm-box">11 unmodified lines<h3>C. Discrete-Time Lyapunov-Stable Controller</h3><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>$$e_t = L_t - L_{\text{target}}$$$$u_t = e_t + \kappa_D (e_t - e_{t-1})$$$$\lambda_{t+1} = \Pi_{[\lambda_{\min}, \lambda_{\max}]} \left[ \lambda_t + \eta \cdot \phi_\tau(u_t) \right]$$<p class="no-indent">where $\phi_\tau(u)$ is a deadband hysteresis operator defined as:</p>$$\phi_\tau(u) = \begin{cases} u - \tau, & u > \tau \\ 0, & |u| \le \tau \\ u + \tau, & u < -\tau \end{cases}$$<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><div class="figure-card"><img src="__FIG3__" alt="Roofline Model"><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></div><div class="algorithm-box">11 unmodified lines9: <b>return</b> $r_{t+1}$ (provably stable: $\Delta V_t \le 0$)</div><div class="figure-card"><img src="__FIG4__" alt="Subsystem Latency Breakdown"><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></div><h2>III. Theoretical Analysis</h2><div class="theorem-box"><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:$$\begin{aligned}\|\mathbf{W} - \mathbf{W}(r)\|_F &\le \sum_{k=1}^{d-1} \|\mathcal{G}^{(k)}_{>r}\|_F \\&\quad \times \prod_{j \ne k} \|\mathcal{G}^{(j)}\|_F\end{aligned}$$where $\mathcal{G}^{(k)}_{>r}$ denotes the complementary sub-tensor slice outside rank $r$.</div><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">■</span></p><div class="theorem-box"><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:$$\Delta V_t = V_{t+1} - V_t \le -\alpha \|e_t\|^2, \quad \forall |u_t| > \tau$$where $\alpha > 0$. The closed-loop system is asymptotically stable and eliminates limit-cycle chattering.</div><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">■</span></p><div class="figure-card"><img src="__FIG5__" alt="Nested TT Suboptimality"><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></div><div class="theorem-box"><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:$$\|\mathbf{o} - \hat{\mathbf{o}}\|_1 \le 2 \sum_{i \notin \mathcal{A}} p_i \le 2 \exp(-\gamma)$$</div><div class="theorem-box"><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$:$$\begin{aligned}\mathcal{R}(T) &\le 2 \sqrt{2 d T \ln(1 + T / \lambda)} \\&\quad \times \left( \sqrt{\lambda} S + \sigma \sqrt{2 \ln(1/\delta) + d \ln\left(1 + \frac{T}{d \lambda}\right)} \right) \\&= \mathcal{O}\left(d \sqrt{T \ln(T / \delta)}\right)\end{aligned}$$</div><div class="figure-card"><img src="__FIG6__" alt="Lyapunov Convergence"><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></div><h2>IV. Quantitative Experimental Evaluation</h2>6 unmodified lines<p>• <b>Apple M3 Edge SoC:</b> 8-core CPU / 10-core GPU with 16-core Neural Engine, unified 100 GB/s memory architecture.</p><p>• <b>Intel Core Ultra 7 (Meteor Lake):</b> Intel 4 process, integrated Arc GPU + Intel AI Boost NPU, 32 GB LPDDR5X-7467.</p><div class="table-caption">TABLE I: REAL-TIME EDGE INFERENCE THROUGHPUT, MEMORY FOOTPRINT, AND LATENCY ACROSS PLATFORMS</div><table class="data-table"><thead><tr><th>Platform & Model Architecture</th><th>Params</th><th>Peak RAM</th><th>Throughput</th><th>Speedup</th><th>Adaptation Latency</th><th>Thermal Drop (15 min)</th>1 unmodified line</thead><tbody><tr><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></tr><tr><td>Dense Baseline (FP16 TinyLlama) [11]</td><td>1,100M</td><td>2,180 MB</td><td>3.8 tok/s</td><td>1.0x</td>2 unmodified lines</tr><tr><td>AWQ 4-Bit Baseline [7]</td><td>1,100M</td><td>840 MB</td><td>7.2 tok/s</td><td>1.9x</td>2 unmodified lines</tr><tr><td>MobileLLM-1.5B (ICLR 2024) [4]</td><td>1,500M</td><td>1,420 MB</td><td>4.6 tok/s</td><td>1.2x</td>2 unmodified lines</tr><tr><td>Llama-3.2-1B Edge (Meta 2024) [1]</td><td>1,230M</td><td>1,280 MB</td><td>5.4 tok/s</td><td>1.4x</td>2 unmodified lines</tr><tr><td>TensorGPT-TT Baseline (AAAI 2023) [14]</td><td>210M</td><td>720 MB</td><td>8.9 tok/s</td><td>2.3x</td>2 unmodified lines</tr><tr class="highlight-row"><td><b>Q-TensorFormer (Static Balanced)</b></td><td><b>200M</b></td><td><b>640 MB</b></td><td><b>14.6 tok/s</b></td><td><b>3.8x</b></td>2 unmodified lines</tr><tr class="highlight-row"><td><b>Q-TensorFormer (Lyapunov Slicing)</b></td><td><b>140–200M</b></td><td><b>593 MB</b></td><td><b>18.2 tok/s</b></td><td><span class="perf-badge">+380% (4.8x)</span></td>1 unmodified line<td><b>-2.1% (Stable)</b></td></tr><tr><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></tr><tr><td>Dense Baseline (FP16)</td><td>1,100M</td><td>2,180 MB</td><td>24.1 tok/s</td><td>1.0x</td>2 unmodified lines</tr><tr><td>AWQ 4-Bit Baseline [7]</td><td>1,100M</td><td>840 MB</td><td>48.6 tok/s</td><td>2.0x</td>2 unmodified lines</tr><tr><td>MobileLLM-1.5B [4]</td><td>1,500M</td><td>1,420 MB</td><td>29.4 tok/s</td><td>1.2x</td>2 unmodified lines</tr><tr class="highlight-row"><td><b>Q-TensorFormer (Lyapunov Slicing)</b></td><td><b>140–200M</b></td><td><b>593 MB</b></td><td><b>94.7 tok/s</b></td><td><span class="perf-badge">+293% (3.9x)</span></td>1 unmodified line<td><b>-1.8% (Stable)</b></td></tr><tr><td colspan="7" style="background:#f0f0f0; font-weight:bold; font-size:7.5pt;">Apple M3 Edge SoC (Unified 100 GB/s Memory Architecture)</td></tr><tr><td>Dense Baseline (FP16)</td><td>1,100M</td><td>2,180 MB</td><td>46.2 tok/s</td><td>1.0x</td>2 unmodified lines</tr><tr><td>Llama-3.2-1B Edge (Meta 2024) [1]</td><td>1,230M</td><td>1,280 MB</td><td>62.8 tok/s</td><td>1.4x</td>2 unmodified lines</tr><tr class="highlight-row"><td><b>Q-TensorFormer (Lyapunov Slicing)</b></td><td><b>140–200M</b></td><td><b>593 MB</b></td><td><b>164.5 tok/s</b></td><td><span class="perf-badge">+256% (3.6x)</span></td>4 unmodified lines</table><p class="no-indent">As shown in Table I, Q-TensorFormer achieves unmatched inference efficiency:</p><p>• <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><p>• <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><p>• <i>Instant Sub-15 μ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 μs</b> via pointer slice arithmetic, representing a <b>9,042x speedup in rank switching latency</b>.</p><p>• <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><div class="figure-card"><img src="__FIG7__" alt="KV Rate Distortion"><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></div><div class="table-caption">TABLE II: REASONING ACCURACY, PERPLEXITY, AND 50-TRIAL STATISTICAL VALIDATION</div><table class="data-table"><thead><tr><th>Model Architecture</th>65 unmodified lines<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><div class="table-caption">TABLE III: ENERGY DISSIPATION, ARITHMETIC INTENSITY, AND DRAM TRAFFIC ACROSS ARCHITECTURES</div><table class="data-table"><thead><tr><th>Architecture Setup</th><th>Arithmetic Intensity</th><th>Intermediate DRAM Traffic</th><th>Energy / Token</th><th>Battery Life Impact</th><th>Speculative Gain</th></tr></thead><tbody><tr><td>Standard Dense Transformer</td><td>0.048 FLOP/Byte</td><td>65.6 KB/tok</td><td>84.2 mJ</td><td>Baseline (1.0x)</td><td>None</td></tr><tr><td>INT8 Weight-Only PTQ</td><td>0.096 FLOP/Byte</td><td>32.8 KB/tok</td><td>48.6 mJ</td><td>1.73x Extension</td><td>None</td></tr><tr><td>AWQ 4-Bit (MLSys 2024) [7]</td><td>0.192 FLOP/Byte</td><td>16.4 KB/tok</td><td>31.4 mJ</td><td>2.68x Extension</td><td>None</td></tr><tr class="highlight-row"><td><b>Q-TensorFormer (Fused TT)</b></td><td><b>1.549 FLOP/Byte</b></td><td><b>2.03 KB/tok (-96.9%)</b></td><td><b>12.8 mJ</b></td><td><b>6.58x Extension</b></td><td><b>1.38x Self-Drafting</b></td></tr><tr class="highlight-row"><td><b>Q-TensorFormer (Full Adaptive)</b></td><td><b>1.549 FLOP/Byte</b></td><td><b>1.48 KB/tok (-97.7%)</b></td><td><b>9.4 mJ</b></td><td><span class="perf-badge">8.95x Battery Extension</span></td><td><b>1.44x Speedup</b></td></tr></tbody></table><h3>D. Self-Speculative Drafting with Zero Parameter Overhead</h3><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><h3>E. Multi-Modal Cross-Attention Projector Slicing</h3><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><h2>V. Related Work</h2><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><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><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><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><h2>VI. Conclusion and Open-Source Artifacts</h2><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><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><p>• <b>Model Hub Repository:</b> <a href="https://huggingface.co/Premchan369/Q-TensorFormer">https://huggingface.co/Premchan369/Q-TensorFormer</a></p><p>• <b>Interactive Web Space:</b> <a href="https://huggingface.co/spaces/Premchan369/Q-TensorFormer">https://huggingface.co/spaces/Premchan369/Q-TensorFormer</a></p><div class="references-heading">REFERENCES</div><div class="references"><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><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>2 unmodified lines<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><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><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><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><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><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><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>13 unmodified lines</html>'''# Replace figure placeholdershtml_content = raw_template.replace("__FIG1__", fig1_b64)html_content = html_content.replace("__FIG2__", fig2_b64)html_content = html_content.replace("__FIG3__", fig3_b64)html_content = html_content.replace("__FIG4__", fig4_b64)html_content = html_content.replace("__FIG5__", fig5_b64)html_content = html_content.replace("__FIG6__", fig6_b64)html_content = html_content.replace("__FIG7__", fig7_b64)# Write raw HTMLHTML_RAW_PATH.write_text(html_content, encoding="utf-8")
28 unmodified lines29303132333435363738394041424328 unmodified linesthrowOnError: false,strict: false});return `<div class="eq-container"><div class="eq-math">${mathHtml}</div><div class="eq-num">(${eqCounter})</div></div>`;} catch (e) {console.error('KaTeX block error on:', rawEq, e);return match;}});// Next replace inline math $ ... $// Avoid matching currency or escaped \$output = output.replace(/(?<!\\)\$([^\$\n]+?)(?<!\\)\$/g, (match, eq) => {const rawEq = eq.trim();try {28 unmodified lines293031323334353637383940414228 unmodified linesthrowOnError: false,strict: false});return `<table class="eq-table"><tr><td class="eq-cell-math">${mathHtml}</td><td class="eq-cell-num">(${eqCounter})</td></tr></table>`;} catch (e) {console.error('KaTeX block error on:', rawEq, e);return match;}});// Next replace inline math $ ... $ (excluding escaped \$)output = output.replace(/(?<!\\)\$([^\$\n]+?)(?<!\\)\$/g, (match, eq) => {const rawEq = eq.trim();try {
paper/ieee_conference_6page_qtensorformer.pdf+2-2
paper/ieee_conference_paper.html
paper/ieee_conference_paper_raw.html
paper/q_tensorformer_ieee_paper.pdf+2-2
scripts/generate_ieee_pdf.py+287-241
scripts/render_katex.js+2-3