Skip to content

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

Together AI 12 min read Deep dive mediumAdept

Making open models work for long-horizon agentic workloads

Agentic coding workloads resend the whole growing transcript each turn while emitting short tool calls, so they are prefill-dominated and depend on prefix caching, which only reuses work up to the first changed token. On the harness side that means keeping the system prompt and tool list identical, appending late-loaded tool definitions at the end, fixing reasoning effort for the session, truncating tool output with explicit range markers, and choosing between inheriting context or sending briefs to subagents. On the engine side it means cache-aware and load-aware routing (prompt_cache_key or longest-prefix hashing), offloading idle caches to CPU memory, PagedAttention and continuous batching, and disaggregated prefill/decode clusters linked over RDMA. Cache memory headroom, not compute, usually limits concurrency, so both sides must cooperate to keep long sessions fast.

Related posts

  • Continuous batching from first principles

    Hugging Face mediumAdept

    Continuous batching falls out naturally once you optimize LLM serving for throughput, and the post derives it step by step from attention, causal masking, KV caching and chunked prefill. The KV cache cuts the cost of generating each new token from O(n²) to O(n) at O(n) memory, about 16 KB per token per layer for Llama-2-7B in float16. Chunked prefill splits long prompts across forward passes. Padded batched generation wastes compute when prompts finish at different times, and dynamic batching needs heavy padding because newly inserted prompts must prefill while others decode, which motivates continuous batching's mixing of prefill and decode tokens in one forward pass.

  • ThunderAgent: 2x Faster Agentic Inference for Synthetic Data Generation at Scale

    Together AI hardMaster

    ThunderAgent is a scheduling layer between agent clients and inference backends that treats each multi-turn agentic workflow as a schedulable program instead of independent requests, preventing KV cache thrashing when agents pause for tool calls. Under memory pressure it pauses low-priority programs to raise cache hit rates, then resumes them via a global waiting queue onto the node with the most free capacity, replacing static session pinning. On one 8×H100 node with HiCache at batch 192 it reached 803 vs 390 tokens/s for SGLang, with mean latency cut from 65s to 10.6s. Across 2 to 8 nodes it scaled near-linearly and outperformed SGLang Gateway by up to 2.39×, requiring only a program_id field on OpenAI-compatible requests.

  • Cache-aware prefill–decode disaggregation (CPD) for up to 40% faster long-context LLM serving

    Together AI hardMaster

    Cache-aware prefill–decode disaggregation (CPD) extends standard PD serving with a dedicated pre-prefill tier for low-reuse (cold) long prompts, a router that estimates prefix-cache reuse per request, and a three-level KV cache hierarchy (GPU memory, host DRAM, RDMA-connected distributed cache). Cold prefills compute new context and write KV state to the distributed cache, so warm requests on normal prefill nodes fetch KV blocks instead of queueing behind multi-second prefills. On B200 GPUs with a synthetic coding-agent workload, CPD raised sustainable throughput from about 0.75–0.8 to 1.1–1.15 QPS per GPU (~40%) and kept median TTFT far lower near saturation, without worsening p90 tail latency. The gains come from scheduling and cache reuse on the prefill path, not faster model execution.

  • 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.

  • How Long Prompts Block Other Requests - Optimizing LLM Performance

    Hugging Face hardMaster

    Under vLLM's default chunked-prefill scheduling, a single long prompt blocks the prefill queue, and any prefill running alongside decodes slows token generation for requests already in progress. The queue-blocking problem is largely solved by vLLM's newer parallel partial prefills, which batch several requests' prefills while capping how many long prompts run concurrently, cutting time-to-first-token for short requests. The decode slowdown is more fundamental. TNG compares three mitigations from running 24 H100s: deprioritizing long prompts, routing them to a separate server, and disaggregated prefill. Disaggregated prefill isolates decodes best but needs a second full deployment, leaves GPUs unevenly utilized, and is still experimental in vLLM.

The quest for software engineering knowledge.

Look:
Layout: