UraionLabs commited on
Commit
bc443b3
·
verified ·
1 Parent(s): 429f1e9

Upload folder using huggingface_hub

Browse files
paper/uraionspec-paper.pdf CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:ad6156cd8842d4021aa11427a65bfacfa05f46dac101fa1efbe068d23f3cf164
3
- size 490909
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f93345bf1b491a8d754efba0c5146698a9a8262b8961ed1151af31290b48250f
3
+ size 500974
paper/uraionspec-paper.tex CHANGED
@@ -16,6 +16,11 @@
16
  % enumitem not available — using basic LaTeX lists instead
17
  % caption/subcaption not available — using basic figure handling
18
 
 
 
 
 
 
19
  \geometry{margin=1in}
20
 
21
  % ---------- metadata for arXiv ----------
@@ -67,13 +72,14 @@ backbone with a lightweight sequential head, and confidence-scheduled
67
  verification that dynamically adjusts verification length based on predicted
68
  acceptance probabilities and engine throughput.
69
 
70
- We present \UraionSpec, a clean, modular, and verified implementation of the
71
- \DSpark algorithm. Our implementation faithfully reproduces the core
72
  components---the Markov and RNN sequential heads, confidence head, Sequential
73
- Temperature Scaling (STS) calibration, hardware-aware prefix scheduler
74
- (Algorithm~1), and the three-term training objective---while adding a
75
- \DFlash-style parallel backbone with target model KV injection that was
76
- missing from the initial release. With 80 passing unit tests, a fully
 
77
  configurable training pipeline, comprehensive evaluation tools, and
78
  end-to-end smoke tests, \UraionSpec is designed for reproducible research
79
  and practical experimentation. The codebase is publicly available on
@@ -109,7 +115,7 @@ contributions:
109
  (the \DFlash architecture) processes all proposal positions in a
110
  single forward pass, while a lightweight sequential head (Markov or RNN)
111
  injects inter-token dependency. This combines the speed of parallel
112
- drafters~\cite{stern2018blockwise, xia2022medusa} with the quality of
113
  autoregressive ones~\cite{miao2025eagle3}.
114
  \item \textbf{Confidence-scheduled verification}: A trained confidence head
115
  predicts per-position acceptance probabilities, and a hardware-aware
@@ -121,15 +127,15 @@ contributions:
121
  \paragraph{Our contribution.}
122
  We present \UraionSpec, a faithful, modular, and verified implementation of
123
  \DSpark. Our implementation includes all core components listed in the
124
- original paper, plus a \DFlash-style parallel backbone with target model KV
125
- injection that was identified as a critical gap in initial implementations.
126
  The codebase is designed for clarity and reproducibility rather than
127
  production scale, making it suitable for academic research, ablation studies,
128
  and educational purposes. Key features include:
129
 
130
  \begin{itemize}
131
  \item Complete implementation of all \DSpark components (80 unit tests)
132
- \item \DFlash-style backbone with target model KV injection
133
  \item Markov, gated Markov, and RNN sequential heads
134
  \item Confidence head with analytical acceptance-rate supervision
135
  \item Sequential Temperature Scaling (STS) calibration
@@ -156,7 +162,7 @@ is accepted with probability
156
  \label{eq:acceptance}
157
  \end{equation}
158
  and the first rejection marks the end of the accepted prefix. A bonus token
159
- is then sampled from the target's residual distribution at the rejection
160
  position, ensuring the final distribution matches the target model exactly.
161
 
162
  The expected number of accepted tokens $\tau$ is
@@ -234,7 +240,7 @@ UraionSpec/
234
  src/uraionspec/
235
  models/ -- Draft model components
236
  markov_head.py -- Low-rank transition bias
237
- rnn_head.py -- GRU-like recurrent head
238
  confidence_head.py -- Per-position acceptance predictor
239
  dflash_backbone.py -- DFlash backbone w/ KV injection
240
  draft_model.py -- Combined DSpark draft model
@@ -286,7 +292,7 @@ This allows the backbone representation to influence how much Markov bias to
286
  apply, providing context-dependent transition modeling.
287
 
288
  \paragraph{RNN head.}
289
- For full prefix history, we implement a GRU-like recurrent head:
290
  \begin{align}
291
  z_k &= [s_{k-1} ;\; W_1[x_{k-1}] ;\; h_k], \\
292
  s_k &= \sigma(W_g z_k) \odot s_{k-1} + (1 - \sigma(W_g z_k)) \odot \tanh(W_c z_k), \\
@@ -394,7 +400,7 @@ throughput curve $\SPS(B)$, the scheduler computes:
394
  \caption{Hardware-Aware Prefix Scheduler (Algorithm~1)}
395
  \label{alg:scheduler}
396
  \begin{algorithmic}[1]
397
- \State \textbf{Input:} confidence scores $\{c_{r,1:\gamma}\}_{r=1}^R$, throughput curve $\SPS(B)$
398
  \State \textbf{Output:} verification lengths $\{\ell_r\}_{r=1}^R$
399
  \For{each request $r$}
400
  \State $a_{r,j} \gets \prod_{i=1}^j c_{r,i}$ \Comment{Prefix survival probs}
@@ -425,7 +431,7 @@ order of decreasing survival probability, which ensures that extending a
425
  request's verification length only happens when it adds the globally most
426
  valuable token. The early stopping condition guarantees the
427
  non-anticipating property --- the scheduler never extends a request's
428
- length based on future tokens' survival probabilities that cannot be
429
  known at the current step.
430
 
431
  A fallback \texttt{StaticScheduler} with fixed-length and static-threshold
@@ -458,7 +464,7 @@ selection and 15-bin ECE computation for calibration quality assessment.
458
 
459
  We validate the \UraionSpec implementation through unit tests, gradient
460
  checks, smoke training, and component-level verification. All experiments
461
- were conducted on a MacBook Pro 12,1 (Intel i5-5257U, 7.8~GB RAM, CPU only)
462
  running Ubuntu~24~LTS, targeting the \text{Qwen/Qwen3-0.6B} model.
463
 
464
  \subsection{Unit Tests}
@@ -469,24 +475,25 @@ The codebase includes 80 unit tests spanning all major components. Table
469
 
470
  \begin{table}[t]
471
  \centering
 
472
  \caption{Unit test coverage by module. All 80 tests pass.}
473
  \label{tab:tests}
474
  \begin{tabular}{lcc}
475
  \toprule
476
  Test Suite & Tests & Coverage \\
477
  \midrule
478
- Acceptance rule ($\min(1,\; p_t/p_d)$) & 8 & Full: all-accepted, rejected, partial,\\
479
- & & bonus token, batch independence, \\
480
  & & expected length \\
481
- Markov head & 11 & Vanilla, gated, forward shapes,\\
482
  & & gradients, sampling \\
483
- Scheduler & 12 & Throughput profile, Algorithm~1,\\
484
- & & static fallback, zero confidence \\
485
- Shape/gradient checks & 7 & Draft model, losses, confidence head,\\
486
  & & end-to-end cycle \\
487
- STS calibration & 8 & ECE, temperature fitting, fit/transform,\\
488
- & & calibrator API \\
489
- DFlash backbone & 16 & Attention, decoder layer, full backbone,\\
490
  & & GQA, masks, gradient flow, edge cases \\
491
  Sampling utilities & 8 & Residual, greedy, temperature, gather \\
492
  \bottomrule
@@ -513,7 +520,7 @@ We verify the lossless speculative decoding acceptance rule
513
  \paragraph{DFlash backbone.}
514
  The \DFlash-style backbone passes all shape and gradient checks:
515
  \begin{itemize}
516
- \item Forward pass produces correct output shapes for single/GQA/masked
517
  attention configurations.
518
  \item Gradient flow verified through attention, decoder layer, and full
519
  backbone stack.
@@ -524,7 +531,7 @@ The \DFlash-style backbone passes all shape and gradient checks:
524
  \end{itemize}
525
 
526
  \paragraph{Training objective.}
527
- The three-term loss (Eq.~12) is verified through a smoke training run:
528
  \begin{itemize}
529
  \item 32 samples from the Capybara dataset, block size $\gamma=4$.
530
  \item All three loss terms (CE, TV, confidence) are non-negative and
@@ -553,7 +560,7 @@ limitations should be noted:
553
  CPU-based smoke testing of \text{Qwen3-0.6B}. Full training and
554
  benchmarking on GPU hardware (e.g., Colab A100) is the natural next
555
  step.
556
- \item \textbf{No vLLM integration}: Unlike the official \DeepSpec\
557
  repository, \UraionSpec does not integrate with production serving
558
  frameworks. We prioritize algorithm clarity over production readiness.
559
  \end{enumerate}
@@ -564,7 +571,7 @@ limitations should be noted:
564
 
565
  All code is publicly available under the MIT license:
566
 
567
- \begin{itemize}[leftmargin=*,itemsep=2pt]
568
  \item \textbf{GitHub}: \url{https://github.com/arnavprabhu/UraionSpec}
569
  \item \textbf{HuggingFace}: \url{https://huggingface.co/UraionLabs/UraionSpec}
570
  \end{itemize}
@@ -604,13 +611,13 @@ colab run --gpu A100 --keep --timeout 28800 \
604
  \label{sec:conclusion}
605
 
606
  We have presented \UraionSpec, a faithful, modular, and verified
607
- implementation of the \DSpark speculative decoding algorithm. Our
608
  implementation covers all core algorithmic components---semi-autoregressive
609
  generation via Markov, gated Markov, and RNN sequential heads, confidence
610
  prediction with analytical supervision, Sequential Temperature Scaling
611
- calibration, and the hardware-aware prefix scheduler (Algorithm~1)---plus
612
- a \DFlash-style backbone with target model KV injection that realizes the
613
- full parallel drafting architecture described in the original paper.
614
 
615
  With 80 passing unit tests, comprehensive documentation, and reproducible
616
  smoke training and evaluation pipelines, \UraionSpec provides a solid
@@ -622,7 +629,7 @@ inference.
622
  \paragraph{Future work.}
623
  Key directions for extending \UraionSpec include full-scale GPU training on
624
  the Open-PerfectBlend dataset, real engine throughput profiling for the
625
- scheduler, multi-GPU distributed training via DeepSpeed or FSDP, integration
626
  with production serving frameworks (vLLM, llama.cpp), and tree-based
627
  verification for autoregressive drafters~\cite{spectrindecoding}.
628
 
@@ -658,7 +665,7 @@ M.~Stern, N.~Shazeer, and J.~Uszkoreit.
658
  \newblock Blockwise parallel decoding for deep neural machine translation.
659
  \newblock \textit{arXiv:1811.03115}, 2018.
660
 
661
- \bibitem{xia2022medusa}
662
  H.~Xia, T.~Ge, S.-M.~Wang, S.-Q.~Chen, F.~Wei, and Z.-Y.~Shao.
663
  \newblock Medusa: Simple LLM inference acceleration framework with multiple
664
  decoding heads.
@@ -672,7 +679,7 @@ Y.~Miao, Z.~Bai, Z.~Wang, J.~Zhou, and J.~Jia.
672
  \bibitem{deepseekspec2026}
673
  DeepSeek-AI.
674
  \newblock DeepSpec: Production-grade speculative decoding for LLMs.
675
- \newblock \texttt{https://github.com/deepseek-ai/DeepSpec}, 2026.
676
 
677
  \bibitem{spectrindecoding}
678
  Y.~Zhou, N.~Du, Z.~Zhong, T.~Ji, and Y.~Yang.
@@ -682,17 +689,17 @@ Y.~Zhou, N.~Du, Z.~Zhong, T.~Ji, and Y.~Yang.
682
  \bibitem{dsparkalphaxiv}
683
  DeepSeek-AI.
684
  \newblock DSpark paper at alphaXiv.
685
- \newblock \texttt{https://www.alphaxiv.org/abs/2026.dspark}, 2026.
686
 
687
  \bibitem{uraionspechf}
688
  Uraion Labs.
689
  \newblock UraionSpec on HuggingFace.
690
- \newblock \texttt{https://huggingface.co/UraionLabs/UraionSpec}, 2026.
691
 
692
  \bibitem{uraionspecgh}
693
  Arnav Prabhu.
694
  \newblock UraionSpec on GitHub.
695
- \newblock \texttt{https://github.com/arnavprabhu/UraionSpec}, 2026.
696
 
697
  \end{thebibliography}
698
 
 
16
  % enumitem not available — using basic LaTeX lists instead
17
  % caption/subcaption not available — using basic figure handling
18
 
19
+ % Fix hyperref destination conflict with algorithm float
20
+ \makeatletter
21
+ \providecommand*{\theHalgorithm}{\thealgorithm}
22
+ \makeatother
23
+
24
  \geometry{margin=1in}
25
 
26
  % ---------- metadata for arXiv ----------
 
72
  verification that dynamically adjusts verification length based on predicted
73
  acceptance probabilities and engine throughput.
74
 
75
+ We present \UraionSpec, a clean, modular, verified implementation of
76
+ \DSpark. It faithfully reproduces the core
77
  components---the Markov and RNN sequential heads, confidence head, Sequential
78
+ Temperature Scaling~(STS) calibration, hardware-aware prefix scheduler
79
+ (Algorithm~1), and the three-term training objective---and includes a
80
+ \DFlash-style parallel backbone with target model KV injection as a
81
+ standalone module for integration into the draft model pipeline.
82
+ With 80 passing unit tests, a fully
83
  configurable training pipeline, comprehensive evaluation tools, and
84
  end-to-end smoke tests, \UraionSpec is designed for reproducible research
85
  and practical experimentation. The codebase is publicly available on
 
115
  (the \DFlash architecture) processes all proposal positions in a
116
  single forward pass, while a lightweight sequential head (Markov or RNN)
117
  injects inter-token dependency. This combines the speed of parallel
118
+ drafters~\cite{stern2018blockwise, xia2024medusa} with the quality of
119
  autoregressive ones~\cite{miao2025eagle3}.
120
  \item \textbf{Confidence-scheduled verification}: A trained confidence head
121
  predicts per-position acceptance probabilities, and a hardware-aware
 
127
  \paragraph{Our contribution.}
128
  We present \UraionSpec, a faithful, modular, and verified implementation of
129
  \DSpark. Our implementation includes all core components listed in the
130
+ original paper, and a standalone \DFlash-style parallel backbone with target model KV
131
+ injection module, available for future integration into the draft model pipeline.
132
  The codebase is designed for clarity and reproducibility rather than
133
  production scale, making it suitable for academic research, ablation studies,
134
  and educational purposes. Key features include:
135
 
136
  \begin{itemize}
137
  \item Complete implementation of all \DSpark components (80 unit tests)
138
+ \item \DFlash-style backbone module with target model KV injection
139
  \item Markov, gated Markov, and RNN sequential heads
140
  \item Confidence head with analytical acceptance-rate supervision
141
  \item Sequential Temperature Scaling (STS) calibration
 
162
  \label{eq:acceptance}
163
  \end{equation}
164
  and the first rejection marks the end of the accepted prefix. A bonus token
165
+ is then sampled from the target model's residual distribution at the rejection
166
  position, ensuring the final distribution matches the target model exactly.
167
 
168
  The expected number of accepted tokens $\tau$ is
 
240
  src/uraionspec/
241
  models/ -- Draft model components
242
  markov_head.py -- Low-rank transition bias
243
+ rnn_head.py -- GRU (Gated Recurrent Unit)-like recurrent head
244
  confidence_head.py -- Per-position acceptance predictor
245
  dflash_backbone.py -- DFlash backbone w/ KV injection
246
  draft_model.py -- Combined DSpark draft model
 
292
  apply, providing context-dependent transition modeling.
293
 
294
  \paragraph{RNN head.}
295
+ For full prefix history, we implement a GRU (Gated Recurrent Unit)-like recurrent head:
296
  \begin{align}
297
  z_k &= [s_{k-1} ;\; W_1[x_{k-1}] ;\; h_k], \\
298
  s_k &= \sigma(W_g z_k) \odot s_{k-1} + (1 - \sigma(W_g z_k)) \odot \tanh(W_c z_k), \\
 
400
  \caption{Hardware-Aware Prefix Scheduler (Algorithm~1)}
401
  \label{alg:scheduler}
402
  \begin{algorithmic}[1]
403
+ \State \textbf{Input:} confidence scores $\{c_{r,1}, \ldots, c_{r,\gamma}\}_{r=1}^R$, throughput curve $\SPS(B)$
404
  \State \textbf{Output:} verification lengths $\{\ell_r\}_{r=1}^R$
405
  \For{each request $r$}
406
  \State $a_{r,j} \gets \prod_{i=1}^j c_{r,i}$ \Comment{Prefix survival probs}
 
431
  request's verification length only happens when it adds the globally most
432
  valuable token. The early stopping condition guarantees the
433
  non-anticipating property --- the scheduler never extends a request's
434
+ length based on survival probabilities of future tokens, which cannot be
435
  known at the current step.
436
 
437
  A fallback \texttt{StaticScheduler} with fixed-length and static-threshold
 
464
 
465
  We validate the \UraionSpec implementation through unit tests, gradient
466
  checks, smoke training, and component-level verification. All experiments
467
+ were conducted on a MacBookPro12,1 (Intel i5-5257U, 7.8~GB RAM, CPU only)
468
  running Ubuntu~24~LTS, targeting the \text{Qwen/Qwen3-0.6B} model.
469
 
470
  \subsection{Unit Tests}
 
475
 
476
  \begin{table}[t]
477
  \centering
478
+ \small
479
  \caption{Unit test coverage by module. All 80 tests pass.}
480
  \label{tab:tests}
481
  \begin{tabular}{lcc}
482
  \toprule
483
  Test Suite & Tests & Coverage \\
484
  \midrule
485
+ Acceptance rule ($\min(1,\; p_t/p_d)$) & 8 & Full: all, rejected, partial,\\
486
+ & & bonus token, batch independence,\\
487
  & & expected length \\
488
+ Markov \& RNN heads & 15 & Vanilla, gated, RNN forward shapes,\\
489
  & & gradients, sampling \\
490
+ Scheduler & 14 & Throughput profile, Algorithm~1,\\
491
+ & & static fallback, zero conf. \\
492
+ Shape/gradient checks & 10 & Draft model, losses, conf. head,\\
493
  & & end-to-end cycle \\
494
+ STS calibration & 8 & ECE, temperature fitting,\\
495
+ & & fit/transform, calibrator API \\
496
+ DFlash backbone & 17 & Attention, decoder layer, full backbone,\\
497
  & & GQA, masks, gradient flow, edge cases \\
498
  Sampling utilities & 8 & Residual, greedy, temperature, gather \\
499
  \bottomrule
 
520
  \paragraph{DFlash backbone.}
521
  The \DFlash-style backbone passes all shape and gradient checks:
522
  \begin{itemize}
523
+ \item Forward pass produces correct output shapes for single/GQA (Grouped Query Attention)/masked
524
  attention configurations.
525
  \item Gradient flow verified through attention, decoder layer, and full
526
  backbone stack.
 
531
  \end{itemize}
532
 
533
  \paragraph{Training objective.}
534
+ The three-term loss (Equation~12 of the \DSpark{} paper) is verified through a smoke training run:
535
  \begin{itemize}
536
  \item 32 samples from the Capybara dataset, block size $\gamma=4$.
537
  \item All three loss terms (CE, TV, confidence) are non-negative and
 
560
  CPU-based smoke testing of \text{Qwen3-0.6B}. Full training and
561
  benchmarking on GPU hardware (e.g., Colab A100) is the natural next
562
  step.
563
+ \item \textbf{No vLLM integration}: Unlike the official \DeepSpec{}
564
  repository, \UraionSpec does not integrate with production serving
565
  frameworks. We prioritize algorithm clarity over production readiness.
566
  \end{enumerate}
 
571
 
572
  All code is publicly available under the MIT license:
573
 
574
+ \begin{itemize}
575
  \item \textbf{GitHub}: \url{https://github.com/arnavprabhu/UraionSpec}
576
  \item \textbf{HuggingFace}: \url{https://huggingface.co/UraionLabs/UraionSpec}
577
  \end{itemize}
 
611
  \label{sec:conclusion}
612
 
613
  We have presented \UraionSpec, a faithful, modular, and verified
614
+ implementation of the \DSpark{} speculative decoding algorithm. Our
615
  implementation covers all core algorithmic components---semi-autoregressive
616
  generation via Markov, gated Markov, and RNN sequential heads, confidence
617
  prediction with analytical supervision, Sequential Temperature Scaling
618
+ calibration, and the hardware-aware prefix scheduler (Algorithm~1).
619
+ We also provide a standalone \DFlash-style parallel backbone module with
620
+ target model KV injection, available for integration into the draft model pipeline.
621
 
622
  With 80 passing unit tests, comprehensive documentation, and reproducible
623
  smoke training and evaluation pipelines, \UraionSpec provides a solid
 
629
  \paragraph{Future work.}
630
  Key directions for extending \UraionSpec include full-scale GPU training on
631
  the Open-PerfectBlend dataset, real engine throughput profiling for the
632
+ scheduler, multi-GPU distributed training via DeepSpeed or FSDP~(Fully Sharded Data Parallelism), integration
633
  with production serving frameworks (vLLM, llama.cpp), and tree-based
634
  verification for autoregressive drafters~\cite{spectrindecoding}.
635
 
 
665
  \newblock Blockwise parallel decoding for deep neural machine translation.
666
  \newblock \textit{arXiv:1811.03115}, 2018.
667
 
668
+ \bibitem{xia2024medusa}
669
  H.~Xia, T.~Ge, S.-M.~Wang, S.-Q.~Chen, F.~Wei, and Z.-Y.~Shao.
670
  \newblock Medusa: Simple LLM inference acceleration framework with multiple
671
  decoding heads.
 
679
  \bibitem{deepseekspec2026}
680
  DeepSeek-AI.
681
  \newblock DeepSpec: Production-grade speculative decoding for LLMs.
682
+ \newblock \url{https://github.com/deepseek-ai/DeepSpec}, 2026.
683
 
684
  \bibitem{spectrindecoding}
685
  Y.~Zhou, N.~Du, Z.~Zhong, T.~Ji, and Y.~Yang.
 
689
  \bibitem{dsparkalphaxiv}
690
  DeepSeek-AI.
691
  \newblock DSpark paper at alphaXiv.
692
+ \newblock \url{https://www.alphaxiv.org/abs/2026.dspark}, 2026.
693
 
694
  \bibitem{uraionspechf}
695
  Uraion Labs.
696
  \newblock UraionSpec on HuggingFace.
697
+ \newblock \url{https://huggingface.co/UraionLabs/UraionSpec}, 2026.
698
 
699
  \bibitem{uraionspecgh}
700
  Arnav Prabhu.
701
  \newblock UraionSpec on GitHub.
702
+ \newblock \url{https://github.com/arnavprabhu/UraionSpec}, 2026.
703
 
704
  \end{thebibliography}
705