advanced25 min studyLesson 684 in Engineering

Online and offline feature parity

Compare the same versioned feature definition at equivalent logical inputs, including time, missingness, preprocessing, and numerical rules.

On this page

What you’ll understand

  • Separate transformation skew from different observation histories.
  • Construct parity fixtures with matched keys, versions, and temporal eligibility.
  • Measure numerical and categorical mismatches without concealing null behavior.

A shared feature name does not guarantee that a model receives the same representation during training and prediction. Historical SQL and a serving function can disagree on normalization, windows, nulls, or categorical encoding. Conversely, two correct paths can differ because one reconstructs corrected history and the other served a provisional observation. Parity testing needs equivalent inputs and an explicit temporal contract before comparing outputs.

Make transformation identity reproducible

Bind the model to a transformation revision and any learned preprocessing artifacts, such as normalization statistics, vocabulary maps, clipping bounds, or imputation values. Reusing source code is useful but insufficient if one environment loads a different mean vector or evaluates a different timezone. Pin relevant dependencies and numerical types where they affect results. A production request can also supply values unavailable in a historical table, so offline evaluation must reconstruct their actual historic meaning instead of substituting a later enriched record.

Feast offers on-demand transformations that can be applied in historical and online retrieval, but this does not absolve an application from testing the deployed path and backend. Other transformations may run outside the feature store entirely. Describe which stage owns each operation to avoid normalizing twice or leaving one path unnormalized. A registry entry can identify a definition while an old serving worker still holds cached metadata. Validate the actual resolved version and preprocessing artifact in request traces, not merely the definition currently visible in a control-plane interface.

zv(x)=x−μvσv,σv>0z_v(x)=\frac{x-\mu_v}{\sigma_v},\qquad \sigma_v>0
x, mu_v, and sigma_v share the raw feature unit, making standardized z_v dimensionless. Version v identifies the fitted preprocessing artifact and convention. A new artifact changes the feature even when its formula and output storage type are unchanged.↔ Scroll wide equations horizontally.

Match the observation contract before comparing values

For each fixture, fix typed entity keys, decision time, source snapshot, transformation revision, availability cutoff, and late-data policy. Decide whether the comparison concerns corrected final values or exactly what was known online. An online request at noon cannot be compared fairly to a later historical recomputation that includes a correction first published at 12:05. Retain event and publication metadata or logged serving values where necessary. Without them, label the audit’s limits rather than treating a discrepancy as proof that one arithmetic implementation is wrong.

Test missing, null, zero, nonfinite values where supported, unknown categories, empty windows, daylight-saving boundaries, and duplicated or late events. A numerical tolerance should cover justified representation differences, not semantic changes such as cents versus dollars or the wrong entity. Compare categorical outputs and missingness masks exactly when their contract requires it. Aggregate mismatch rates by feature and entity class; a low overall rate can hide a concentrated error among cold-start users or a model’s most sensitive feature.

E∞=max⁡i∣fionline−fioffline∣max⁡(1,∣fioffline∣)E_{\infty}=\max_i\frac{|f^{\rm online}_i-f^{\rm offline}_i|}{\max(1,|f^{\rm offline}_i|)}
This example compares finite dimensionless normalized feature components on matched inputs, using a unit reference scale of one. It is a mixed absolute/relative numerical error; missingness and categorical compatibility require separate predicates.↔ Scroll wide equations horizontally.

Trace a mismatch to its first differing stage

Capture enough intermediate evidence to distinguish source selection, temporal eligibility, aggregation, preprocessing, serialization, and model-input assembly. If the raw selected observation already differs, changing a floating-point tolerance is not a repair. If raw values agree but normalized outputs differ, inspect the preprocessing artifact and operation order. If both agree but predictions differ, inspect feature ordering and model version. Run candidate serving logic in a controlled shadow path, preserving existing request semantics and documenting any extra latency or dependency load introduced by comparison.

The function instrument demonstrates a controlled transformation mismatch. Reset, set both a=0.5 and x=1.5, predict y=1.125, then Play or Step. Separately Reset, set both a=0.55 and x=1.5, predict y=1.2375, then Play or Step. The known coefficient change causes a difference of 0.1125 for the same input. This fixed quadratic is not an arbitrary feature executor or a parity-testing framework. Its value is that one changed definition parameter has a checkable consequence while the input is held constant.

A changed normalization artifact shifts the input

The raw feature is 14. Training used μ=10 and σ=2, while serving accidentally uses μ=8 and σ=2. A stipulated downstream scalar logit is 0.4z−0.5. Treat all feature values as dimensionless in this exercise.

  1. Training normalization produces z=(14−10)/2=2. Serving instead produces z=(14−8)/2=3, even though both execute the same algebraic formula.

  2. The expected logit is 0.4×2−0.5=0.3. The accidental serving logit is 0.4×3−0.5=0.7, a difference of 0.4.

  3. The first differing stage is the preprocessing artifact, not the model weights. A shared feature name, identical source code, or successful Float32 serialization cannot justify treating these two inputs as equivalent.

The result

Parity requires both the transformation rule and its versioned state. Compare matched intermediate values to locate the earliest divergence.

Explore the model

Interactive lab

Interactive lab · function

One definition parameter can create measurable skew

Reset, set both a=0.5 and x=1.5, predict y=1.125, then Play or Step. Separately Reset, set both a=0.55 and x=1.5, predict y=1.2375, then Play or Step. This exact y=ax² model illustrates a controlled rule difference; it does not execute feature-store transformations or certify parity.

One definition parameter can create measurable skewThis lab uses only y = ax². Playback traces the curve within the fixed integration interval from 0 to x; it does not estimate numerical error or change the chosen point. Current readings: y at chosen x: 0.608; Tangent slope · 2ax: 1.35; Signed area · ax³/3: 0.182. All parameters are adjustable with the labeled controls below.−2.4−1.201.22.4−9−4.504.59xy(x, ax²)
y = ax²TangentSigned integral
y at chosen x
0.608
Tangent slope · 2ax
1.35
Signed area · ax³/3
0.182
t = 0 s

This lab uses only y = ax². Playback traces the curve within the fixed integration interval from 0 to x; it does not estimate numerical error or change the chosen point. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.

Look forHold logical inputs fixed and identify the first changed transformation or artifact.

Check your understanding

Offline and online normalization use the same code but different fitted means. What follows?

Try it yourself

In a matched fixture set of 200 entities, eight have different missingness masks but all finite shared values pass the numerical tolerance. What is the missingness mismatch rate, and may the numerical result alone certify parity?

Take a moment to make a prediction or work it out on paper. Open a hint when you need one.

Give me a hint

Evaluate missingness as an independent part of the interface.

Compare with the solution

The missingness mismatch rate is 8/200=0.04, or four percent. The numerical check does not cover those mask differences and cannot certify full parity. Investigate source availability, defaults, null conversion, and temporal eligibility, including whether the eight entities belong to a concentrated class.

Take it with you

  • Version preprocessing artifacts as well as transformation code.
  • Compare equivalent entity and temporal inputs before interpreting skew.
  • Use separate numerical, categorical, missingness, and input-order checks.

Read further

Original sources and deeper explanations to follow at your own pace.

Optional progress, saved in this browser when available. Revisit any lesson at any time.

Lesson not marked complete.