Formula for Fixed-Size Window Memory
To construct the memory component, denoted as , in a fixed-size window attention mechanism, a continuous subset of the most recent key and value vectors is extracted. Specifically, this slice spans from index up to the current processing step , with defining the capacity of the context window. The relationship is mathematically expressed as: .

0
1
Tags
Ch.2 Generative Models - Foundations of Large Language Models
Foundations of Large Language Models
Foundations of Large Language Models Course
Computing Sciences
Related
Formula for Fixed-Size Window Memory
Window-based Cache as an Example of Fixed-Size Memory
Space Complexity of Sliding Window Attention
Window Size (n_c)
A language model is designed to process extremely long sequences of text, and its developers are concerned about computational resources. They are considering two approaches for the attention mechanism: one that considers all previous tokens in the sequence, and another that only considers a fixed-size window of the 100 most recent tokens. What is the fundamental trade-off between these two approaches?
Applying Sliding Window Attention
In an attention mechanism that uses a fixed-size sliding window, the amount of memory required to store the keys and values for the attention calculation increases as the input sequence gets longer.
Your team is documenting the memory subsystem of a...
You are reviewing two candidate memory designs for...
You’re deploying an internal LLM assistant that mu...
You’re designing an internal LLM feature that moni...
Post-Incident Review: Memory Design for Long-Running Customer Support Chats
Diagnosing Long-Range Failures in a Segment-Processed LLM with Dual Memory
Choosing a Memory Architecture for Long-Context Enterprise Summarization
Postmortem: Long-Document QA Failures Under Fixed-Window vs Compressive Memory
Selecting and Justifying a Long-Context Memory Design for a Regulated Audit Assistant
Incident Triage: Long-Running Agent Workflow with Windowed vs Compressive Memory
Formula for Fixed-Size Window Memory
Suppose you have a sequence of key vectors represented as rows in a matrix, where , , , , and . Given a processing step at index and a context window size of , which matrix is constructed by selecting the contiguous block of key vectors ending at the current step?
Properties of a Sliding Window Key Matrix
True or False: For a sequence of key vectors being processed at index with a context window size of , the resulting sub-matrix of key vectors, denoted , will contain the key vectors from index 5 to index 10 (i.e., ).
Formula for Fixed-Size Window Memory
Consider a sequence of 2-dimensional value vectors, where:
- v_1 = [10, 11]
- v_2 = [12, 13]
- v_3 = [14, 15]
- v_4 = [16, 17]
- v_5 = [18, 19]
Given a current processing index of i = 5 and a context window size of nc = 3, which matrix below correctly represents the structure formed by vertically stacking the value vectors from the corresponding sliding window, from index i - nc + 1 to i?
Inferring Window Parameters
Determining Matrix Dimensions from a Sliding Window
Learn After
An attention mechanism is processing the 10th element of a sequence (where the current index
i=10) and is configured with a context window size of 5 (n_c=5). Based on the standard formula for constructing a memory component from a fixed-size window,Mem = (K_[i-n_c+1,i], V_[i-n_c+1,i]), which set of key vectors (represented by their indices) would be included in the key matrixKat this step?In an attention mechanism using a fixed-size window, the memory component at step
iis constructed using the formulaMem = (K_[i-n_c+1,i], V_[i-n_c+1,i]), wheren_cis the context window size. What is the direct consequence of increasing the value ofn_c?Constant Memory Size in Fixed-Window Attention