Papers
Topics
Authors
Recent
Search
2000 character limit reached

Continuous Depth-wise Batching

Updated 6 May 2026
  • Continuous depth-wise batching is a dynamic inference paradigm that leverages weight-shared, recursive Transformers to batch processing across both token time and layer depth.
  • It employs early-exit mechanisms and FIFO scheduling to maximize accelerator utilization, yielding a 2–3× speedup in autoregressive token generation.
  • Empirical results on models like Gemma 2B demonstrate practical throughput gains, validating the efficiency of batching across both sequence and depth dimensions.

Continuous Depth-wise Batching (CDB) is a dynamic inference paradigm that leverages the parameter-tied (recursive) structure of Transformers to pipeline sequence processing not only in the conventional time (token) dimension, but also across model depth (layer iterations). CDB exploits repeated blocks within a recursive Transformer—enabled by weight sharing across layers—to maximize hardware utilization and reduce idle compute slots, achieving substantial improvements in throughput for autoregressive generation, especially when combined with early-exit mechanisms. When deployed in practice, CDB demonstrates a 2–3× increase in token-generation throughput relative to static, layer-distinct Transformers, subject to model configuration and early-exit dynamics (Bae et al., 2024).

1. Formal Definition and Mechanism

Continuous Depth-wise Batching operates in recursive Transformers constructed from a total depth LL, reorganized as BB looping blocks of size K=L/BK=L/B, with fk(h;Φk)f_k(h;\,\Phi'_k) denoting the kkth layer of a shared block. For token tt and layer index \ell, the forward pass is:

ht()=f((1)modK)+1(ht(1);Φ((1)modK)+1)h_{t}^{(\ell)} = f_{((\ell-1)\bmod K)+1}\left(h_{t}^{(\ell-1)};\,\Phi'_{((\ell-1)\bmod K)+1}\right)

CDB maintains, during runtime, up to NmaxN_{\max} active samples at each block-iteration stage j=1,,Bj=1,\ldots,B. For each compute step, up to BB0 samples in BB1 are processed in parallel by the corresponding shared block BB2. Freed slots are immediately filled with either survivors from deeper iterations or new requests entering at the initial block stage. This batched scheduling occurs in both time (token) and depth (block iteration) dimensions and maximizes accelerator utilization for each block function (Bae et al., 2024).

2. Scheduling: Pseudocode and Operational Overview

A high-level scheduling procedure for CDB paired with early-exiting utilizes BB3 separate FIFO queues, one per block iteration. At each scheduler tick, a batch is formed (up to BB4) for each queue, the shared block BB5 is applied, and samples either exit (if the early-exit criterion is satisfied) or proceed to the next block. New requests enter at the first block whenever there is available capacity. The general scheduler pseudocode is:

fk(h;Φk)f_k(h;\,\Phi'_k)1

Key features include up to BB6 simultaneous batches (one per block), flexible early-exiting, and backfilling to maintain throughput. Batching is conducted across samples invoking the same block parameters, which is feasible only in weight-sharing architectures (Bae et al., 2024).

3. Theoretical and Empirical Throughput Gains

CDB’s effectiveness is quantified against two baselines: static synchronous batching and continuous sequence-wise batching (CSB):

  • Static batching: All BB7 slots process in lock-step with throughput BB8.
  • CSB: Batching across token sequences at the same block depth, empirically yielding a speedup BB9 (e.g., Gemma 2B: 1080 tok/s → 1528 tok/s).
  • CDB: Enables K=L/BK=L/B0-fold depth-wise pipeline; for K=L/BK=L/B1 and K=L/BK=L/B2, this yields a theoretical K=L/BK=L/B3 speedup.

With early-exit, if the mean exit depth is K=L/BK=L/B4, the depth-wise pipeline is shortened, and the effective speedup approaches K=L/BK=L/B5. For example, with Gemma 2B and K=L/BK=L/B6, the observed throughput was K=L/BK=L/B7 tok/s, corresponding to a K=L/BK=L/B8 speedup (Bae et al., 2024).

4. Experimental Configurations and Results

Key configuration details include:

  • Models evaluated: Gemma 2B (18 layers, 2 blocks of 9), TinyLlama 1.1B (22 layers, 2 blocks of 11), Pythia 1B (16 layers, 2 blocks of 8).
  • Batch size: K=L/BK=L/B9.
  • Early-exit criterion: Confidence score (e.g., max-token log-probability) checked after each block iteration; oracle simulations provided idealized throughput.
  • Hardware profiling: V100/A100 GPU, per-block timing denoted by fk(h;Φk)f_k(h;\,\Phi'_k)0.
  • Token-generation throughput (Gemma 2B, SlimPajama/RedPajama/PG19):
    • Stat
Definition Search Book Streamline Icon: https://streamlinehq.com
References (1)

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Continuous Depth-wise Batching.