Real-Time Fraud Detection: A Lakehouse Architecture Guide

Design a real-time fraud detection lakehouse: durable event ingestion, idempotent streaming pipelines, deduplication patterns, and serving vs analytical layers.

Real-Time Fraud Detection: A Lakehouse Architecture Guide

Fraud scoring is not a query problem; it is a deadline problem. So the design splits in two: a lakehouse as the system of record for history, features, and audit, and a low-latency serving path that answers the decision on time. Everything below follows from that split.

Event Ingestion: The Durable Front Door

Ingestion is the layer where loss is least recoverable, so the contract should be append-only, partitioned, and replayable. Treat the stream as the buffer for in-flight events and durable object storage as the long-term record; everything else in this guide — freshness, observability, the serving split — is a separate concern with its own budget.

A transaction producer writes to a durable log such as Amazon Kinesis Data Streams or Apache Kafka. The AWS near real-time fraud detection guidance documents one reference path: a transaction simulator feeding Kinesis Data Streams, then streaming ingestion into Redshift through a materialized view, with Redshift ML training, SageMaker deployment, SNS notification, CloudWatch monitoring, and IAM/KMS/CloudTrail/S3 for security. It is a reference architecture, not a deployed production system, and the page states no end-to-end latency target — it is described as near real-time. Treat any latency figure you attach to it as workload-specific until you measure it on your own traffic.

Decision

Recommended default

Why it matters

Failure mode if ignored

Event identity

A stable, unique event ID assigned by the producer (e.g. the authorization's transaction ID)

Every downstream dedupe step needs a key that repeats exactly across retries and replays

At-least-once delivery silently inflates event counts

Partition key

Entity key — account, card, or device

Per-entity ordering is usually required; cross-entity ordering usually is not

Interleaved events for one entity corrupt velocity features

Transport role

Broker log used purely as a buffer

Broker retention is a configuration setting, not a durability promise

A retention expiry destroys the ability to replay

Long-term record

Append-only raw zone in object storage, partitioned by event date/hour

Retention cost versus required replay window

History cannot be recomputed after a feature bug

Delivery semantics

At-least-once on the wire, idempotent writes at the sink

Exactly-once end to end depends on what each sink can actually guarantee

Duplicates leak into training sets and feature aggregates

Timestamps

Event time and ingest time recorded as separate fields

The lateness distribution drives watermark design

Skewed features and undetected pipeline lag

Three rules do most of the work. Partition by entity key so that a single card's events stay in order — that ordering is what makes velocity features meaningful. Record event_time and ingest_time on every row, because the gap between them is your first lag signal and the input to watermark design. And assign the event ID at the producer rather than downstream: a stable ID supplied once, before the record reaches the broker, keeps live traffic and replay carrying the same identity. Avoid deriving identity from a hash of entity, timestamp, and amount — two genuinely distinct transactions can share those fields, and the collision is invisible until it corrupts a count.

Retention deserves a plain statement. Stream retention is bounded by broker configuration, so the stream is a buffer, not an archive. If you need to recompute six months of features after a definition bug, that capability has to come from a copy you own.

Illustrative walkthrough — sizing the front door. This is worked arithmetic with assumed inputs, not a measured case.

  1. Assign the producer-generated event_id before the record reaches the broker.

  2. Set the partition key to the card or account identifier your features aggregate over.

  3. Persist event_time and ingest_time separately on every record.

  4. Optionally, land raw events append-only in object storage, partitioned by event_date/hour, as your replay source. This is a separate design choice — it is not what the AWS guidance does; that reference lands the stream into a Redshift materialized view.

  5. Size the footprint honestly: at a sustained 200 events/second, one day is 200 × 86,400 = 17,280,000 events, so a 30-day raw window holds roughly 518 million events. Multiply by average serialized record size, then compare that cost against the broker's for the same window.

One boundary worth stating: the AWS guidance documents no case-management or human-review workflow, so if analysts must adjudicate cases, that is a component you design and operate yourself — see Human Review, Security, and Compliance below.

Event Ingestion: The Durable Front Door

Streaming Pipelines: Transform, Enrich, Deduplicate

Streaming pipelines turn raw events into normalized records and features, and they must be idempotent because retries are normal. Design for at-least-once delivery plus idempotent sinks rather than assuming an end-to-end exactly-once guarantee you cannot enforce.

Kafka's idempotent producer assigns sequence numbers so broker-side duplicate writes from producer retries are dropped, and transactional producers extend this to atomic multi-partition writes — giving exactly-once within Kafka's own scope, as Confluent's delivery-guarantee documentation sets out. That boundary matters: exactly-once inside the broker says nothing about your feature store, your alerting system, or your ledger writes.

For lakehouse-side ingestion, Amazon Redshift streaming ingestion documents that each record is processed once as it is ingested into the materialized view, identified by stream/shard/sequence number (Kinesis) or topic/partition/offset (Kafka, MSK, Confluent Cloud). Its scope is that ingestion step, not delivery to scoring, alerts, or case records. Two constraints follow from AWS's documentation: a streaming materialized view can reference only one stream or topic, so joins must happen in a subsequent view; and the view must be incrementally maintainable, because full recompute from the stream is unsupported. That second constraint is the practical reason durable storage, not the stream, has to be your system of record for history.

Refresh behavior is easy to misread. Manual refresh is the default; auto-refresh must be enabled at create time or via ALTER MATERIALIZED VIEW and consumes cluster or Serverless workgroup capacity. Query results reflect the point in time of the last refresh, not necessarily the stream's latest contents. A "real-time" table can therefore lag a healthy stream — freshness is a function of refresh cadence and compute allocation, not a fixed property of the engine.

Deduplication patterns that survive retries

Pattern

Where it runs

What it protects

Residual risk

Producer-assigned event ID

Producer

Duplicate submissions from client retries

Producer must reuse the same ID across restarts

Idempotent producer sequence numbers

Kafka broker

Duplicate writes from producer retries

Does not extend past the broker

Merge-on-key into landing table

Lakehouse

Duplicate rows after pipeline replay

Requires a stable key and a merge-capable table format

Idempotent write-back keyed by event ID

Serving store

Duplicate score/alert emission

Serving store must support conditional writes

Illustrative walkthrough. A design exercise, not a measured deployment: a card issuer needs per-card velocity features (count and sum of transactions in the last 10 minutes) with replay after a feature-definition bug. The producer emits each authorization with a stable event_id and an event_time; the stream is partitioned by card token with retention set explicitly and recorded in the design doc; the streaming materialized view consumes the single topic and lands raw events with an ingestion timestamp, with no joins; a second materialized view joins in card segment and risk tier; optionally, the same events land in object storage for replay; feature computation writes keyed rows with feature_as_of; and the verification step is to replay one hour twice and confirm the feature table is identical after merge-on-key. If it isn't, the idempotency key is wrong — fix that before tuning anything else.

For teams running Kafka as the transport, broker health signals such as consumer lag, under-replicated partitions, and request latency are the leading indicators that this pipeline is about to miss its freshness budget; the Kafka broker monitoring guide covers the diagnostic surface.

Serving vs. Analytical Lakehouse: Two Different Jobs

Real-time scoring may need a separate low-latency serving component, because a lakehouse is not automatically a transactional decision engine. The governing condition is simple: if a transaction must block on a decision within a tight response budget, that path needs isolated, provisioned capacity that isn't shared with analyst queries and batch jobs.

Dimension

Analytical lakehouse layer

Low-latency serving layer

Primary job

History, exploration, model training, reporting, audit

Sub-second feature lookup and decision scoring

Typical data shape

Wide tables, long scans, joins across months

Point lookups on keyed feature rows

Freshness expectation

Minutes; measured and alerted

Bounded by the scoring path's own budget

Failure mode if overloaded

Dashboard or report is late

Transactions block or time out

Capacity model

Shared with analysts and batch jobs

Isolated, provisioned for peak

Idempotency home

Deduplicated landing tables, merge-on-key

Idempotent write-back keyed by event ID

Keep the lakehouse as the source of truth for features and audit, and put a purpose-built serving store in front of the decision path. The two layers fail differently — a late dashboard is an inconvenience, a blocked authorization is an incident — and that asymmetry, not raw throughput, is what justifies the extra component.

Splitting the layers creates three interfaces that leak correctness if left implicit. Feature publication needs its own freshness metric, because a healthy lakehouse and a stale serving store look identical from the scoring path. Score write-back should return every decision to the lakehouse keyed by event ID, so retries don't double-count. Backfill and correction means the serving store must be rebuildable from durable history; if it can't be rebuilt, it isn't a cache — it's an unaudited second source of truth.

Requirement

Score in lakehouse

Score in dedicated serving layer

Decision can tolerate minute-scale latency

Acceptable

Unnecessary complexity

Decision blocks a customer transaction

Not appropriate

Required

Feature set is small and slowly changing

Workable

Workable, simpler to keep in one engine

Feature set needs many joins across history

Natural fit

Requires pre-computation and publication

Peak load is spiky and unpredictable

Shared capacity absorbs it poorly

Provision for peak, isolate from analytics

A note on vendor claims: a platform that describes itself as a lakehouse — including Singdata's documented lakehouse and ingestion capabilities — should be evaluated against the interface requirements above rather than assumed to satisfy them. Ask specifically whether the serving path can be isolated from analytical workloads, whether feature publication has a measurable freshness signal, and whether write-back is idempotent. Those are verification questions, not checklist items.

Feature Freshness: Define It, Measure It, Alert On It

Feature freshness is the age of the newest input behind a feature value, and it has to be a monitored metric, not an assumption. It only means something per feature, measured at the serving layer, and compared against the window the model was trained to expect.

Two failure patterns dominate. Stale features leave the serving store holding yesterday's aggregates while the model expects near-current behavior — the model doesn't error, it silently scores on the wrong distribution. Inconsistent features are worse: training and serving used different windows or definitions, and the skew survives every health check that only looks at pipeline liveness.

The mitigations are unglamorous and effective: version feature definitions, freeze one feature version per model, and log the feature timestamp with every score so you can reconstruct what the model actually saw. Point-in-time correctness in training data is the same discipline applied backwards — if the training set was built knowing outcomes that weren't available at prediction time, the freshness problem is already baked in. The techniques in this guide to point-in-time correct data for forecasting transfer directly to fraud features.

Metric

Definition

Why it matters

Ingestion lag

Event time to durable landing time

Detects transport and producer problems

Feature age

Now minus feature_as_of at read time

The number the model actually experiences

Publication lag

Feature computation time to serving-store visibility

Isolates the lakehouse-to-serving hop

Skew indicator

Serving value vs. value recomputed from history

Catches definition drift

Coverage

Share of scoring requests with all required features present

Catches silent fallback to defaults

Set the alert threshold from the model's training window, not a round number: if the model was trained on features no older than a given window, that window is the natural boundary — and the alert should fire before it, not after.

Idempotency and Late Events

Idempotency means reprocessing the same event produces the same state; late events mean your watermark is a policy choice, not a fact. Both are properties you design and document, not ones you inherit from a streaming engine.

Key every write on a stable event identity. Where the transport supplies one — stream/shard/sequence number for Kinesis, topic/partition/offset for Kafka — use it; where it doesn't, use the producer's event ID. Landing tables should be merge-on-key rather than blind-append when the same event can arrive twice, because a blind append turns a retry into a duplicate transaction row that inflates volume, distorts velocity features, and corrupts training labels. A merge keyed on identity makes reprocessing safe by construction: replaying a partition rewrites the same rows to the same values.

A watermark is the point after which you stop waiting for stragglers. Pick it explicitly and write down what happens afterwards; there are only three honest options.

Policy

Behavior

Cost

Drop

Event discarded after the window

Cheapest, but silently loses signal

Side-route

Event goes to a quarantine or correction path for later reconciliation

Preserves data, adds a second processing path

Apply with correction

Event updates state and emits a correction record

Most accurate, most complex to audit

Whichever you pick, make it visible in pipeline configuration and in the audit record of any score that depended on it. A fraud decision made without a late-arriving device signal isn't wrong — it's a decision made under a stated information cutoff, and it should be reproducible as such. Never let a late event retroactively change a decision already issued; record the decision as made and the correction separately.

Data Quality and Observability

Data quality checks belong in the pipeline, not in a quarterly review. Observe three planes — pipeline health, data health, and decision health — because a healthy consumer can still be producing bad decisions.

Four inline checks catch most fraud-pipeline failures early: schema conformance with rejections counted per field; null-rate thresholds on decision-critical fields such as amount, entity key, and timestamp; referential integrity on enrichment joins, tracked as a match rate; and duplicate-rate monitoring per transport key, since a rising rate before merge points to producer retry storms while a non-zero rate after merge points to a keying bug. The promotion-gate pattern described for lakehouse data quality checks across bronze, silver, and gold layers maps cleanly onto this sequence — with one difference: here a failed gate should degrade to a documented fallback rather than simply halt a batch job.

Pipeline health covers consumer lag, refresh success, checkpoint progress, and refresh latency — keep that last one on the dashboard, since refresh cadence shapes apparent freshness. Data health covers freshness against a stated target, volume anomalies against a seasonal baseline, and distribution drift in feature inputs, all measured end to end from event timestamp to queryable row. Decision health covers score distribution, decline rate, override rate, and review-queue depth: the plane infrastructure monitoring never surfaces, because a stable pipeline with a drifting score distribution is a model or feature problem.

Alert on symptoms as well as causes. Consumer lag is a cause; a review queue backing up past its service-level target is a symptom. Route them to different owners — pipeline alerts to the data platform team, decision-health alerts to fraud operations and model owners — because conflating the two is how a queue backlog gets treated as an infrastructure incident while real losses accumulate.

Human Review, Security, and Compliance

Human review is a compliance requirement, not a fallback for when automation fails. Suspicious-transaction reporting obligations under FATF Recommendation 20 are the reason case records must be durable and auditable rather than living only in an operational queue, and they drive retention policy more than storage cost does.

Design the review layer as a first-class consumer of the decision stream: every score routed to review should carry the feature values, model version, and information cutoff that produced it, so a reviewer can reconstruct the decision without querying a live system. Identity signals deserve the same treatment — the FATF guidance on digital identity applies customer due-diligence expectations (Recommendation 10) to digital identity systems used for onboarding and ongoing verification, which makes the provenance and assurance level of device or identity signals part of the compliance record. Note the boundary: that guidance is regulatory context, not a technical fraud-detection standard, and it does not prescribe pipeline architecture.

Keep review off the critical path. Route uncertain cases to a queue asynchronously, apply a documented interim disposition (hold, limit, or allow with monitoring), and feed reviewer outcomes back as labeled examples — review latency then never becomes scoring latency, and reviewer decisions become training signal.

Security controls follow the same separation logic. Encrypt events in transit and at rest across the stream, landing zone, and serving store; apply least-privilege access so a scoring service can't read raw PII it doesn't need; audit every score and override with the model and feature versions involved; and resolve retention conflicts per data class, since investigation timelines and data-minimization obligations pull in opposite directions. The AWS reference architecture's use of IAM, KMS, CloudTrail, and S3 reflects this separation — replicate the principle whichever platform you run.

Operational Tradeoffs

The dominant tradeoff in a fraud lakehouse isn't batch versus streaming. It's where you accept staleness versus where you pay for isolation, and each fork below should be a recorded decision rather than an accident of default configuration.

Tradeoff

Choose faster / leaner

Choose safer / stricter

What to measure

Freshness vs. correctness

Shorter windows, aggressive watermarks, fewer joins on the critical path

Longer windows, more joins, higher confidence per decision

Staleness of the newest event a decision can see

Cost vs. headroom

Shared compute for refresh and analytics

Isolated capacity per workload

Refresh compute consumed at peak

Simplicity vs. guarantees

One engine, at-least-once, idempotent downstream

Separate serving store with explicit guarantee boundaries

Duplicate-charge and recovery time after mid-stream failure

Reproducibility vs. model velocity

Continuous retraining on current features

Frozen feature versions per model

Time to reproduce a past decision during a dispute

Automation vs. review capacity

Aggressive auto-decline of high-risk cases

Queue-based review with a service-level target

Review backlog age; false-positive rate of the auto-decline band

Retention vs. cost

Short retention on raw events

Long retention for replay and audit

Replay window the model team actually needs

The freshness row is the one most often decided by accident. A streaming materialized view returns a point-in-time view that advances on refresh, and auto-refresh consumes compute — so "real-time" is a cadence you choose and pay for, and the freshness a decision gets is bounded by that schedule, not by how quickly the event was ingested. The simplicity row is where lakehouse architectures usually overpromise: exactly-once inside a broker's scope, or within one ingestion step, does not make the whole decision path exactly-once. If you need a hard guarantee at the point of decision, engineer it at the serving layer with its own idempotency keys.

Illustrative sizing exercise. Suppose the authorization path must return a fraud score within 800 ms, of which 300 ms is reserved for enrichment and inference. A one-minute refresh cycle is 60,000 ms — roughly 75 times that budget — so no downstream tuning recovers the gap, and minute-scale refresh belongs on the investigation path, not the inline path. Inline scoring reads precomputed features from a low-latency serving store; the refreshed materialized view serves analyst queries, case review, and model monitoring. Then record the residual risk: what happens when a refresh fails or queues, and how the serving layer behaves in that window — stale-but-served, blocked, or degraded to rules.

Provider guidance describes reference paths, not deployed systems or latency guarantees; treat every latency figure in this section as workload-specific until you measure it on your own traffic.


Publisher note: Singdata publishes documentation for a lakehouse platform with ingestion and analytics capabilities, including Lakehouse Studio and an ingestion reference. These are general data-platform functions, documented under their own conditions; no Singdata product is documented as certified or purpose-built for real-time fraud scoring or low-latency transaction decisioning. Evaluate any platform against the interface, freshness, and idempotency requirements above.

Implementation Sequence

  1. Define the decision contract. What must be decided, by when, and what happens on timeout — written down before you pick tools.

  2. Stand up durable ingestion. Partition by entity key, set retention deliberately, and record the configured value.

  3. Land events idempotently. Key on the transport identity or producer event ID; merge-on-key.

  4. Build the streaming materialized view. One stream per view, with auto-refresh enabled deliberately and its compute budgeted.

  5. Add a downstream join view. Enrichment happens here, not in the streaming view.

  6. Compute and version features. Freeze a feature version per model and write feature_as_of on every row.

  7. Provision the serving store. Isolate it from analytical compute and set its published freshness target.

  8. Wire scoring and write-back. Idempotent write-back keyed by event ID.

  9. Instrument all three observability planes and alert on freshness and lag, not just uptime.

  10. Define the review queue and audit trail. Durable case records with override logging and backlog metrics.

  11. Test replay and late-event handling inside and outside the lateness window.

  12. Document the guarantee boundary. State plainly what each component guarantees under its documented conditions and what is best-effort.

FAQ

Is a lakehouse enough for real-time fraud scoring?

Usually not on its own. A lakehouse is optimized for history, training, and audit; when a decision has a tight time budget, it typically needs a separate low-latency serving component in front of it, with the lakehouse acting as the system of record that feeds features and receives outcomes.

Do delivery semantics add up to end-to-end exactly-once?

No single component delivers end-to-end exactly-once, so verify delivery semantics per component against that component's own documentation rather than assuming they compose. Idempotent downstream handling keyed by a stable event ID makes retries safe at each sink, but it does not prove exactly-once across the whole decision path — a broker-scoped or single-step guarantee stops at that boundary. Treat the end-to-end property as something you engineer and test, not something you inherit.

How should I handle late-arriving fraud events?

Define a lateness window, document the policy (drop, side-route, or apply with correction), and make sure replay is possible from a copy you own. State the window and the policy next to the feature definitions so scoring and backfill stay consistent.

Why does idempotency matter in fraud pipelines?

Retries are routine — Kafka producer retries, consumer rebalances, replayed partitions. Without idempotent writes keyed by a stable event ID, those retries inflate transaction counts and corrupt rolling features, which directly distorts scoring and loss metrics.

How do I keep the audit trail usable for model review?

Persist the raw event, the feature snapshot used at scoring time, the model and feature versions, and the decision output as immutable records. Reviewers need to reconstruct why a decision was made, not just what the current feature values are; without the point-in-time snapshot, backtesting and dispute handling become guesswork.

Next Step

Pick one decision-critical feature, instrument its freshness end to end — producer timestamp to score log — and run it for a week in your own traffic. If you're evaluating whether a lakehouse platform can carry the analytical half of this design, start with Singdata's Lakehouse Studio and its ingestion documentation, and test them against the interface, freshness, and idempotency requirements above. The measured distribution, not an assumed number, tells you whether your current architecture meets the decision contract or needs a dedicated serving layer.


Related Articles