Long-Context Inference

Adrian Tam · 2026年11月28日

Overview This post is divided into four parts; they are: • The Cost of a Long Context • Chunked Prefill • Managing Long-Lived KV State • Selecting Useful Context The Cost of a Long Context For full causal attention over a prompt of $N$ tokens, prefill attention computes a triangular portion of an $N \times N$ score matrix.

继续阅读全文

为了尊重作者,这里只展示开头几段。你可以去原文阅读,或者在 HorizonReader 里读:划线做笔记、让 AI 帮忙。

更多来自 Machine Learning Mastery

Anatomy of an LLM Serving Engine

Overview This post is divided into four parts; they are: • The Request Path • A Minimal Asynchronous Engine • Cancellation, Backpressure, and Failure • Metrics and Production Interfaces The Request Path A text-generation workflow from reque

LLM Inference Engineering Roadmap

Decode sits on the left.

Building an MCP Client in Python from Scratch

In this article, you will learn how to build a working MCP client in Python with the official MCP Python SDK 2.0, connect it to...

Building a Multi-Agent Verification Loop in Python with Small Open Models

In this article, you will learn how to build a Proposer-Critic-Judge verification loop in Python with a single small open model, and how to measure...

Prefix Caching and Prompt Reuse

Overview This post is divided into five parts; they are: • Reusing Prefill Work • Finding the Longest Cached Prefix • Block Hashes, Radix Trees, and Compatibility • Designing Prompts for Reuse • Capacity and Measurement Reusing Prefill Work