liveBook · Manning

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.

How 8 Manning books explain it

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.

Read how Designing AI Systems explains sliding window →

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.

Read how Kafka for Architects explains sliding window →

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.

Read how API Design Patterns explains sliding window →

Also covered in

What to know first

Related concepts

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.