Continuous batching with paged KV: a dependency-free CUDA throughput path
Ran Tao (Octoryn Research)
摘要
A dependency-free CUDA inference path (no vendor BLAS/DNN/TLAS libraries) adds paged KV caching (a global block pool with per-(layer, sequence) block tables, allocate-on-demand and free-on-exit) plus iteration-level continuous batching. On an idle consumer GPU, batched per-stream argmax output is byte-identical to single-stream decode across small batch and block sizes, and aggregate throughput modestly exceeds single-serial decode. Aggregate is NOT linear in batch and was not benchmarked against an external serving system. This is a correctness smoke test on a layer subset, not a benchmark.
本 Research Object 以其原始语言(英文)发表。
1. Contribution
Claimed. A dependency-free CUDA inference path (no vendor BLAS/DNN/TLAS libraries) implements two throughput mechanisms: paged KV caching (a global block pool with per-(layer, sequence) block tables, blocks allocated on demand and freed on sequence exit) and iteration-level continuous batching (an active set of B sequences run through one batched forward pass, with dynamic exit and block free). On an idle consumer GPU, batched per-stream argmax output is byte-identical to single-stream decode across small batch sizes and several block sizes, and aggregate throughput modestly exceeds single-serial decode.
NOT claimed. This is a correctness-and-engineering validation, not a novel algorithm and not a benchmark-scale throughput result. It does NOT claim linear-in-batch scaling (aggregate stays roughly flat in batch because expert dispatch and the quantized projections still loop per row, leaving per-iteration cost weight-bound). It does NOT claim parity with an external serving system's absolute throughput. It does NOT claim a full-model aggregate number — the test machine holds only a layer subset resident. Argmax parity is a correctness property; it says nothing about generation quality.
2. Methods
| Field | Value |
|---|---|
| Hardware | Idle consumer-class NVIDIA GPU with limited (single-digit GB) device memory |
| Stack / libraries | Dependency-free CUDA path; the CUDA runtime plus system libraries only — no vendor BLAS/DNN/TLAS libraries |
| Baseline | Single-stream (serial) decode in the same engine; an external high-throughput serving system was the conceptual target but was not run here |
| Procedure | Paged KV: global block pool plus per-(layer, sequence) block tables, allocate-on-demand and free-on-exit; a dedicated scatter-write step and a batched paged-attention decode step gather each sequence's KV via its block table. Continuous batching: iteration-level scheduler runs B active sequences through one batched forward (QKV/output projection over B rows, a single batched paged-attention launch, per-sequence router and dispatch). Reuses a resident quantized-int4 weight bank. |
| Precision | fp32-stable softmax in paged attention; resident weights quantized to int4 |
| Metric + gate | Per-stream argmax exact-match versus single-stream (gate: 100% match); aggregate tokens/sec versus single-serial |
| Stimulus / inputs | Small batch sizes crossed with several block sizes; per-config token counts not individually enumerated beyond exact-match totals |
3. Results
| Configuration | Measurement |
|---|---|
| Parity, small batch sizes x several block sizes | Per-stream argmax 100% match versus single-stream |
| Aggregate versus single-serial | Roughly 1.3-1.4x on every run |
| Aggregate tokens/sec (flat in batch) | Low-three-figure tokens/sec; aggregate stays roughly flat while serial divides per stream |
| Sovereignty check | CUDA runtime plus system libraries only; no vendor BLAS/DNN/TLAS libraries |
4. Threats to validity / Limitations
- Sample size is a correctness smoke test, not a benchmark. Parity is measured over a handful of batch-by-block configurations on short decode runs. This validates byte-identical output, not throughput at benchmark scale or under realistic mixed-length traffic.
- Single-run perf, no variance. The speedup and tokens/sec figures are reported as ranges across configs with no repeated trials, confidence intervals, or variance — they are point observations on an idle GPU.
- Parity is not quality. Argmax exact-match proves the batched/paged path reproduces the single-stream decode bit-for-bit; it says nothing about generation quality or downstream task performance.
- Scope / scaling ceiling is acknowledged. Aggregate is explicitly NOT linear in batch — expert dispatch and the quantized projections loop per row, so the path is weight-bound. The headline framing must be read against this: no external serving system was run, so the comparison is directional, not measured.
- Quantization / hardware bound. Results hold for the resident int4 weight bank on a single-digit-GB consumer GPU holding only a layer subset. Full-model aggregate is unmeasured and requires a substantially larger device-memory budget.
- Oracle/baseline weakness. The baseline is the engine's own single-stream path, which makes parity self-consistent but provides no external throughput reference for the throughput claim.
5. Reproducibility / Provenance
- Build: compiled with the CUDA toolchain targeting the consumer GPU's architecture, optimized C++17 build.
- Version pins (CUDA toolkit, driver, model shard): not recorded.
- Procedure pins (high level): paged KV via a global block pool plus per-(layer, sequence) block tables with allocate-on-demand/free-on-exit; a dedicated scatter-write step and a batched paged-attention decode step with fp32-stable softmax; continuous batching via an iteration-level scheduler over B active sequences; a resident int4 weight bank reused across the path.
- Sovereignty check: confirm the linked libraries report the CUDA runtime plus system libraries only (no vendor BLAS/DNN/TLAS libraries) before trusting the dependency-free claim.
- Next levers (not yet done): batched expert GEMM over active rows, prefill chunking, admission control; full-model aggregate on a larger-memory device.
声明边界
作者对范围的明确界定——本工作证明了什么、未证明什么——沿用自 Octoryn Research 的发表模型。
证明
- A dependency-free paged-KV plus iteration-level continuous-batching path produces per-stream output byte-identical to single-stream decode (argmax 100% match across the tested small batch and block sizes).
- On an idle consumer GPU, aggregate throughput modestly exceeds single-serial decode.
未证明
- Linear-in-batch scaling: per-row dispatch and quantized projections leave the path weight-bound, so aggregate stays roughly flat in batch.
- Parity with an external serving system's absolute throughput: no external system was run, so any such comparison is directional only.
- Full-model aggregate throughput: the test machine holds only a layer subset resident.
- Generation quality or throughput at benchmark scale: parity is argmax correctness over a few short configurations, a smoke test not a benchmark.
- Variance or repeatability of the performance figures: they are single-run point observations with no confidence intervals.
适用于
- Batched decode of a layer subset on an idle consumer GPU using a resident quantized-int4 weight bank, at small batch and block sizes.
不适用于
- Linear-scaling or external-system parity throughput claims, or full-model aggregate on the test machine.
- Benchmark-scale or mixed-length traffic, or any generation-quality claim.
- Hardware or memory budgets beyond the idle consumer-GPU layer-subset setup, or non-quantized weight paths.
作者
- Ran Tao — 调查研究, 写作
引用本文
引用格式
Tao, R., Octoryn Research. (2026). Continuous batching with paged KV: a dependency-free CUDA throughput path (TR-2026-0019). Octopus Research Institute.
BibTeX
@techreport{oritr20260019,
title = {Continuous batching with paged KV: a dependency-free CUDA throughput path},
author = {Tao, Ran and {Octoryn Research}},
institution = {Octopus Research Institute},
year = {2026},
note = {Permanent ID TR-2026-0019. Not peer reviewed.}
}披露
- 资助
- 硬件与基础设施由 Octoryn / Octopus Core Pty Ltd 提供。
- 利益冲突
- Octoryn 提供商业推理与治理工具;相关发现独立报告。
