LLM fundamentals

Response prefilling

Also known as Response prefilling concept, LLM Response prefilling

By WeavePublished Updated 2 min read

Definition

Response prefilling supplies a partial assistant response as input so a compatible language model continues from that prefix.

How it works

On an interface that supports it, the final message is an assistant message containing only the beginning of the desired answer. The model generates the continuation rather than starting an entirely new response.

A classification application might supply the prefix "Category:" and ask the model to continue with one allowed label. A compatible API receives that prefix as assistant content. Putting the same words into a user instruction is a different technique.

Check model support

Support depends on the provider, model, and request format. Anthropic's Messages API documentation, checked October 9, 2026, says Claude 4.6 and later models reject a prefilled final assistant turn. Earlier compatible models can accept it. For models without this support, use instructions or structured outputs where available.

Test the exact request against every model your application can select. A routing fallback must also accept the format; otherwise a request that works on one route can fail on another.

Formatting and validation

A supplied prefix steers the beginning of an answer. It does not guarantee that the continuation has valid syntax or the right classification. Validate the completed response, including any supplied prefix, before passing it to another system.

Measure format errors and task accuracy alongside cost and latency. Use representative requests, including cases where the expected answer is ambiguous.

Response prefilling and prompt prefill

Response prefilling is a message-format technique. Inference prompt prefill is the computation that processes input tokens before generating an answer. Prompt caching can reuse eligible input computation. These terms describe different parts of a request.

How this relates to Weave

Weave Router selects models for coding requests. Include response prefilling in compatibility tests when your application uses it: confirm the selected model accepts the partial assistant turn, then compare completion quality and cost with a direct-model baseline.

Explore Router

Sources and further reading

  1. Anthropic: Using the Messages API
  2. Anthropic: Prompt caching
  3. Weave Router