Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Modal 4 min read Announcement mediumAdept

Boost your throughput with dynamic batching

Modal added a `@modal.batched()` decorator that groups incoming requests into batches flushed when either `max_batch_size` is reached or `wait_ms` elapses, avoiding the unbounded waits of fixed-size batching. Batching helps GPU inference because model weights (over 6 GB for Whisper large v3) must be moved from memory to compute units per pass, and inference is usually memory-bandwidth bound. On an A10G, batching Whisper with a max batch size of 64 raised throughput from about 1.2 to 3.3 requests per second per container, cutting inference cost by roughly 65%. The function only needs to accept and return lists.

Related posts

  • Benchmarking Text Generation Inference

    Hugging Face mediumAdept

    Text Generation Inference ships a benchmarking tool that profiles LLM serving across batch sizes, plotting throughput against latency separately for prefill and decode so deployments can be tuned for a workload such as RAG or chat. Using a duplicable Hugging Face Space bundling TGI with JupyterLab, the walkthrough shows how to read the charts. Vertical regions mean added batch size buys throughput at no latency cost. Horizontal regions mean the server is compute bound: in the example, decode latency stayed flat near 5.3s up to batch 32, while prefill beyond 32 doubled TTFT with no throughput gain. The recommended loop is to benchmark on hardware matching production, adjust TGI launch settings, and repeat, checking real user token patterns in TGI logs.

  • Prefill and Decode for Concurrent Requests - Optimizing LLM Performance

    Hugging Face mediumAdept

    LLM token generation splits into a compute-bound prefill phase, which processes all prompt tokens in parallel to produce the first token, and a memory-bandwidth-bound decode phase, which produces later tokens one at a time. These map to time to first token and time per output token. Static batching leaves the GPU underutilized and delays new requests. Prefill-first continuous batching (vLLM, TGI) minimizes time to first token but pauses running decodes. Chunked prefill interleaves prefill chunks with decode steps, trading a small time-to-first-token increase for smoother decoding. At TNG it raised total throughput by about 50%, and the default chunk size is recommended when load patterns are unpredictable.

  • Autoscaling endpoints for LLM inference

    Together AI mediumAdept

    LLM serving breaks classic autoscaling assumptions. GPU utilization misrepresents load, and multi-minute cold starts mean scaling has to act on leading signals. Together AI's dedicated endpoints scale proportionally (ceil(N × observed/target)) on inference-native metrics such as in-flight requests, TTFT, GPU or token utilization, and throughput, with an eager scale-up window and a patient scale-down window to avoid sawtooth cold starts. In a replayed sine-plus-spike load on Qwen3.5-9B/H100, only inflight_requests (target 8) triggered scaling. TTFT p95 and GPU utilization policies never fired despite 3–5s client p95, because continuous batching hides queue pressure from first-token latency. Measured cold starts of roughly 1.5–2.5 minutes argue for keeping min_replicas headroom on SLO-bound endpoints.

  • Configuring Dedicated Model Inference

    Together AI mediumAdept

    Together AI's Dedicated Model Inference separates a stable endpoint name, disposable deployments (model revision + config + autoscaling replicas), and immutable config revisions that specify engine, GPU type/count, parallelism and a latency/throughput/balanced profile. Traffic splits use per-replica weights, so routing follows effective capacity (weight × ready replicas): autoscaling shifts traffic automatically, and unready deployments receive none. A live test with two H100 deployments matched expected shares (69.4/30.6 measured vs 66.7/33.3 expected after scaling one deployment to two replicas). A concurrency sweep showed one profile scaling to 1,464 tok/s at c=16 while another, faster at c=4, saturated and halved its throughput, which makes the case for load-testing configs at realistic concurrency.

  • Open-weight models are fast on Neon AI Gateway. Here's why

    Neon mediumAdept

    Neon AI Gateway serves open-weight models through Databricks Foundation Model APIs, so it gets that stack's inference optimizations: continuous batching with PagedAttention-style KV-cache paging and overlapped prefill/decode, a TensorRT-LLM backend with fused and GroupGEMM kernels for MoE, tensor parallelism, FP8 quantization, and per-GPU tuning. Prompt caching matters most for agent loops that resend a stable system prompt and tool schema. On gpt-oss in a production batch pipeline it raised per-replica input-token throughput 2.5× and cut P50 latency 3× at a ~30% hit rate. FP8 on H100 gave about 2.2× throughput over FP16. To benefit, keep prompt prefixes stable and point an OpenAI-compatible SDK at the gateway.

The quest for software engineering knowledge.

Look:
Layout: