Sliding window
A sliding window is a bounded segment or interval that advances across ordered data or time, defining successive portions considered for processing or analysis.
Designing AI Systems
A sliding window is a context-management technique that retains the most recent items while storing older items outside the active processing window.
- How it is used
- Keeps recent conversation context available while preventing model context-window overflow.
- How deep it goes
- Defines bounded retrieval and its tradeoff, but defers longer-term memory strategies to a separate design.
- Examples
- Uses Claw's Italian restaurant conversation and a get_messages limit of 50 as concrete examples.
- What you can do after
- Operate context limits through platform.sessions.get_messages with a bounded message count.
Build a Large Language Model (From Scratch)
A data-sampling method that moves a fixed-size window across text to create overlapping training examples.
- How it is used
- Generates training examples that connect tokenized text to an LLM’s next-token prediction task.
- How deep it goes
- Explains token slicing, target shifting, stride behavior, batching, and PyTorch implementation without covering embedding internals.
- Examples
- Uses The Verdict, token-ID slices, decoded contexts, tensor batches, and stride comparisons.
- What you can do after
- Builds batched input–target tensors with a tokenizer, PyTorch Dataset, and DataLoader.
Read how Build a Large Language Model (From Scratch) explains sliding window →
Kafka for Architects
A sliding window is a stream-processing time interval defined by the timestamp difference between records being considered for a join or computation.
- How it is used
- Constrains stream-to-stream joins when related events arrive asynchronously.
- How deep it goes
- Defines timestamp-based matching, state-store waiting, expiry, and partitioning constraints without detailing implementation code.
- Examples
- Uses a one-day Orders-and-Payments join in which unmatched events expire.
- What you can do after
- Apply it via Kafka Streams to join records whose event timestamps fall within a configured interval.
Deep Learning with Python, Third Edition
A technique that moves a fixed-size window across text or other data to create overlapping local segments.
- How it is used
- Creates local training examples for CBOW word-embedding pretraining and fixed-length inputs for Transformer pretraining.
- How deep it goes
- Explains fixed-size extraction through worked token examples and TensorFlow preprocessing, stopping short of general windowing theory.
- Examples
- Uses nine-token CBOW windows with an eight-token context and one label, plus 256-token shifted Transformer sequences.
- What you can do after
- Build it from scratch with TensorFlow, TextVectorization, tf.data, and Keras models.
Read how Deep Learning with Python, Third Edition explains sliding window →
Applied Reinforcement Learning
A sliding window is a method that restricts estimation to observations from the most recent fixed or adaptive time interval.
- How it is used
- Adapts bandit estimates to drifting payoffs by emphasizing recent outcomes over the full historical record.
- How deep it goes
- Defines the method and motivation but stops short of specifying window sizes, update formulas, or implementation details.
- Examples
- Uses changing ad click-through rates, evolving customer tastes, campaign decay, competitor launches, and seasonal traffic.
- What you can do after
- Evaluate when recent outcomes should replace older evidence in a changing bandit environment.
Read how Applied Reinforcement Learning explains sliding window →
Kafka Streams in Action, Second Edition
A sliding window is a fixed-duration stream-processing window whose boundaries are determined by record timestamps and whose contents change as records enter or leave.
- How it is used
- Analyzes continuously changing event behavior, such as page navigation within a recent time interval.
- How deep it goes
- Explains timestamp boundaries, inclusivity, look-back inclusion, evaluation triggers, and Kafka Streams implementation.
- Examples
- Demonstrates page-view aggregation using a 30-second SlidingWindows configuration and a downstream aggregate topic.
- What you can do after
- Apply it via Kafka Streams using SlidingWindows.ofTimeDifferenceWithNoGrace and a windowed aggregation topology.
Read how Kafka Streams in Action, Second Edition explains sliding window →
Algorithms Every Programmer Should Know
The sliding window technique processes a contiguous portion of a sequence while shifting it incrementally across the sequence.
- How it is used
- Accelerates Rabin–Karp string search by updating a text window’s hash as the window moves.
- How deep it goes
- Explains the one-character hash update and collision check, and gives pseudocode and a Python implementation.
- Examples
- Traces the hash change from ALI to LIC and illustrates a pattern-length window shifting across text.
- What you can do after
- Apply the rolling update to move through text windows during Rabin–Karp search.
Read how Algorithms Every Programmer Should Know explains sliding window →
API Design Patterns
A sliding window is a bounded set of currently active versions that advances as newer versions replace older ones.
- How it is used
- Minimizes API maintenance while delivering new functionality through frequent version turnover.
- How deep it goes
- Defines four lifecycle states and illustrates their progression, but does not detail implementation mechanics.
- Examples
- Uses a five-version monthly timeline and a state table covering Preview, Current, Deprecated, and Deleted.
- What you can do after
- Operate/configure an API version lifecycle with explicit stability, change, deprecation, and deletion expectations.
Also covered in
- Acing the CCNA Exam: Volume 1 Fundamentals and Protocols
- Deep Learning with R, Third Edition
- Building Reliable AI Systems
- Apache Kafka in Action
- Context EngineeringIn early access (MEAP)
- AI-Powered Search
- Build an AI Agent (From Scratch)
- Digital Twins in Action
- Kotlin in Action, 2E
- Essential GraphRAG
What to know first
- context windowA context window is a bounded span of sequence elements or contextual information that a model or processing operation can consider together.
- language modelA language model is a computational model that represents patterns in linguistic sequences to assign probabilities, predict, generate, or evaluate language.
- similarity searchSimilarity search is a retrieval technique that finds or ranks items by their similarity to a query, often by comparing feature or vector representations under a similarity or distance measure.
- tokenA token is a discrete unit of text, such as a word, subword, punctuation mark, or symbol, produced by tokenization and processed by a language model.
Related concepts
- text chunkproduces · A text chunk is a bounded segment of a larger text treated as a unit for processing, storage, or retrieval.
- time windowkind of · A time window is a bounded span or scope of time that delimits observations, events, or operations for analysis or processing.
- agile instabilityused by · Agile instability is an API versioning strategy that maintains a small sliding window of versions and frequently deprecates older versions to deliver new functionality quickly.
- memory management modelkind of · Memory management is the set of processes and policies by which a system allocates, organizes, retains, updates, and releases memory resources or stored information.
- paddinguses · Padding is the provision of extra values, characters, bytes, or space around or within data or an element to meet length, boundary, block-size, spacing, or alignment requirements.
Questions about sliding window
What is sliding window?
A sliding window is a bounded segment or interval that advances across ordered data or time, defining successive portions considered for processing or analysis.
Which Manning books explain sliding window?
Designing AI Systems, Build a Large Language Model (From Scratch), Kafka for Architects, Deep Learning with Python, Third Edition, Applied Reinforcement Learning, Kafka Streams in Action, Second Edition, Algorithms Every Programmer Should Know and API Design Patterns.
What should I know before learning sliding window?
Manning books that teach sliding window usually introduce context window, language model, similarity search and token first.
What is sliding window a kind of?
Sliding window is a kind of time window. A time window is a bounded span or scope of time that delimits observations, events, or operations for analysis or processing.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.







