AI System DesignData and Feature InfrastructureModule 02 — Data and feature infrastructure
Evolving Feature Schemas Safely Across Concurrently Active Model Versions
Question 37 of 47 · Updated
On this page
- 1. Start with the model's input contract, not a database column
- 2. Distinguish structural, semantic and operational compatibility
- Change classification
- 3. Feature registry and model-release dependency graph
- 4. Version routing: bind before fetching
- 5. Expand, migrate and contract with simultaneous model support
- 6. Dual materialization and compatibility adapters
- Storage and serving choices
- 7. Historical reconstruction and training-serving consistency
- 8. Shadow validation and promotion gates
- 9. Tested implementation: exact feature-version binding and retirement gates
- 10. Progressive rollout and rollback of the whole compatible pair
- 11. Capacity, cost and support-window economics
- 12. Schema retirement: distinguish online serving from historical support
- 13. Monitoring, incident diagnosis and ownership
- 14. Second worked scenario: categorical vocabulary evolution
- 15. Production test and acceptance matrix
- 16. Interview-ready answer
- References and research transparency
Treat the model and its feature dependencies as one immutable compatibility contract. Expand the feature system to serve old and new semantics concurrently, bind every inference or training job to the exact feature bundle required by its model release, verify each path independently, and contract the old schema only when active, rollback and historical consumers have a supported alternative. Never route an old model to a new feature simply because the field name, type or vector length matches.
How would you evolve feature schemas while older and newer model versions remain active?
ASD-014 | Module 02 — Data and feature infrastructure | Learning order 24. The existing MLOps schema-evolution lesson covers producer/consumer compatibility, unit conversion, expand-migrate-contract and training pipeline changes. The shared-feature-definitions lesson explains pinning the same transformations for training and serving. The production-rollout lesson covers model traffic exposure and rollback. Here the distinct architectural problem is maintaining a live compatibility graph across simultaneously active model releases, feature definition versions, materialization generations and retained replay obligations. ASD-009 covers heterogeneous ingestion schemas; ASD-010 selects evidence when same-target predictions use disagreeing snapshots; ASD-013 builds reproducible multi-source datasets. This lesson consumes those contracts and concentrates on feature-version routing, coexistence invariants, dual materialization, release dependency gating and retirement. The examples and numerical assumptions are fictional. The exact Python fixture was locally executed; no real feature store or model was deployed.
1. Start with the model's input contract, not a database column#
A retail demand service uses an established model m1 trained on a seven-day gross units feature. The team develops m2 using seven-day net units (gross minus eligible cancelled units) and cancellation count. Both models serve production during the rollout. Some batch forecasts still use m1 and a disaster recovery plan depends on it.
At an aligned source cut, an item has gross units 10, cancelled units 3 and net units 7. Both gross and net quantities are valid nonnegative integers. Renaming gross_units to units and populating it with net units is not a harmless schema update. The old model receives a 30% smaller quantity despite every primitive type check passing. An independent semantic change has been disguised as a compatible representation.
The fundamental invariant is:
For every admitted inference on model release M, the vector presented to M must satisfy its exact approved feature contract, including semantics, ordering, representation, validity, missingness and evidence lineage.
It is not enough to check that a payload can be deserialized. The compatible pair is model plus feature bundle plus preprocessing. If either component changes, identify and approve the new pair. An inference runtime may accept a tensor of the expected shape while performing meaningless computation on the wrong inputs.
Clarify product requirements: number of concurrently supported models, routing granularity, long-running jobs, training and evaluation replay horizons, latency and freshness SLOs, resource costs, tenant/purpose restrictions and rollback obligations. Agree on who owns each feature's semantic meaning and who authorizes model compatibility. A central platform should not independently change a business feature without consulting its consumers.
2. Distinguish structural, semantic and operational compatibility#
| Compatibility dimension | Example | What verifies it |
|---|---|---|
| Wire/schema | New optional field in a serialized payload | Actual old/new reader and writer tests |
| Tensor representation | Feature order, numeric dtype, dimension, sparse indices | Model input signature and vector tests |
| Meaning | Gross units versus net units | Approved business definition and reference fixtures |
| Temporal | Seven-day window, source availability and TTL | Point-in-time and materialization contract |
| Missingness | Unknown category versus zero | Training-approved missingness and error behavior |
| Population | Customer-level feature changes to household grouping | Entity and authorization semantics |
| Statistical | Same mathematical definition but new approximation or sampling policy | Parity, sensitivity and model evaluation |
| Operational | Feature version available to the correct model within deadline | End-to-end readiness and SLO tests |
Backward compatibility usually means a new reader can read data written by an older schema, while forward compatibility means the old reader can read newer writer data. Full compatibility combines both; transitive checks cover the specified prior versions rather than only a neighboring pair. Exact rules vary across Avro, Protobuf, JSON Schema and implementations. These terms describe a serialization relationship. The separate model-consumption relationship asks whether a particular feature producer or adapter satisfies the frozen model's expected meaning.
An additive field is only compatible for an old model if the feature assembler selects the old contract's exact fields and order and the transport permits extras. Appending a new coordinate to a positional tensor changes its dimension and is breaking even if the upstream object is additive. A rename can be a safe representation adapter if the original value is preserved exactly or within an explicitly validated tolerance. A semantic change, such as net replacing gross, needs a new definition even if both use the same integer type.
Use semantic versioning as a helpful convention, not proof. A major revision can mark an incompatible definition; a minor release can add an optional compatible field; a patch can fix an implementation while retaining the approved semantic contract. A bug fix that changes values may require new materialization and model validation regardless of its version label. Immutable artifact identities and compatibility approvals, not the label alone, determine admission.
Change classification#
| Proposed change | Likely migration treatment |
|---|---|
| Add unused optional metadata | Test old readers; project exact old inputs |
| Add mandatory model coordinate | New feature bundle and model compatibility approval |
| Convert meters to kilometers | Verified adapter if units, precision, missingness and range match |
| Change one-hour mean to seven-day median | Breaking semantic version; recompute from history |
| Replace category vocabulary/order | New vocabulary/preprocessing and compatible model release |
| Change entity from user to household | New identity and privacy contract |
| Fix incorrect cancellation handling | New materialization generation; assess whether the old model remains suitable |
| Stop emitting an unused field | Remove only after dependency and replay checks |
Do not assume a default value makes a new feature usable on old data. A model trained with missing indicators may support an explicitly defined unknown representation. A model trained on observed real values cannot safely be given invented measurements merely to satisfy the signature.
3. Feature registry and model-release dependency graph#
Keep distinct identities:
- A feature definition identifies mathematical and business meaning, entity scope, temporal contract and permitted representation.
- A feature bundle identifies the ordered collection of feature definitions and vector construction.
- A materialization generation identifies the implementation release, input/source lineage and scoped versioned state serving a bundle. Its values can evolve under the declared live contract; pin the exact read snapshot for reproducibility.
- A model release identifies weights, runtime, preprocessing, calibration, feature bundle dependencies and compatible serving generation policy.
- A routing epoch identifies an approved deployment mapping, not an input schema.
- A dataset release identifies historical examples and their pinned inputs, distinct from current feature availability.
The registry must preserve immutable definitions and explicit relationships. A release may accept exactly one feature contract and generation, or a set of evaluated compatible generations under a declared migration policy. Avoid unconstrained expressions such as latest or any v2. Compatibility is directional and scoped: a producer can satisfy a consumer under specified constraints without the reverse being true. An adapter edge must identify its source and destination contracts, exact code, valid domain, precision and failure behavior, evaluation and owner.
A practical release record might look as follows (illustrative IDs, not real digests):
JSON{ "model_release": "demand-m2/r12", "model_artifact": "immutable-model-reference", "preprocessing_release": "demand-preprocess/r3", "feature_bundle": "net-demand/v2", "ordered_features": [ {"definition": "net-units-7d/v2", "dtype": "int64", "unit": "piece"}, {"definition": "cancelled-units-7d/v1", "dtype": "int64", "unit": "piece"} ], "approved_generation": "net-materialization/g2", "maximum_feature_age_seconds": 60, "missing_feature_policy": "hold", "approved_training_dataset": "dataset-release-19", "compatibility_evidence_ref": "approval-83" }
A schema registry can enforce reader/writer compatibility for the serialized envelope. A feature registry and model release service must add semantic, temporal, preprocessing and model-specific dependencies. Feature-service abstractions in feature stores are useful for grouping the expected inputs; they do not automatically prove that the transformations, source meaning, stored values and served tensors satisfy a frozen model. Record and test those relationships separately.
For discovery and retirement, build a reverse dependency index from each feature and materialization to active model releases, potential rollback releases, scheduled batch jobs, queued or in-flight inference, experiments, downstream features and historical replay obligations. A dependency graph should include direct and transitive edges. A shared normalization statistic or vocabulary is just as important as a database column. If a feature is used by several models in different tenants, retirement scope must respect their independent migration schedules.
4. Version routing: bind before fetching#
Resolve the model release first from a trusted routing policy. Then resolve the exact approved feature contract and generation from its immutable manifest. Do not have the model independently ask a store for whatever is newest. For asynchronous jobs record the release identity at admission and retain the dependency until terminal status and any applicable retry window. For streaming or multi-step inference, define a coherent version policy across the entire logical job; changing features mid-run can produce an invalid result.
A feature lookup key should include tenant/authorized scope, entity, feature contract, generation and relevant temporal snapshot. Caches must be namespaced by these identities and current authorization requirements. A cache keyed only by entity ID can serve m2's net units to m1 even when their schemas are otherwise isolated. A request-level pinned reference must remain stable through retries, fan-out and the inference call. If current evidence is required, revalidate eligibility at the appropriate boundary rather than pinning stale data indefinitely.
Return typed failures such as UNKNOWN_RELEASE, FEATURE_UNAVAILABLE, CONTRACT_MISMATCH, INVALID_VECTOR or STALE_EVIDENCE. Do not silently fetch v1 if v2 is missing. An approved fallback may route to the entire stable model+feature+preprocessing release, if current input and action constraints permit it. A fallback is a new selected mechanism with traceable reason, not a hidden tensor substitution. Use bounded timeouts and retry budgets. Log the requested model, actual executed model, actual vector contract and fallback disposition separately.
5. Expand, migrate and contract with simultaneous model support#
Expand. Register new definitions, update source decoding where required, create new feature and materialization identities and deploy readers capable of serving both contracts. Do not modify old features in place. Establish support windows and assign owners.
Populate. Build authorized historical v2 features, materialize current values and catch up with live changes. Apply correction and deletion semantics in both generations. Use distinct namespaces and checkpoints. ASD-011 addresses the complete historical rebuild and fenced cutover protocol; here the old generation deliberately remains a live dependency after the new generation is usable.
Validate. Check exact input semantics, offline/online parity for each version, coverage, freshness, runtime signatures and approved model quality. Train m2 on the actual v2 contract and eligible historical data. If v2 cannot be reconstructed for older windows, explicitly limit the training population or develop a validated missing-feature approach.
Migrate. Make m2 eligible only after v2 availability and compatible release approval. Shadow score a bounded sample using both model-specific vectors. Assign a low-risk cohort to m2; observe actual per-version health and mature outcomes before expansion. Keep m1 and its feature generation operating throughout the defined coexistence and rollback period.
Contract. Drain old routes and jobs, establish a replacement recovery path, verify historical reconstruction and retention, then stop unneeded old materialization. Remove online and offline support separately as their obligations permit. The process may intentionally stop in coexistence if multiple supported model versions are a product requirement.
6. Dual materialization and compatibility adapters#
Use shared source capture and common validated computations where semantically identical. For genuinely different feature semantics, publish distinct outputs. A streaming processor may compute both aggregates in one pass, or two versioned consumers may run separately. The first reduces source and transform duplication but increases shared failure coupling; the second improves isolation and independent release ownership at greater cost. In either design track readiness independently.
A complete-state materialization must handle source revisions, tombstones, event-time windows and late corrections. For a delta contract, ensure events are applied in the required order and deduplicated by operation identity. The v2 pipeline may be caught up while v1 is lagging; readiness cannot be a single Boolean for the whole store. Track position vectors and approved coverage per feature generation. Do not claim an atomic dual write across independent stores without a supported consistency mechanism. Use a durable shared log and independent checkpoints; compare at compatible source cuts.
Adapters are appropriate for representation equivalence, not fabricating missing information. Consider a distance feature in meters versus kilometers. A reviewed adapter can divide meters by 1000 if the underlying distance definition, rounding, measurement source, temporal cut and null rules match. If the new producer stores an integer number of rounded meters, it may be impossible to reconstruct an older high-precision kilometer value exactly. Specify whether an approximation is permitted and validate the model's sensitivity. Conversion code must reject overflow, invalid types, contradictory dual fields and unsupported nulls; it cannot grant authority for another entity's evidence.
In the gross/net example, net=7 alone does not determine gross: gross=7 with zero cancellations and gross=10 with three cancellations both yield net=7. If gross and net use the same time window, matching source cut, quantity conventions and cancellation rules, and cancelled units (not cancellation count) are retained, gross may be reconstructed as net plus cancelled units. Cancellation count is not necessarily cancelled units. The example's three cancelled units happen to correspond to three one-unit cancellations, but a real count cannot be substituted in that arithmetic. Approve an adapter only with sufficient evidence and an explicit equivalence contract. Otherwise maintain the old materialization from the correct source history.
If an adapter runs online, include its latency, resource and failure behavior in the model's end-to-end contract. Version it with the release and test the exact same conversion for historical replay where applicable. Avoid adapter chains that accidentally select incompatible semantics or hide long-term maintenance costs. A compatibility graph may be useful for planning but a multi-hop path is not automatically an approved model input.
Storage and serving choices#
| Pattern | Suitable when | Main risk |
|---|---|---|
| Separate versioned namespaces | Breaking semantics or strong isolation needed | Extra storage and compute |
| Shared immutable base plus versioned projections | Common source/transform work is truly equivalent | Shared dependency failure |
| Dual fields in one record | Additive transport and exact old projection | Ambiguous field selection, larger payloads |
| Validated on-demand adapter | Representation conversion is bounded and information-preserving | Latency or precision loss |
| Fully independent stores | Risk, scale or lifecycle justify separate infrastructure | Consistency and operational overhead |
Prefer the simplest design that preserves exact semantics and the required operational isolation. Do not preserve duplicate pipelines indefinitely when a safe verified common base exists.
7. Historical reconstruction and training-serving consistency#
The model's feature definition is a historical computation contract, not only a serving signature. Reconstruct examples at their intended prediction cutoffs using the source revisions and availability semantics appropriate to the model. A new feature may require history that was never collected. A backfill cannot reconstruct an unobserved value from a later measurement. If no reliable history exists, use a separately approved data collection, missingness design or narrower training/evaluation population.
Pin the transformation implementation, windows, source mapping, unit conversions, vocabulary, imputation and preprocessing artifacts to the dataset and model release. Old models must retain the exact historical feature path or an approved equivalent reconstruction. For new models, independently verify that live v2 and historical v2 agree for identical admissible evidence; do not demand that v2 equal v1 when the meaning intentionally changed.
For the demand example, use a synthetic seven-day source window with ten gross units, three one-unit cancellations and no unresolved revisions. The expected v1 vector is [10]; the expected v2 vector is [7,3]. A golden fixture should test the exact source evidence and both approved definitions. A cancellation received after the prediction cutoff may belong to a later corrected analysis but cannot be silently included in the original as-known training feature. The expected v1 and v2 outputs for the original cutoff must be computed under their respective approved availability rules.
Test boundary timestamps, missing data, precision, invalid numeric values, zero denominators, vocabulary out-of-range values, normalization parameters and ordering. A version-specific feature bundle may carry one shared feature definition and several changed definitions. Reuse the truly identical feature once, but ensure the bundle's dependency cut is coherent. Pin learned transformations from the model's training population rather than refit them from live data.
The reproducible-dataset lesson ASD-013 establishes immutable dataset manifests and independent evaluation splits. Here the new dependency is the simultaneous preservation of each supported model's dataset and online feature contracts. Model evaluation on a reconstructed dataset cannot establish that the actual production path is serving the correct version; validate the real runtime vector too.
8. Shadow validation and promotion gates#
The purpose of shadowing is to collect evidence without granting the candidate authority over business effects. Shadow m2 with v2 features and m1 with v1 features on aligned eligible cases. For the unchanged features, compare exact or tolerance-based values at the same evidence cut. For intentional changes, compare against independent expected semantics, not the old value. A legitimate new feature can differ substantially while still being correct.
Use paired comparisons in stages:
- Structural and signature validation: actual wire format, dtype, dimensions, missingness and field ordering per model.
- Golden semantic fixtures: authoritative source evidence, exact feature definition, expected vector.
- Same-contract batch/stream parity: both paths use compatible source revisions and cutoffs.
- Cross-version comparison: expected versus unexplained feature differences, source coverage and score distributions.
- End-to-end model release tests: artifact, preprocessing, vector assembly, latency, quality, policy constraints and downstream behavior.
- Coexistence and recovery tests: route either model, simulate candidate outage, restore the stable pair and verify actual feature eligibility.
If possible, use controlled model-input comparisons only where both models genuinely accept the same feature semantics. An m1 trained on gross should not be fed net merely to isolate a model effect. For breaking feature contracts, evaluate the complete model-feature release, and use separate tests to attribute feature semantic correctness. Comparison of two valid release outputs is not proof that the newer one is better.
Promotion evidence must be bound to the exact approved release and feature contract/generation scope. Validate representative entity coverage and critical segments, not just a global average. A hypothetical 99.9% global feature availability could still hide total absence for a small customer class. Missing coverage may selectively bias a canary toward easier cases. Count offered cases, eligible routes, actual versions served, fallbacks and final outcomes.
Suppose 50,000 candidate attempts are evaluated. 49,500 receive an eligible v2 vector, 500 do not; candidate eligibility is 99%. Of eligible cases, 49,450 pass the expected-value test and 50 fail. Conditional semantic agreement is approximately 99.90%, but only 98.90% of all attempts are observed eligible-and-passing. These are illustrative checks, not a model accuracy result. If required availability is 99.5% or any of the 50 failures violates a mandatory semantic invariant, do not promote. Do not hide the 500 missing cases by calculating agreement only on the successful subset.
9. Tested implementation: exact feature-version binding and retirement gates#
The following standard-library Python fixture models two deliberately incompatible feature contracts and a trusted model-release registry. Model m1 requires the gross-only bundle; m2 requires the net/cancelled vector. The lookup is keyed by exact scope, contract and generation. It validates declared order, freshness and basic value constraints, models conditional routing changes and checks simplified retirement dependencies. The fixture is a pure sequential state model, not a production feature service.
PYTHONfrom dataclasses import dataclass, replace from math import isfinite @dataclass(frozen=True) class Bundle: scope: str contract: str generation: str observed: int available: int values: tuple @dataclass(frozen=True) class Release: contract: str generation: str fields: tuple ttl: int # Trusted, approved immutable release records. v1 uses gross units; # v2 uses net units and cancellation count. They are not interchangeable. releases = { 'm1': Release('gross/v1', 'g1', ('gross',), 60), 'm2': Release('net/v2', 'g2', ('net', 'cancelled'), 60), } def vector(model, scope, cutoff, bundles): r = releases.get(model) if r is None: return 'UNKNOWN_MODEL', None b = bundles.get((scope, r.contract, r.generation)) if b is None: return 'MISSING', None if (b.scope, b.contract, b.generation) != (scope, r.contract, r.generation): return 'MISMATCH', None if not cutoff-r.ttl <= b.observed <= b.available <= cutoff: return 'STALE_OR_FUTURE', None if tuple(k for k, _ in b.values) != r.fields: return 'SCHEMA', None values = tuple(v for _, v in b.values) if any(type(v) not in (int, float) or not isfinite(v) or v < 0 for v in values): return 'INVALID', None return 'READY', values def switch(route, expected_epoch, target, approved, ready): # Pure compare-and-swap model; actual registry must be transactional. current, epoch = route if epoch != expected_epoch or target not in approved or target not in ready: return route return target, epoch + 1 def can_retire(contract, active, rollback, jobs, archived_replay_ok): referenced = set(active) | set(rollback) | set(jobs) return archived_replay_ok and all(m in releases and releases[m].contract != contract for m in referenced) old = Bundle('a/x', 'gross/v1', 'g1', 80, 90, (('gross', 10),)) new = Bundle('a/x', 'net/v2', 'g2', 80, 95, (('net', 7), ('cancelled', 3))) k1 = ('a/x', 'gross/v1', 'g1') k2 = ('a/x', 'net/v2', 'g2') store = {k1: old, k2: new} assert vector('m1','a/x',100,store) == ('READY',(10,)) assert vector('m2','a/x',100,store) == ('READY',(7,3)) assert vector('m1','a/x',100,{k2:new}) == ('MISSING',None) assert vector('m2','a/x',100,{k1:old}) == ('MISSING',None) assert vector('m3','a/x',100,store)[0] == 'UNKNOWN_MODEL' assert vector('m1','b/x',100,store)[0] == 'MISSING' assert vector('m1','a/x',100,{k1:new})[0] == 'MISMATCH' assert vector('m1','a/x',100,{k1:replace(old,generation='g3')})[0] == 'MISMATCH' assert vector('m1','a/x',141,store)[0] == 'STALE_OR_FUTURE' assert vector('m1','a/x',140,store)[0] == 'READY' assert vector('m2','a/x',94,store)[0] == 'STALE_OR_FUTURE' assert vector('m2','a/x',100,{k2:replace(new,values=new.values[::-1])})[0] == 'SCHEMA' assert vector('m2','a/x',100,{k2:replace(new,values=(('net',7),))})[0] == 'SCHEMA' assert vector('m1','a/x',100,{k1:replace(old,values=(('gross',True),))})[0] == 'INVALID' assert vector('m1','a/x',100,{k1:replace(old,values=(('gross',float('nan')),))})[0] == 'INVALID' assert vector('m1','a/x',100,{k1:replace(old,values=(('gross',-1),))})[0] == 'INVALID' route = ('m1', 1) assert switch(route,1,'m2',{'m1','m2'},{'m1'}) == route assert switch(route,1,'m2',{'m1'},{'m1','m2'}) == route route = switch(route,1,'m2',{'m1','m2'},{'m1','m2'}) assert route == ('m2',2) assert switch(route,1,'m1',{'m1','m2'},{'m1','m2'}) == route assert switch(route,2,'m1',{'m1','m2'},{'m1','m2'}) == ('m1',3) assert not can_retire('gross/v1',['m2'],['m1'],[],True) assert not can_retire('gross/v1',['m2'],[],['m1'],True) assert not can_retire('gross/v1',['m2'],[],[],False) assert can_retire('gross/v1',['m2'],[],[],True) print('25 checks passed')
Actual local execution using Python 3.13.5:
25 checks passedAll 25 assertions passed. They cover both approved vectors, missing version refusal in either direction, unknown model, scope isolation in lookup, incorrectly keyed and wrong-generation bundles, TTL boundary and stale values, future availability, reversed field order, absent required field, Boolean/NaN/negative values, insufficient feature readiness, missing release approval, successful route transition, stale routing epoch rejection, rollback at a new epoch, retirement blocked by rollback and queued-job dependencies, missing historical replay evidence and an eligible simplified retirement case. The locally executed code MD5 excluding terminal newline is a47a0a5191bd30cdf82cb12a77b70a40.
Important limitations: scope and release records are trusted fixture inputs, not an authentication or authorization implementation. The registry and bundle objects are in memory; there is no actual feature computation, source validation, serialization registry, online/offline store or model inference. The fixture uses exact fixed feature generation references and integer time under an illustrative inclusive TTL. It assumes validated structural inputs and does not verify the actual declared int64 representation, overflow bounds, integral counts, semantic formula, consistency of sources, model artifact digests or permission revocations. Its numeric check accepts finite nonnegative int/float values deliberately for this narrow example. A real runtime must validate exact dtype and semantics according to its release. The switch function is a pure compare-and-swap *model*, not an atomic distributed operation; supplied ready and approved sets are assumed to represent trustworthy current evidence. A production router must bind readiness and approval to exact artifacts, check the current epoch transactionally and handle stale readiness at use. can_retire checks only the supplied direct model lists and archive Boolean; real dependency discovery must include all transitive references, offline consumers, legal retention and active leases. No concurrency or real retirement is performed.
For a bundle with d coordinates, the vector validator is O(d) time and O(d) extra space for the returned tuple and field order. Dictionary lookups are average constant time under normal hashing assumptions. Retirement in this simplified model scans the union of the supplied model references. Real feature-fetch latency depends on remote lookups, batching, authorization, storage access and compatibility validation; no benchmark is asserted.
10. Progressive rollout and rollback of the whole compatible pair#
A route can assign eligible cohorts to stable m1 or candidate m2, but the release object must pin each corresponding feature bundle and preprocessing. For a hypothetical 1,000 inference requests/s and 10% candidate exposure, the offered m2 load is about 100/s under uniform routing. If 10% of the remaining m1 traffic is additionally shadowed to m2, that adds 90/s, so the candidate feature path sees about 190 reads/s before retries and shared-read optimizations. Do not size v2 only for the real canary's 100/s. Actual routing and shadow sampling denominators should be observed, not inferred from configured weights.
If model m2 is rolled out but feature version v2 is incomplete for certain tenants, preserve an explicit eligible cohort boundary. Returning a successful response using an unapproved v1 vector is not graceful degradation. A permitted fallback to m1 should be a complete versioned route and be evaluated separately. For a streaming job, decide whether to drain or explicitly migrate its pinned release; don't change its feature interpretation halfway through stateful computation.
A successful rollback restores a compatible model, runtime, preprocessing, feature-serving path, current state coverage and capacity. Reverting weights alone may leave m1 reading v2. Restoring an old online snapshot that stopped receiving deletes or corrections may be worse than holding predictions. Keep v1 materialization caught up during the rollback window or establish a proven bounded reconstruction path with an acceptable recovery objective. Invalidate incompatible caches and verify actual served version identities after restoring traffic. Increment the routing epoch on rollback so late promotion attempts cannot overwrite it.
Different model fleets may need different feature-generation rollback policies. If v2's source or implementation is corrupt, stop affected candidate use, hold unsafe feature evidence and identify dependent models. If m2's quality regresses while v2 is correct, it may be sufficient to restore m1 and retain v2 for diagnosis. If v1 has been independently revoked, do not restore it just because it was previously stable. Use the current approved safe degradation plan.
The generic MLOps rollout lesson develops exposure strategies and statistical bake windows; this lesson's key additional gate is verifying the feature dependency of every active and rollback model, including low-volume routes that are not represented in the main canary.
11. Capacity, cost and support-window economics#
Assume 10 million active entity keys. An illustrative v1 stored record consumes 40 bytes of logical payload and v2 consumes 64 bytes. Keeping both requires 1.04 GB of logical payload versus 0.64 GB for v2 alone; this excludes keys, database encoding, indexes, replication, allocator overhead, historical versions and operational headroom. Three complete copies of both payloads would be 3.12 GB under the simplified assumption. Measure actual storage and memory profiles rather than use this arithmetic as a sizing guarantee.
Suppose upstream has 2,000 eligible updates/s. An old feature transform consumes 0.4 ms CPU per update and the new transform 0.7 ms. If each runs independently on every update, ideal CPU demand is 2,000 × 1.1 ms = 2.2 CPU-seconds/s, or 2.2 fully utilized cores for those transforms alone. At a planned 60% utilization, the simple floor is 3.67 cores, rounded up to four, before serialization, state-store work, scheduling, skew, replication and headroom. Benchmark actual workloads. Shared parsing or aggregations can reduce cost but may introduce correlated failures. Do not remove old support before its consumers have migrated merely to save this overlap cost.
A materialization lag incident can create simultaneous catch-up and live demand. Reserve live capacity and throttle historical reconstruction. Track source retention headroom and per-generation lag; a candidate catching up must not starve m1's active input. Some features can be lazily adapted on read, but that trades materialization expense for tail latency and availability risk. Compare peak and typical traffic, shared feature reuse and rollback readiness.
A long coexistence window may be justified for delayed outcome validation, staggered tenant migrations or batch reporting schedules. Record the expected expiry of each support obligation and accountable owner. Budget the cost explicitly; an indefinite unowned v1 pipeline is technical debt. Conversely a deadline alone cannot override a still-active dependency.
12. Schema retirement: distinguish online serving from historical support#
A zero observed traffic graph is not proof of no dependencies. Inventory scheduled and infrequent consumers, currently inactive disaster-recovery routes, pending queues, long-lived batch jobs, experiments, feature DAGs, materialized datasets and support obligations. Reconcile declared dependencies with actual access logs and release registries. Logs are supporting evidence, not a complete static dependency graph.
Before contraction, prevent new release registrations from binding to the deprecated contract except explicitly approved maintenance. Drain pinned consumers or provide an independently evaluated replacement. Fencing matters: if a new job can pin v1 between dependency check and shutdown, the check is stale. Use a transaction or coordinated lease protocol for the deprecation boundary, with explicit grandfathering of admitted jobs. Do not delete old artifacts still referenced by approved datasets or permitted historical reproductions.
Separate online retirement from historical retention:
- Stop live v1 refresh once no active, rollback or admitted job requires fresh v1.
- Preserve approved historical snapshots or executable reconstruction paths for the agreed retention horizon.
- Remove online cache and serving infrastructure after verified deprecation.
- Retire old schema readers and archived transformation code only when no supported source/history requires them.
- Delete data under current retention and privacy policy, including tombstone and revocation obligations.
An authorized historical replay may not require continuously refreshed online state; retaining static immutable examples can satisfy a narrower reproducibility contract. Conversely an old model retained for instant rollback requires current serving state, not just archived training vectors. If historical inputs must be deleted, disclose the resulting reconstruction limitation instead of claiming complete replay forever.
13. Monitoring, incident diagnosis and ownership#
| Signal | Reason |
|---|---|
| Model release to actual feature contract/generation mismatch | Detect incorrect routing or assembly |
| Offered, eligible and failed lookups by version | Detect incomplete materialization and biased availability |
| Freshness, source frontier and deletion lag per generation | Detect outdated evidence |
| Ordered signature, dtype and null failures | Catch structurally invalid vectors |
| Golden and same-contract parity failures | Detect semantic or runtime skew |
| Expected versus unexplained cross-version differences | Diagnose intentional change versus defect |
| Feature distribution and model outcome by actual release | Evaluate effects of new contract |
| Fallback count and reasons | Reveal hidden incompatibility or overload |
| Stale route updates and registry version mismatch | Detect release coordination faults |
| Remaining old references and deprecated-schema reads | Verify retirement progress |
| Resource cost per feature generation | Manage coexistence economics |
Monitor actual runtime release identities, not just desired rollout flags. Compare source cuts before blaming semantic skew. If a feature path changes under the same immutable identity, treat it as a contract incident: identify exact producer/adapter/materialization release, freeze unsafe publication, protect current inference, and recover with a new approved generation. Do not update a feature registry description to make an incompatible producer appear compliant.
For a concrete incident, an old model suddenly sees a 30% smaller demand feature after a shared producer update. First check actual feature and model identities and raw authorized evidence. If net units were delivered under the gross contract, contain that feature generation and identify every dependent model and prediction. Restore or reconstruct the valid gross path, verify current state including cancellations and deletions, re-route only when eligible, and separately reconcile affected past predictions or actions. A schema rollback does not reverse earlier business effects.
The feature owner is accountable for definition and source semantics, the platform owner for materialization and serving contract, the model owner for compatibility and quality, and the release owner for routing and rollback. Data governance owns purpose and retention. Every compatibility approval, retirement exception and incident needs an accountable owner; a green schema registry status is not an approval to change model behavior.
14. Second worked scenario: categorical vocabulary evolution#
A support-ticket classifier uses a categorical department feature. The v1 preprocessing maps sales, support and unknown to indices 0,1,2. The v2 model adds billing and uses indices 0,1,2,3 for sales, support, billing and unknown. Both models consume integer tensors. If the shared encoder is replaced in place, the v1 model interprets billing as unknown and may receive index 3 outside its learned embedding table. Even where both tensors fit the runtime, meaning differs.
Freeze the vocabulary and unknown policy with each preprocessing/model artifact. Preserve the canonical department identity upstream, not just the encoded integer. Use a v1 assembler that maps billing to its trained unknown representation only if that fallback is approved; use a v2 assembler with its own vocabulary. If the v1 model cannot support a newly introduced category, restrict its route or hold rather than invent a class mapping. Test every category including missing, unsupported and version-specific values. Historical reconstruction needs the exact vocabulary and approved availability semantics. Retirement of v1 requires removal of all its serving and replay dependencies, not merely deploying v2's encoder.
This demonstrates why compatibility is not a database-only problem: an embedding table and its categorical mapping are inseparable, and identical dtype or vector length cannot guarantee meaningful inference.
15. Production test and acceptance matrix#
| Fault or change | Required behavior |
|---|---|
| Optional producer field added | Old assembler still emits exactly its expected vector |
| Breaking semantic change under same wire type | Registry and independent semantic tests reject substitution |
| Candidate feature not populated for a tenant | No unapproved model route; explicit failure/fallback |
| Cache accidentally shared across feature versions | Isolation test detects mismatch; no incompatible vector used |
| Same-contract late correction | Eligible snapshot and generation semantics preserved |
| New field has no historic source | Explicit missingness or scoped dataset; no fabricated history |
| Old queued job retries after migration | Uses retained approved pinned contract or explicit recovery |
| Candidate model fails with v1 lagging | Verify recovery readiness; do not blindly restore stale state |
| Concurrent promotion and stale rollback | Fenced epoch and expected predecessor control |
| New job admitted during deprecation | Admission fence or documented retained lease |
| Archived source expires | Report reconstruction limitation; no substitute under old identity |
| Permission revoked during dual materialization | Current authorization and deletion enforced in both paths |
Exercise actual old and new producer/reader pairs, serialization compatibility, model runtime signatures and representative source fixtures. Test real warehouse and stream transformations on aligned evidence including exact windows, late data, corrections, missingness and entity mapping. Verify model quality and calibration with the exact compatible feature bundles, and actual inference routes and cache keys under traffic. Test dual materialization load, resource contention and source recovery; test rollback against real current data and in-flight jobs. Test schema retirement races, reference discovery and archived replay. Run independent privacy/security review and actual tenant-isolation checks. The executed fixture covers selected sequential invariants only.
16. Interview-ready answer#
I would classify the feature change across structure, semantics, temporal meaning, missingness and model input representation. I would register immutable feature and bundle definitions and bind each model release to its approved feature contract, preprocessing and compatible materialization. I would introduce new definitions through expand-migrate-contract, keep old and new serving paths available, and use adapters only for verified information-preserving representation changes. I would build historical and live feature versions using versioned source evidence, test each contract independently for batch/online parity and validate both model-specific vectors.
At request or job admission I would pin the model release and resolve the corresponding feature bundle, rather than fetch latest. I would validate the actual scoped input and freshness and fail or use an approved complete fallback release when a dependency is unavailable. Shadow validation and bounded rollout would measure both technical health and model outcomes. Rollback would restore the whole compatible path with current evidence and a new routing epoch. I would maintain a dependency graph for active models, rollback, in-flight work, derived features and historical reconstruction. Only after fencing new references, draining existing consumers and satisfying recovery and retention gates would I retire old schema support.
The success criterion is not that every producer emits the newest schema. It is that every supported model continues to receive the exact meaning, representation and evidence contract it was approved to consume throughout migration and recovery.
References and research transparency#
Authorized offline research exception applied. These references identify established serialization and versioning specifications, feature store documentation, ML engineering, data versioning and reliability guidance. Live URL availability, current contents and the Supabase changelog were not verified. Four meaningful standard triple-backtick Mermaid diagrams received structural review; no parser or live frontend rendering was tested. The exact Python fixture was executed locally using Python 3.13.5 and passed all 25 assertions. Its scope is limited to synthetic routing and validation, not actual schema-registry, feature-store, model serving, distributed concurrency, security, load or rollout testing. Scenarios and capacity estimates are hypothetical.
- Apache Avro — Specification
- Confluent — Schema evolution and compatibility
- Protocol Buffers — Updating a message type
- Semantic Versioning 2.0.0
- Feast — Feature services
- Feast — Point-in-time joins
- Google — Rules of Machine Learning
- Sculley et al. — Hidden Technical Debt in Machine Learning Systems
- Google SRE Workbook — Canarying Releases
- Apache Iceberg — Table Specification
- OpenLineage — Specification
- PostgreSQL — Transaction Isolation
- NIST — AI Risk Management Framework 1.0
References
- 1.Apache Avro — Specificationavro.apache.org
- 2.Confluent — Schema evolution and compatibilitydocs.confluent.io
- 3.Protocol Buffers — Updating a message typeprotobuf.dev
- 4.Semantic Versioning 2.0.0semver.org
- 5.Feast — Feature servicesdocs.feast.dev
- 6.Feast — Point-in-time joinsdocs.feast.dev
- 7.Google — Rules of Machine Learningdevelopers.google.com
- 8.
- 9.Google SRE Workbook — Canarying Releasessre.google
- 10.Apache Iceberg — Table Specificationiceberg.apache.org
- 11.OpenLineage — Specificationopenlineage.io
- 12.PostgreSQL — Transaction Isolationpostgresql.org
- 13.
Related questions
Explore other topics:Forward Deployed EngineeringMachine LearningMLOpsPython