Inferensys

Glossary

Lambda Architecture

A data processing architecture that combines a speed layer for real-time stream processing and a batch layer for comprehensive historical analysis to provide both low-latency and accurate results.
Data scientist building training data pipeline on laptop, data preprocessing visible, technical workspace.
DATA PROCESSING PARADIGM

What is Lambda Architecture?

Lambda Architecture is a data processing design pattern that unifies batch and stream processing methods into a single framework, providing both comprehensive historical accuracy and low-latency real-time views.

Lambda Architecture is a data processing architecture that combines a batch layer for comprehensive historical analysis with a speed layer for real-time stream processing, and a serving layer that merges the two outputs. This design pattern, first formalized by Nathan Marz, addresses the fundamental challenge of computing arbitrary functions on large datasets while maintaining low-latency query responses.

The batch layer computes immutable, append-only master datasets using distributed processing frameworks, producing precomputed views with high accuracy but high latency. The speed layer compensates for the batch layer's latency by processing only recent data using incremental algorithms and stream processing engines, providing real-time but potentially less accurate results. The serving layer indexes batch views and merges them with speed layer outputs, enabling queries that are both timely and eventually consistent.

ARCHITECTURAL PRINCIPLES

Key Characteristics of Lambda Architecture

Lambda Architecture addresses the challenge of computing arbitrary functions on massive datasets with low latency by decomposing the problem into three distinct layers: batch, speed, and serving.

01

Immutable Master Dataset

The foundational principle of Lambda Architecture is the append-only, immutable data store. Raw transaction events are never overwritten or deleted; new data is simply appended as it arrives. This guarantees an auditable system of record for financial fraud investigations.

  • Event Sourcing: Every state change is captured as an event
  • Temporal Querying: Enables point-in-time reconstruction of account states
  • Correction by Addition: Errors are fixed by writing new compensating records, not altering history
02

Batch Layer (Cold Path)

The batch layer precomputes comprehensive views by periodically re-processing the entire master dataset using distributed processing frameworks. It prioritizes accuracy and completeness over latency, generating immutable, indexed batch views that serve as the ground truth for fraud models.

  • Runs computationally intensive algorithms like graph neural network training on full transaction histories
  • Corrects any errors introduced by the speed layer's approximations
  • Typical latency: minutes to hours; output is written to a serving layer
03

Speed Layer (Hot Path)

The speed layer compensates for the high latency of batch updates by processing only the most recent data incrementally. It uses stream processing engines and approximate algorithms to generate real-time views, enabling sub-second fraud risk scoring on transactions that arrived after the last batch computation.

  • Employs techniques like Count-Min Sketch and Bloom Filters for memory-efficient frequency estimation
  • Sacrifices some accuracy for extreme speed; results are inherently temporary
  • Continuously discards data once the batch layer catches up and computes the authoritative view
04

Serving Layer (Merged View)

The serving layer indexes the precomputed batch views and exposes them for low-latency random reads. A query for a complete result is satisfied by merging the stale-but-accurate batch view with the fresh-but-approximate real-time view. This provides a unified, queryable interface for the risk scoring engine.

  • Stores indexed batch views in a distributed database optimized for random access
  • Merges results from batch and speed layers transparently to the application
  • Ensures the authorization flow receives a complete risk profile without coupling to the underlying complexity
05

Human Fault Tolerance

A core tenet of Lambda Architecture is that systems must be resilient to human error, which is considered more dangerous than machine failure. The immutable master dataset and recomputation-based batch layer ensure that catastrophic bugs in application logic or accidental data deletions are fully recoverable.

  • Recomputation: If a fraud model is found to have a logic error, the batch layer can simply recompute all historical views from the raw, uncorrupted master data
  • Eliminates the need for complex and risky rollback procedures in online databases
  • Provides a robust safety net for iterative model development and debugging
06

Complexity of Dual Systems

The primary criticism of Lambda Architecture is the operational burden of maintaining two separate processing systems—batch and speed—that must produce logically equivalent results. This often requires maintaining two distinct codebases and merging their outputs, which can introduce subtle semantic inconsistencies.

  • Code Duplication: Transformation logic must be written for both a batch framework (e.g., Apache Spark) and a stream processor (e.g., Apache Flink)
  • Operational Overhead: Requires expertise in managing and tuning two distinct distributed systems
  • This complexity motivated the evolution toward Kappa Architecture, which eliminates the batch layer entirely by treating all data as a stream
DATA PROCESSING PARADIGMS

Lambda vs. Kappa Architecture

Comparison of the dual-path Lambda architecture with the single-path Kappa architecture for real-time and historical data processing

FeatureLambda ArchitectureKappa ArchitectureHybrid Approach

Processing Paths

2 (Batch + Speed)

1 (Stream only)

2 (with shared code)

Data Reprocessing

Full batch recompute

Stream replay

Batch recompute + stream replay

Codebase Complexity

High (dual logic)

Low (single logic)

Medium (shared abstractions)

Latency Profile

< 10 ms (speed layer)

< 10 ms

< 10 ms

Historical Accuracy

Eventual (batch-verified)

Approximate (stream-only)

Eventual (batch-verified)

Operational Overhead

High (two systems)

Medium (one system)

High (two systems)

Late Arrival Handling

Batch layer absorbs

Watermark-based

Batch layer absorbs

Typical Use Case

Fraud scoring + reporting

Real-time dashboards

Fraud scoring + reporting

ARCHITECTURE DEEP DIVE

Frequently Asked Questions

Explore the core concepts, trade-offs, and implementation details of the Lambda Architecture for real-time fraud detection pipelines.

Lambda Architecture is a data processing design pattern that combines a speed layer for real-time stream processing and a batch layer for comprehensive historical analysis to provide both low-latency and accurate results. It works by ingesting immutable data into a central append-only log, such as Apache Kafka, and then forking the stream into two distinct processing paths. The speed layer uses stream processing engines like Apache Flink or Kafka Streams to compute incremental views with sub-second latency, enabling immediate fraud scoring on the hot path. Simultaneously, the batch layer processes the full historical dataset using distributed frameworks like Apache Spark to generate accurate, pre-computed batch views. A serving layer merges these outputs, allowing queries to combine real-time approximations with authoritative historical corrections, ensuring the system is both fast and eventually consistent.

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.