AI Dictionary › AI Models

Context Length

Lunghezza del contesto

Context length is the maximum number of tokens a language model can receive and process in a single inference session, including both the input text provided and, often, the text the model generates in response. It is an architectural limit intrinsic to the model, decided and fixed during training.

Definition

How it works

This limit largely depends on the attention mechanism, whose computational and memory cost grows rapidly with the length of the processed sequence, since every token must potentially be compared against every other token in the sequence. Extending the context length beyond the values used in training requires specific techniques, such as positional encoding schemes designed to generalize beyond the lengths observed during training, or subsequent adaptations aimed precisely at expanding this limit.

Applications

It is a relevant parameter for every practical application of language models: it determines how much text, how much conversation history or how many documents can be included in a single request without resorting to retrieval or summarization techniques. Models with larger contexts can directly process entire documents, long conversations or large portions of source code in a single pass.

History & etymology

The term is closely linked to the more general concept of the context window, and its importance has grown alongside the spread of language models capable of handling ever-larger amounts of text without significant loss of coherence or accuracy.

Related terms

More in AI Models

Put it into practice

From our network

Kaimaki Web: Websites That Win Customers

Custom websites, web apps and digital marketing for growing businesses.

Visit kaimakiweb.com →

From the Agora Intelligence blog

More on agora-intelligence.com →

📱 Download the Android app (beta) iOS coming soon

Say what you mean. Get what you need.

Grace Certified, the AI coach that trains and certifies your prompt engineering, by Agora Intelligence.