Building continuous-batching LLM runtimes, Paged KV-cache memory allocators, sub-byte bit-packers, and empirical serving benchmarks from first principles.
Hardware-Measured Runtimes · Honest Benchmarks · Client-Side Interactive Studios
Empirical roofline modeling, zero-copy physical block gathering, and verified cryptographic provenance.
Portfolio Health: 529 tests passed, 0 failed (6 skipped) in CI across 9 core repositories.
All studios are deployed as permanent, zero-cold-start static web applications on Hugging Face Spaces (sdk: static) with interactive client-side execution:
| Studio | Space Link | Interactive Capabilities |
|---|---|---|
streamspec |
prajwalpujari16/streamspec | Speculative Layer-Streaming Studio: Live memory bus Gantt simulator (AirLLM 1-token crawl vs StreamSpec batched GEMM), double-buffered prefetch pipeline inspector, and Williams Roofline capacity CAD. |
token-atlas |
prajwalpujari16/token-atlas | Multilingual Token Inflation Tax Explorer: 52-language FLORES-200 inflation matrix & token fertility multipliers (published benchmark: GPT-4 and GPT-4o), multi-domain benchmarks, and cost router. |
infersize |
prajwalpujari16/infersize |
LLM Capacity Planning CAD: Pre-flight analytical VRAM sizing, multi-GPU comparison matrix, speculative decoding latency sizer, and optional cost calculation when --rate is provided. |
quantbench |
prajwalpujari16/quantbench | Sub-Byte Quantization Studio: measured quality-vs-compression Pareto frontier (Qwen2.5-0.5B, RTX 3050), live BitNet 1.58b / INT4 / 2:4 sparsity bit-packing registers, and measured per-layer sensitivity. |
sched-sim |
prajwalpujari16/sched-sim |
Discrete-Event Serving Scheduler: Animated Gantt player demonstrating Head-of-Line prefill blocking vs. Sarathi Chunked Prefill ( |
mini-infer |
prajwalpujari16/mini-infer | PagedAttention GPU Memory Pool: Interactive virtual block table allocator, copy-on-write radix prefix caching simulator, and speculative decoding acceptance verifier. |
runsonmine |
prajwalpujari16/runsonmine |
Measured Consumer Silicon LLM Registry: 8 validated result files (24 concurrency rows) on Dual Tesla T4 & RTX 3050 Laptop, concurrency scaling curves ( |
| Dataset | Hub Link | Verified Contents |
|---|---|---|
token-atlas-benchmark |
prajwalpujari16/token-atlas-benchmark | 52-language FLORES-200 benchmark & token inflation metrics for GPT-4 and GPT-4o. |
quantbench-pareto |
prajwalpujari16/quantbench-pareto | 7 configurations measured on Qwen2.5-0.5B (RTX 3050): SQNR, size, VRAM, perplexity and decode speed, plus 28 per-layer sensitivity rows. |
llm-serving-traces |
prajwalpujari16/llm-serving-traces | 165 workload traces (synthetic + hand-written samples), 15 simulated scheduler comparisons, and 15 real-vs-simulated validation rows (RTX 3050). |
consumer-silicon-benchmarks |
prajwalpujari16/consumer-silicon-benchmarks | 8 validated result files (24 concurrency rows) on Dual Tesla T4 & RTX 3050 Laptop. |
# 1. Profile local server capacity (Ollama, vLLM, llama.cpp) with automated roofline tuning
pip install servebench && servebench quick
# 2. Pre-flight analytical capacity planning & multi-GPU matrix (no GPU needed)
pip install infersize && infersize compare --model qwen2.5-7b --quant fp16
# 3. Continuous-batching inference runtime with Paged KV-cache (pure PyTorch, zero C++ build steps)
pip install mini-infer
# 4. Discrete-event serving simulator with Radix prefix caching & chunked prefill
pip install sched-sim && sched-sim run --scheduler chunked --token-budget 512
# 5. From-scratch quantization engine & Pareto evaluation benchmark (INT4/INT8/FP8/BitNet 1.58b)
pip install quantbench-engine && quantbench pack-inspect --format int4
# 6. Multilingual token inflation tax analyzer across 52 languages
pip install token-atlas-engine && token-atlas compare --text "Hello world"
# 7. Asynchronous Speculative Layer-Streaming for 70B & DeepSeek-R1 on consumer VRAM
pip install streamspec && streamspec demo| Flagship | Core Architecture | Empirical Silicon Numbers | Release & Provenance |
|---|---|---|---|
| streamspec | Asynchronous Speculative Layer-Streaming engine for 70B & DeepSeek-R1 models on consumer VRAM (8–16 GB). Fast in-memory draft scout (0.5B), double-buffered async prefetcher (>90% bus overlap), zero-extra-sweep round optimization, online dynamic adaptive K controller, single-pass batched GEMM sweeps, Multi-Head Latent Attention (MLA) latent KV compression, and exact Leviathan distribution verification. | • 1.85x fewer weight sweeps (Qwen2.5 1.5B + 0.5B draft, measured) • 93.9% prefetch overlap (measured, CUDA) • ~7x MLA KV reduction (test config) • 14/14 tests pass (100%) |
|
| mini-infer | Lightweight continuous-batching LLM runtime in pure PyTorch for Qwen2.5. Iteration-level dynamic scheduler, Paged KV-cache with sub-byte INT4/FP8 compression, radix prefix caching, and Leviathan speculative verifier. | • 27.0 tok/s at c=4 vs 11.7 before batching (RTX 3050, 12 requests/level) • 2.04 Tok/Joule (13.2 W) • -72.7% KV-cache size with INT4 (calculated) • 70/70 tests pass (100%) |
|
| servebench | LLM serving capacity load-tester, auto-tuning harness (servebench tune), and RunsOnMine result collector (servebench submit). Multi-trial repeats with 95% CIs and synchronized NVML GPU telemetry. |
• Warns when p99 rests on <100 samples • MBU roofline profiling • Slot/Queue/Bandwidth diagnostics • 170/170 tests pass |
|
| quantbench | Unified from-scratch quantization engine (INT4/INT8/FP8/BitNet 1.58b), vectorized sub-byte packing, Ampere 2:4 structured sparsity, dynamic QuantLinear layers, and dual-metric Pareto evaluation benchmark. |
• INT4: 2.08x smaller on Qwen2.5-0.5B (+21% perplexity, measured) • 3.5x INT4 per layer (theoretical) • 47 pass · 6 skipped (95% cov) |
|
| sched-sim | Discrete-event LLM serving simulator with first-principles roofline latency models, SGLang-style Radix prefix caching, Sarathi chunked prefill, and Perfetto trace visualizer. | • Held-out validation on real runs: TPOT within ±12% on 6/7 Ollama rows • TTFT prediction still off for larger models (results) • 45/45 tests pass (87% cov) |
|
| infersize | Pre-flight analytical performance modeling, multi-GPU comparison matrix, speculative decoding sizer, and optional unit cost with explicit --rate input. Interactive Web Studio, NVML hardware fit verifier, and dynamic Hugging Face Hub ingestion. |
• ~10–20 ms per comparison on a laptop CPU • Leave-one-out error < 15% on 3 RTX 3050 Ollama models • 60/60 tests pass (89% cov) • No GPU required |
|
| token-atlas | Universal multilingual tokenizer efficiency benchmark & global linguistic inflation atlas. Analyzes 52 languages, multi-domain benchmarks (Code, Indentation, Tool Schemas), cost router, and prompt minifier. | • 52 languages analyzed • GPT-4 & GPT-4o in published benchmark • 43/43 tests pass (94% cov) • 0ms interactive playground |
|
| runsonmine | Community database of measured (not estimated) LLM inference speeds on real consumer silicon (laptops, desktops, Macs). | • 8 result files (24 concurrency rows) across 2 GPUs • 26/26 tests pass |
|
| EdgeSLM | Air-gapped document sensitivity classifier and Tier-1 DLP secret scanner for edge CPU inference. | • 26 HF downloads (v3, all-time) • 6.7× dynamic batching • 51/51 tests pass (100%) |
Production bugfixes and architectural patches merged into leading LLM SDKs, inference engines, and quantization runtimes:
- ModelCloud/GPTQModel:
- #5175 — Bounded token-row activation capture and streaming reservoir for AWQ & ParoQuant, eliminating linear host RAM explosion during calibration (#5137).
- #4399 — Omitted forced
offload_state_dictto prevent unintendedTMPDIRdisk copies during model loading (#4385). - #4145 — Preserved Bloom AWQ module forward replay inputs (
residual,alibi,mask) and reject unsafe norm folds. - #4142 — Scoped deterministic PyTorch algorithms in GPU weighted k-means (VPTQ).
- #4096 — Repaired
hf_repack_layerandhf_pack_layerGPTQ v1 qzero bit-packing alignment. - #4029 — Standardized multi-EOS stop lists, tokenizer output unpacking, and OpenAI/vLLM request parsing.
- mozilla-ai/any-llm:
I believe that engineering credibility is built by documenting trade-offs, architectural failures, and hardware bounds alongside performance gains:
-
Naive KV-Allocation Fails Under Dynamic Lengths:
Pre-allocating contiguous buffers for a 2,048-token worst case reserves 24 MB of KV cache per request on Qwen2.5-0.5B (bf16), even for a 48-token reply. Fixed 16-token physical block pools with virtual-to-physical block tables in pure PyTorch allocate memory as sequences grow: about 0.56 MB for that reply, 97.7% less (calculated from tensor sizes). -
Unbatched Iteration Bottlenecks on DRAM Memory Bandwidth:
Stepping concurrent sequences through serial model calls forced the GPU to stream model weights from DRAM 4 separate times per step (capping decode at 11.7 tok/s on an RTX 3050). Switching to zero-copy physical block gathering streams weights exactly once per step across all sequences, jumping throughput to 27.0 tok/s (+130.8%) and delivering 2.04 Tok/Joule. -
Head-of-Line Prefill Starvation Under Continuous Batching:
In FCFS continuous batching, a long prompt's prefill takes over whole steps, so active decoding streams stall. In asched-simsimulation (A100 preset, RAG workload), Sarathi-style Chunked Prefill ($C=512$ ) cut worst-case decode latency (TPOT p99) from 131.7 ms to 51.7 ms versus FCFS, while the median rose from 39.2 to 49.6 ms: smoother decoding, not faster decoding (simulated, not measured). -
Memory Savings Are Not Speed Savings Without Fused Kernels:
On Qwen2.5-0.5B (RTX 3050),quantbenchINT4 shrank the model from 958 MB to 461 MB but raised perplexity +21% and ran at 0.18x bf16 speed, because the reference runtime dequantizes full weights every forward pass. Post-hoc ternary quantization destroyed the model entirely. Bandwidth savings need fused dequant-matmul kernels. -
No Cherry-Picked Latency Metrics:
Single-run p99 latency spikes are statistically deceptive without sufficient sample size.servebenchwarns when a p99 rests on fewer than 100 requests (it then approximates the sample maximum), and reports 95% confidence intervals across multi-trial repeats.
- The Hidden Token Tax: Why Multilingual LLM APIs Cost Up to 4.5× More (
2026-11-13)
Why non-English prompts face extreme Byte-Pair Encoding fragmentation, how 4-space Python and JSON tool schemas add 2.6× token bloat, and how modern tokenizers (Qwen, Tekken, DeepSeek) rebalance API economics across 52 languages. - Roofline Benchmarking & Auto-Tuning LLM Serving: How We Pushed Pure PyTorch to 27 tok/s (
2026-10-23)
Measuring empirical Memory Bandwidth Utilization (MBU), saturation knees, and multi-stream batching to eliminate TTFT degradation on consumer laptop GPUs. - Why Naive KV-Caches Waste >60% VRAM (And How Paged Memory Fixes It) (
2026-10-22)
How replacing contiguous memory allocations with 16-token physical blocks and virtual table mapping brings production PagedAttention to pure PyTorch.
Runtime Systems : Paged KV-Cache Allocators · Continuous Batching · Radix Prefix Caching · Speculative Decoding · Discrete-Event Simulation
Silicon Profiling : Roofline MBU Modeling · NVML Telemetry · Saturation Knee Detection · TTFT / ITL / TPOT Analysis
Core Stack : PyTorch (SDPA, Tensor Gathers) · Python 3.10+ · CUDA / NVML · ONNX Runtime INT4 · Hugging Face
Quantization : Symmetric AbsMax · INT4 Blockwise · BitNet 1.58b Ternary · Ampere 2:4 Structured Sparsity · SmoothQuant · AWQ / GPTQ
Serving & Infra : FastAPI · Asyncio / Aiohttp · SSE Streaming · vLLM · Ollama · Docker · GitHub Actions CI/CD
Security & Trust : PyPI Trusted Publishers (OIDC) · Sigstore Cryptographic Attestation · Zero-Secret Airgap DLP
- Portfolio Website: prajwal-pujari.vercel.app
- Hugging Face Hub: huggingface.co/prajwalpujari16
- PyPI Packages: pypi.org/user/Prajwal2002PI
- LinkedIn: linkedin.com/in/prajwal-pujari-mn9964
- Email: prajwalpujari16@gmail.com


