AI systems & deployment
A Fast Model Still Waits for Its Dependencies
Follow a prediction request through concurrent feature services, a shared deadline and an explicit choice between a full model, a reduced model and no score.
Source case: Nubank. The article separates the published design from the data, methods and observations in this local experiment.
The model is ready; the request context is not
A prediction service can load its model and calculate a score quickly, yet miss its caller’s response budget. It first needs profile state, recent activity and longer-term history from other services. Three individually acceptable waits can become an unacceptable total when executed sequentially. A successful response from an old snapshot creates a different problem: it arrives quickly but supplies the wrong information state.
The operational question is therefore larger than model execution time. Which dependencies can be fetched together? Which facts must be present before any score is meaningful? When a history source is unavailable, can another model operate on the remaining evidence without pretending that missing information was observed?
Read the published system as a dependency graph
Nubank’s 7 April 2025 account describes a Model Server with Clojure integration and Python inference, parallel service retrieval, dependency monitoring and timeouts. It separates short-term streaming features from longer-term batch features and uses shadow execution before customer-facing deployment. These are the published practices; the article does not specify the reduced-model policy implemented in this study.
Independent study design inspired by Nubank's dependency-retrieval problem. The local HTTP interfaces, freshness limits and reduced-model policy are implemented study choices, not Nubank's disclosed architecture.
Design reference: Building Nubank · 7 April 2025
The graph matters before selecting a concurrency primitive. Independent lookups can overlap; a lookup that needs an identifier returned by another service cannot begin with an invented value. In this experiment, all three local services resolve the same authored entity key, so their requests are independent. The profile also confirms the issuer binding used by the request. An inconsistent binding withholds the score rather than combining two contexts.
For genuinely independent waits, sequential time approximately accumulates, while concurrent waiting is governed by the slowest outstanding dependency. That is a structural argument, not a promise that concurrency is free: connection limits, downstream contention, cancellation and serialization still consume resources. The run below isolates waiting behaviour with deliberately injected service delays.
Give the request one deadline, not three fresh allowances
The actual implementation starts three loopback HTTP services. Each returns a JSON feature snapshot after an authored delay. The caller establishes one deadline at request start. Every fetch receives the remaining time, calculated as deadline - loop.time(). The concurrent path schedules all three fetches together; the sequential path starts each only after the previous one finishes.
Giving every sequential call a fresh 60ms allowance would let three dependencies consume nearly 180ms before model execution. Sharing the deadline makes that hidden extension visible. A late first source can leave no time for a later source even when the later source itself is healthy.
The healthy scenario injects 20, 25 and 30ms waits. In the retained run, sequential fetch-and-route time is about 83ms, versus 33ms concurrently. Under a 60ms budget, the sequential issuer-history request times out; the concurrent request keeps all inputs. These measured values include local protocol, validation and routing overhead. The source delays are controlled inputs, not measured bank-service behaviour.
The slow-card scenario exposes the limit of concurrency. Its 200ms response exceeds the shared 100ms budget in both modes. Parallel retrieval still obtains valid issuer history; sequential retrieval exhausts its budget before starting that lookup. Both select the reduced model because the full model requires both histories. Preserving one additional feature would only help if another model contract explicitly supported that combination.
Timeout cleanup and event-loop scheduling also explain why recorded elapsed time can slightly exceed the configured budget. The deadline bounds dependency waiting; it is not a hard real-time bound on the entire response, and it does not interrupt model scoring.
Validate what arrived before deciding what can be scored
An HTTP200 response is only a transport observation. The host checks the entity, schema, timestamp and count structure before using the payload. A history must contain integer attempts and declines, with declines between zero and attempts. A future timestamp fails the same eligibility boundary as an excessively old one.
The teaching contract permits thirty seconds of age for card history, an hour for issuer history and a minute for profile state. These authored limits illustrate different source contracts; they are not recommended banking thresholds. A real choice would need the feature’s business meaning, update process and acceptable predictive degradation. A large aggregation window does not automatically make delayed updates harmless.
The stale-issuer case returns quickly but exceeds its age limit. Both retrieval modes select the reduced model. The wrong-entity case also returns quickly, but its card history belongs to another synthetic entity. Matching the JSON shape is insufficient; the card history is rejected. Concurrency cannot make either payload usable.
Missing profile state leads to a stricter outcome. Its HTTP503 prevents any score because the request lacks required context. This is a declared application boundary, not a prediction that the transaction is risky. Equality with a supplied entity key also does not establish authentication; the experiment begins with a fixed local context rather than implementing a bank’s identity infrastructure.
This implementation waits for the bounded sibling fetches even when the profile has already failed. Cancelling those remaining tasks could save work, but would introduce another task-ownership and evidence-capture decision. That optimization is not measured by the twelve-request comparison.
A fallback is another model contract
The full model reuses the fitted seven-feature artifact from the synthetic payment study. It consumes log amount, night, weekend, issuer indicators and two smoothed history rates. The new direct-only model is actually fitted on the same synthetic events, using only the first five variables.
The reduced model has its own scaling parameters, weights and validation-selected threshold. Training uses days 0–53; days 54–71 select its threshold under the same illustrative loss FP + 6 × FN. Days 72–89 provide the final diagnostic. All training settings are fixed before the service scenarios, and no dependency failure is used to tune that threshold.
def choose_model(context, fetched, full_model, reduced):
"""A missing history selects a different model; it is not a zero-valued history."""
values = {row['source']: row for row in fetched}
if values['profile']['status'] != 'valid':
return {'path': 'held', 'score': None, 'bundle': None,
'reason': 'required_profile_unavailable'}
direct = [math.log1p(context['amount']), int(context['hour'] < 6), int(context['weekday'] >= 5),
int(context['issuer'] == 1), int(context['issuer'] == 2)]
full = all(values[name]['status'] == 'valid' for name in ('card', 'issuer'))
if full:
histories = [values[name]['value']['counts'] for name in ('card', 'issuer')]
vector = direct + [(1 + row['declines']) / (20 + row['attempts']) for row in histories]
model, threshold, bundle = full_model, .1, 'full-history-v1'
else:
vector, model, threshold, bundle = direct, reduced['model'], reduced['threshold'], 'direct-only-v1'
return {'path': 'full' if full else 'reduced', 'score': score(model, vector),
'bundle': bundle, 'bundle_sha256': digest({'model': model, 'threshold': threshold}),
'feature_vector': vector, 'threshold': threshold,
'reason': 'all_inputs_valid' if full else 'history_unavailable_select_reduced_model'}There is an important distinction between an unavailable history and an observed empty history. The full model’s smoothed rate for zero observed attempts is a legitimate cold-start representation. Using that same number after a timeout would make the model consume a meaning it was not given. The reduced path avoids this substitution by omitting those dimensions entirely and identifying the different bundle in the result.
| Final-window diagnostic | Full history model | Direct-only model |
|---|---|---|
| Input dimensions | 7 | 5 |
| Validation-selected threshold | 0.10 | 0.08 |
| Flagged events among 1,080 | 26 | 42 |
| Brier score | 0.05631 | 0.05660 |
| Arbitrary error-cost units | 402 | 404 |
The no-flag reference costs 390 units on this window. Neither policy has demonstrated a useful operating decision under these assumptions. The reduced model demonstrates a meaningful serving alternative, not a validated improvement or an approved payment policy.
Its evaluation population also matters. Service failures may correlate with a particular issuer, region or traffic spike. Performance on the entire synthetic test window cannot establish quality on that failure-selected subset. A production adoption decision would need those segments and the fallback’s permitted use defined in advance.
Keep latency, eligibility and prediction evidence separate
The recorded execution contains twelve requests: six explicit scenarios, each run sequentially and concurrently. The comparison exposes three different engineering decisions.
| Observation | Supported response |
|---|---|
| Healthy independent waits accumulate | Overlap them under a shared deadline. |
| A response is stale, mismatched or unavailable | Preserve its reason and select only a compatible model path. |
| Required context is missing | Withhold the score. |
| A reduced model executes successfully | Evaluate its own predictions and permitted population before adopting it. |
Every completed response retains its original HTTP body and hash. Offline replay rechecks the body, parsed value, server trace, eligibility decision and model selection. Timings remain the observations of that actual execution; replay does not regenerate them and pretend they are deterministic.
Inspect all twelve HTTP observations and the model paths they produced
What the experiment actually shows
Actual local HTTP dependency requests with injected delays. Full and separately fitted direct-feature models use synthetic issuer-decline data; no Nubank model or live financial action.
Data and comparison boundary
Methods compared
- Sequential retrieval
- Each HTTP fetch uses the remaining shared budget. Earlier waits can exhaust time for later sources.
- Parallel retrieval
- All independent fetches share the same deadline. A successful response must still satisfy identity, schema and freshness.
- Explicit model selection
- History loss selects a separately fitted five-feature bundle; missing required profile data withholds the score.
Recorded findings
- Sequential dispositions
- {"full": 1, "reduced": 4, "held": 1}
Controlled cases, not a population coverage rate.
- Parallel dispositions
- {"full": 2, "reduced": 3, "held": 1}
Concurrency changes waiting; stale or mismatched features remain invalid.
- Reduced model diagnostic cost
- 404
Full model costs 402; the no-flag reference costs 390 on the same synthetic final window. The fallback is an experimental serving option, not an approved superior policy.
Inspect a recorded example
Healthy
{ "id": "healthy", "budget_ms": 120, "delay_ms": { "profile": 20, "card": 25, "issuer": 30 }, "fault": null }
Baseline output
{ "scenario": "healthy", "mode": "sequential", "budget_ms": 120, "local_elapsed_ms": 82.63408400000002, "dependencies": [ { "source": "profile", "status": "valid", "elapsed_ms": 22.511374999999994, "http_status": 200, "body": "{\"entity\": \"demo-card\", \"issuer\": 0, \"observed_at\": 9995, \"schema\": \"profile-v1\"}", "body_sha256": "a4e574a504fbdd1093d322bda67c9c2744a15914d1dd5f782e95d8d1d3248468", "value": { "entity": "demo-card", "issuer": 0, "observed_at": 9995, "schema": "profile-v1" } }, { "source": "card", "status": "valid", "elapsed_ms": 27.372000000000007, "http_status": 200, "body": "{\"counts\": {\"attempts\": 40, \"declines\": 2}, \"entity\": \"demo-card\", \"observed_at\": 9998, \"schema\": \"history-v1\"}", "body_sha256": "3cb78bc0741cc6928559b3d984a353fb9cbb2e5cc9197041fde4c69c478e87d7", "value": { "counts": { "attempts": 40, "declines": 2 }, "entity": "demo-card", "observed_at": 9998, "schema": "history-v1" } }, { "source": "issuer", "status": "valid", "elapsed_ms": 32.69937500000002, "http_status": 200, "body": "{\"counts\": {\"attempts\": 200, \"declines\": 8}, \"entity\": \"demo-card\", \"observed_at\": 9700, \"schema\": \"history-v1\"}", "body_sha256": "0ffc24ac5d2c19280f90cca5549cd8d758017332602e3fb9aa3ae6ad02e29fe5", "value": { "counts": { "attempts": 200, "declines": 8 }, "entity": "demo-card", "observed_at": 9700, "schema": "history-v1" } } ], "outcome": { "path": "full", "score": 0.02580674665225191, "bundle": "full-history-v1", "bundle_sha256": "acb6e1321276cdd15b4fde9bf37dd4c1cb13ae5b1ebcf46b8cf94362e4c37db3", "feature_vector": [ 3.713572066704308, 0, 0, 0, 0, 0.05, 0.04090909090909091 ], "threshold": 0.1, "reason": "all_inputs_valid" } }
Candidate output
{ "scenario": "healthy", "mode": "parallel", "budget_ms": 120, "local_elapsed_ms": 33.030583, "dependencies": [ { "source": "profile", "status": "valid", "elapsed_ms": 23.084041, "http_status": 200, "body": "{\"entity\": \"demo-card\", \"issuer\": 0, \"observed_at\": 9995, \"schema\": \"profile-v1\"}", "body_sha256": "a4e574a504fbdd1093d322bda67c9c2744a15914d1dd5f782e95d8d1d3248468", "value": { "entity": "demo-card", "issuer": 0, "observed_at": 9995, "schema": "profile-v1" } }, { "source": "card", "status": "valid", "elapsed_ms": 27.814458000000013, "http_status": 200, "body": "{\"counts\": {\"attempts\": 40, \"declines\": 2}, \"entity\": \"demo-card\", \"observed_at\": 9998, \"schema\": \"history-v1\"}", "body_sha256": "3cb78bc0741cc6928559b3d984a353fb9cbb2e5cc9197041fde4c69c478e87d7", "value": { "counts": { "attempts": 40, "declines": 2 }, "entity": "demo-card", "observed_at": 9998, "schema": "history-v1" } }, { "source": "issuer", "status": "valid", "elapsed_ms": 32.875667, "http_status": 200, "body": "{\"counts\": {\"attempts\": 200, \"declines\": 8}, \"entity\": \"demo-card\", \"observed_at\": 9700, \"schema\": \"history-v1\"}", "body_sha256": "0ffc24ac5d2c19280f90cca5549cd8d758017332602e3fb9aa3ae6ad02e29fe5", "value": { "counts": { "attempts": 200, "declines": 8 }, "entity": "demo-card", "observed_at": 9700, "schema": "history-v1" } } ], "outcome": { "path": "full", "score": 0.02580674665225191, "bundle": "full-history-v1", "bundle_sha256": "acb6e1321276cdd15b4fde9bf37dd4c1cb13ae5b1ebcf46b8cf94362e4c37db3", "feature_vector": [ 3.713572066704308, 0, 0, 0, 0, 0.05, 0.04090909090909091 ], "threshold": 0.1, "reason": "all_inputs_valid" } }
Tight budget
{ "id": "tight_budget", "budget_ms": 60, "delay_ms": { "profile": 20, "card": 25, "issuer": 30 }, "fault": null }
Baseline output
{ "scenario": "tight_budget", "mode": "sequential", "budget_ms": 60, "local_elapsed_ms": 61.19862500000001, "dependencies": [ { "source": "profile", "status": "valid", "elapsed_ms": 22.771209000000013, "http_status": 200, "body": "{\"entity\": \"demo-card\", \"issuer\": 0, \"observed_at\": 9995, \"schema\": \"profile-v1\"}", "body_sha256": "a4e574a504fbdd1093d322bda67c9c2744a15914d1dd5f782e95d8d1d3248468", "value": { "entity": "demo-card", "issuer": 0, "observed_at": 9995, "schema": "profile-v1" } }, { "source": "card", "status": "valid", "elapsed_ms": 27.849709, "http_status": 200, "body": "{\"counts\": {\"attempts\": 40, \"declines\": 2}, \"entity\": \"demo-card\", \"observed_at\": 9998, \"schema\": \"history-v1\"}", "body_sha256": "3cb78bc0741cc6928559b3d984a353fb9cbb2e5cc9197041fde4c69c478e87d7", "value": { "counts": { "attempts": 40, "declines": 2 }, "entity": "demo-card", "observed_at": 9998, "schema": "history-v1" } }, { "source": "issuer", "status": "timeout", "elapsed_ms": 10.523291999999989 } ], "outcome": { "path": "reduced", "score": 0.024677030382598993, "bundle": "direct-only-v1", "bundle_sha256": "35541904046b4529f68e161bc8151f2f5063bb2ce089e73097f7b3494b16472b", "feature_vector": [ 3.713572066704308, 0, 0, 0, 0 ], "threshold": 0.08, "reason": "history_unavailable_select_reduced_model" } }
Candidate output
{ "scenario": "tight_budget", "mode": "parallel", "budget_ms": 60, "local_elapsed_ms": 32.839290999999996, "dependencies": [ { "source": "profile", "status": "valid", "elapsed_ms": 22.315083999999985, "http_status": 200, "body": "{\"entity\": \"demo-card\", \"issuer\": 0, \"observed_at\": 9995, \"schema\": \"profile-v1\"}", "body_sha256": "a4e574a504fbdd1093d322bda67c9c2744a15914d1dd5f782e95d8d1d3248468", "value": { "entity": "demo-card", "issuer": 0, "observed_at": 9995, "schema": "profile-v1" } }, { "source": "card", "status": "valid", "elapsed_ms": 27.71825, "http_status": 200, "body": "{\"counts\": {\"attempts\": 40, \"declines\": 2}, \"entity\": \"demo-card\", \"observed_at\": 9998, \"schema\": \"history-v1\"}", "body_sha256": "3cb78bc0741cc6928559b3d984a353fb9cbb2e5cc9197041fde4c69c478e87d7", "value": { "counts": { "attempts": 40, "declines": 2 }, "entity": "demo-card", "observed_at": 9998, "schema": "history-v1" } }, { "source": "issuer", "status": "valid", "elapsed_ms": 32.718416999999974, "http_status": 200, "body": "{\"counts\": {\"attempts\": 200, \"declines\": 8}, \"entity\": \"demo-card\", \"observed_at\": 9700, \"schema\": \"history-v1\"}", "body_sha256": "0ffc24ac5d2c19280f90cca5549cd8d758017332602e3fb9aa3ae6ad02e29fe5", "value": { "counts": { "attempts": 200, "declines": 8 }, "entity": "demo-card", "observed_at": 9700, "schema": "history-v1" } } ], "outcome": { "path": "full", "score": 0.02580674665225191, "bundle": "full-history-v1", "bundle_sha256": "acb6e1321276cdd15b4fde9bf37dd4c1cb13ae5b1ebcf46b8cf94362e4c37db3", "feature_vector": [ 3.713572066704308, 0, 0, 0, 0, 0.05, 0.04090909090909091 ], "threshold": 0.1, "reason": "all_inputs_valid" } }
Slow card
{ "id": "slow_card", "budget_ms": 100, "delay_ms": { "profile": 20, "card": 200, "issuer": 30 }, "fault": null }
Baseline output
{ "scenario": "slow_card", "mode": "sequential", "budget_ms": 100, "local_elapsed_ms": 101.672708, "dependencies": [ { "source": "profile", "status": "valid", "elapsed_ms": 22.38916599999996, "http_status": 200, "body": "{\"entity\": \"demo-card\", \"issuer\": 0, \"observed_at\": 9995, \"schema\": \"profile-v1\"}", "body_sha256": "a4e574a504fbdd1093d322bda67c9c2744a15914d1dd5f782e95d8d1d3248468", "value": { "entity": "demo-card", "issuer": 0, "observed_at": 9995, "schema": "profile-v1" } }, { "source": "card", "status": "timeout", "elapsed_ms": 79.13233400000003 }, { "source": "issuer", "status": "deadline_exhausted", "elapsed_ms": 0.0 } ], "outcome": { "path": "reduced", "score": 0.024677030382598993, "bundle": "direct-only-v1", "bundle_sha256": "35541904046b4529f68e161bc8151f2f5063bb2ce089e73097f7b3494b16472b", "feature_vector": [ 3.713572066704308, 0, 0, 0, 0 ], "threshold": 0.08, "reason": "history_unavailable_select_reduced_model" } }
Candidate output
{ "scenario": "slow_card", "mode": "parallel", "budget_ms": 100, "local_elapsed_ms": 102.86904199999996, "dependencies": [ { "source": "profile", "status": "valid", "elapsed_ms": 24.492875000000026, "http_status": 200, "body": "{\"entity\": \"demo-card\", \"issuer\": 0, \"observed_at\": 9995, \"schema\": \"profile-v1\"}", "body_sha256": "a4e574a504fbdd1093d322bda67c9c2744a15914d1dd5f782e95d8d1d3248468", "value": { "entity": "demo-card", "issuer": 0, "observed_at": 9995, "schema": "profile-v1" } }, { "source": "card", "status": "timeout", "elapsed_ms": 102.03399999999996 }, { "source": "issuer", "status": "valid", "elapsed_ms": 34.294875000000005, "http_status": 200, "body": "{\"counts\": {\"attempts\": 200, \"declines\": 8}, \"entity\": \"demo-card\", \"observed_at\": 9700, \"schema\": \"history-v1\"}", "body_sha256": "0ffc24ac5d2c19280f90cca5549cd8d758017332602e3fb9aa3ae6ad02e29fe5", "value": { "counts": { "attempts": 200, "declines": 8 }, "entity": "demo-card", "observed_at": 9700, "schema": "history-v1" } } ], "outcome": { "path": "reduced", "score": 0.024677030382598993, "bundle": "direct-only-v1", "bundle_sha256": "35541904046b4529f68e161bc8151f2f5063bb2ce089e73097f7b3494b16472b", "feature_vector": [ 3.713572066704308, 0, 0, 0, 0 ], "threshold": 0.08, "reason": "history_unavailable_select_reduced_model" } }
Stale issuer
{ "id": "stale_issuer", "budget_ms": 120, "delay_ms": { "profile": 20, "card": 25, "issuer": 30 }, "fault": "stale_issuer" }
Baseline output
{ "scenario": "stale_issuer", "mode": "sequential", "budget_ms": 120, "local_elapsed_ms": 91.60124999999996, "dependencies": [ { "source": "profile", "status": "valid", "elapsed_ms": 25.598415999999958, "http_status": 200, "body": "{\"entity\": \"demo-card\", \"issuer\": 0, \"observed_at\": 9995, \"schema\": \"profile-v1\"}", "body_sha256": "a4e574a504fbdd1093d322bda67c9c2744a15914d1dd5f782e95d8d1d3248468", "value": { "entity": "demo-card", "issuer": 0, "observed_at": 9995, "schema": "profile-v1" } }, { "source": "card", "status": "valid", "elapsed_ms": 30.43233299999992, "http_status": 200, "body": "{\"counts\": {\"attempts\": 40, \"declines\": 2}, \"entity\": \"demo-card\", \"observed_at\": 9998, \"schema\": \"history-v1\"}", "body_sha256": "3cb78bc0741cc6928559b3d984a353fb9cbb2e5cc9197041fde4c69c478e87d7", "value": { "counts": { "attempts": 40, "declines": 2 }, "entity": "demo-card", "observed_at": 9998, "schema": "history-v1" } }, { "source": "issuer", "status": "stale_or_future", "elapsed_ms": 35.34120799999996, "http_status": 200, "body": "{\"counts\": {\"attempts\": 200, \"declines\": 8}, \"entity\": \"demo-card\", \"observed_at\": 2800, \"schema\": \"history-v1\"}", "body_sha256": "1ebe3c87f00941080cc2bd6ae49a997f5bee378c26adf10943cc626430702edf", "value": { "counts": { "attempts": 200, "declines": 8 }, "entity": "demo-card", "observed_at": 2800, "schema": "history-v1" } } ], "outcome": { "path": "reduced", "score": 0.024677030382598993, "bundle": "direct-only-v1", "bundle_sha256": "35541904046b4529f68e161bc8151f2f5063bb2ce089e73097f7b3494b16472b", "feature_vector": [ 3.713572066704308, 0, 0, 0, 0 ], "threshold": 0.08, "reason": "history_unavailable_select_reduced_model" } }
Candidate output
{ "scenario": "stale_issuer", "mode": "parallel", "budget_ms": 120, "local_elapsed_ms": 36.84949999999998, "dependencies": [ { "source": "profile", "status": "valid", "elapsed_ms": 25.54262500000004, "http_status": 200, "body": "{\"entity\": \"demo-card\", \"issuer\": 0, \"observed_at\": 9995, \"schema\": \"profile-v1\"}", "body_sha256": "a4e574a504fbdd1093d322bda67c9c2744a15914d1dd5f782e95d8d1d3248468", "value": { "entity": "demo-card", "issuer": 0, "observed_at": 9995, "schema": "profile-v1" } }, { "source": "card", "status": "valid", "elapsed_ms": 30.211333000000007, "http_status": 200, "body": "{\"counts\": {\"attempts\": 40, \"declines\": 2}, \"entity\": \"demo-card\", \"observed_at\": 9998, \"schema\": \"history-v1\"}", "body_sha256": "3cb78bc0741cc6928559b3d984a353fb9cbb2e5cc9197041fde4c69c478e87d7", "value": { "counts": { "attempts": 40, "declines": 2 }, "entity": "demo-card", "observed_at": 9998, "schema": "history-v1" } }, { "source": "issuer", "status": "stale_or_future", "elapsed_ms": 36.334417000000066, "http_status": 200, "body": "{\"counts\": {\"attempts\": 200, \"declines\": 8}, \"entity\": \"demo-card\", \"observed_at\": 2800, \"schema\": \"history-v1\"}", "body_sha256": "1ebe3c87f00941080cc2bd6ae49a997f5bee378c26adf10943cc626430702edf", "value": { "counts": { "attempts": 200, "declines": 8 }, "entity": "demo-card", "observed_at": 2800, "schema": "history-v1" } } ], "outcome": { "path": "reduced", "score": 0.024677030382598993, "bundle": "direct-only-v1", "bundle_sha256": "35541904046b4529f68e161bc8151f2f5063bb2ce089e73097f7b3494b16472b", "feature_vector": [ 3.713572066704308, 0, 0, 0, 0 ], "threshold": 0.08, "reason": "history_unavailable_select_reduced_model" } }
Missing profile
{ "id": "missing_profile", "budget_ms": 120, "delay_ms": { "profile": 20, "card": 25, "issuer": 30 }, "fault": "missing_profile" }
Baseline output
{ "scenario": "missing_profile", "mode": "sequential", "budget_ms": 120, "local_elapsed_ms": 86.71774999999992, "dependencies": [ { "source": "profile", "status": "http_503", "elapsed_ms": 24.619666000000095, "http_status": 503, "body": "{\"entity\": \"demo-card\", \"issuer\": 0, \"observed_at\": 9995, \"schema\": \"profile-v1\"}", "body_sha256": "a4e574a504fbdd1093d322bda67c9c2744a15914d1dd5f782e95d8d1d3248468", "value": { "entity": "demo-card", "issuer": 0, "observed_at": 9995, "schema": "profile-v1" } }, { "source": "card", "status": "valid", "elapsed_ms": 29.360541999999935, "http_status": 200, "body": "{\"counts\": {\"attempts\": 40, \"declines\": 2}, \"entity\": \"demo-card\", \"observed_at\": 9998, \"schema\": \"history-v1\"}", "body_sha256": "3cb78bc0741cc6928559b3d984a353fb9cbb2e5cc9197041fde4c69c478e87d7", "value": { "counts": { "attempts": 40, "declines": 2 }, "entity": "demo-card", "observed_at": 9998, "schema": "history-v1" } }, { "source": "issuer", "status": "valid", "elapsed_ms": 32.68645799999992, "http_status": 200, "body": "{\"counts\": {\"attempts\": 200, \"declines\": 8}, \"entity\": \"demo-card\", \"observed_at\": 9700, \"schema\": \"history-v1\"}", "body_sha256": "0ffc24ac5d2c19280f90cca5549cd8d758017332602e3fb9aa3ae6ad02e29fe5", "value": { "counts": { "attempts": 200, "declines": 8 }, "entity": "demo-card", "observed_at": 9700, "schema": "history-v1" } } ], "outcome": { "path": "held", "score": null, "bundle": null, "reason": "required_profile_unavailable" } }
Candidate output
{ "scenario": "missing_profile", "mode": "parallel", "budget_ms": 120, "local_elapsed_ms": 35.53820800000007, "dependencies": [ { "source": "profile", "status": "http_503", "elapsed_ms": 26.82858399999999, "http_status": 503, "body": "{\"entity\": \"demo-card\", \"issuer\": 0, \"observed_at\": 9995, \"schema\": \"profile-v1\"}", "body_sha256": "a4e574a504fbdd1093d322bda67c9c2744a15914d1dd5f782e95d8d1d3248468", "value": { "entity": "demo-card", "issuer": 0, "observed_at": 9995, "schema": "profile-v1" } }, { "source": "card", "status": "valid", "elapsed_ms": 28.165833000000084, "http_status": 200, "body": "{\"counts\": {\"attempts\": 40, \"declines\": 2}, \"entity\": \"demo-card\", \"observed_at\": 9998, \"schema\": \"history-v1\"}", "body_sha256": "3cb78bc0741cc6928559b3d984a353fb9cbb2e5cc9197041fde4c69c478e87d7", "value": { "counts": { "attempts": 40, "declines": 2 }, "entity": "demo-card", "observed_at": 9998, "schema": "history-v1" } }, { "source": "issuer", "status": "valid", "elapsed_ms": 35.277833999999956, "http_status": 200, "body": "{\"counts\": {\"attempts\": 200, \"declines\": 8}, \"entity\": \"demo-card\", \"observed_at\": 9700, \"schema\": \"history-v1\"}", "body_sha256": "0ffc24ac5d2c19280f90cca5549cd8d758017332602e3fb9aa3ae6ad02e29fe5", "value": { "counts": { "attempts": 200, "declines": 8 }, "entity": "demo-card", "observed_at": 9700, "schema": "history-v1" } } ], "outcome": { "path": "held", "score": null, "bundle": null, "reason": "required_profile_unavailable" } }
Wrong entity
{ "id": "wrong_entity", "budget_ms": 120, "delay_ms": { "profile": 20, "card": 25, "issuer": 30 }, "fault": "wrong_card_entity" }
Baseline output
{ "scenario": "wrong_entity", "mode": "sequential", "budget_ms": 120, "local_elapsed_ms": 89.74320800000002, "dependencies": [ { "source": "profile", "status": "valid", "elapsed_ms": 25.794292000000052, "http_status": 200, "body": "{\"entity\": \"demo-card\", \"issuer\": 0, \"observed_at\": 9995, \"schema\": \"profile-v1\"}", "body_sha256": "a4e574a504fbdd1093d322bda67c9c2744a15914d1dd5f782e95d8d1d3248468", "value": { "entity": "demo-card", "issuer": 0, "observed_at": 9995, "schema": "profile-v1" } }, { "source": "card", "status": "entity_mismatch", "elapsed_ms": 29.941042000000028, "http_status": 200, "body": "{\"counts\": {\"attempts\": 40, \"declines\": 2}, \"entity\": \"another-demo-card\", \"observed_at\": 9998, \"schema\": \"history-v1\"}", "body_sha256": "f9b4b329be2bc585861ca1fe470d1b7f460aa88a4784bc02a73dd8c3c446af9e", "value": { "counts": { "attempts": 40, "declines": 2 }, "entity": "another-demo-card", "observed_at": 9998, "schema": "history-v1" } }, { "source": "issuer", "status": "valid", "elapsed_ms": 33.84658299999999, "http_status": 200, "body": "{\"counts\": {\"attempts\": 200, \"declines\": 8}, \"entity\": \"demo-card\", \"observed_at\": 9700, \"schema\": \"history-v1\"}", "body_sha256": "0ffc24ac5d2c19280f90cca5549cd8d758017332602e3fb9aa3ae6ad02e29fe5", "value": { "counts": { "attempts": 200, "declines": 8 }, "entity": "demo-card", "observed_at": 9700, "schema": "history-v1" } } ], "outcome": { "path": "reduced", "score": 0.024677030382598993, "bundle": "direct-only-v1", "bundle_sha256": "35541904046b4529f68e161bc8151f2f5063bb2ce089e73097f7b3494b16472b", "feature_vector": [ 3.713572066704308, 0, 0, 0, 0 ], "threshold": 0.08, "reason": "history_unavailable_select_reduced_model" } }
Candidate output
{ "scenario": "wrong_entity", "mode": "parallel", "budget_ms": 120, "local_elapsed_ms": 35.332292000000095, "dependencies": [ { "source": "profile", "status": "valid", "elapsed_ms": 25.50179100000005, "http_status": 200, "body": "{\"entity\": \"demo-card\", \"issuer\": 0, \"observed_at\": 9995, \"schema\": \"profile-v1\"}", "body_sha256": "a4e574a504fbdd1093d322bda67c9c2744a15914d1dd5f782e95d8d1d3248468", "value": { "entity": "demo-card", "issuer": 0, "observed_at": 9995, "schema": "profile-v1" } }, { "source": "card", "status": "entity_mismatch", "elapsed_ms": 30.577874999999977, "http_status": 200, "body": "{\"counts\": {\"attempts\": 40, \"declines\": 2}, \"entity\": \"another-demo-card\", \"observed_at\": 9998, \"schema\": \"history-v1\"}", "body_sha256": "f9b4b329be2bc585861ca1fe470d1b7f460aa88a4784bc02a73dd8c3c446af9e", "value": { "counts": { "attempts": 40, "declines": 2 }, "entity": "another-demo-card", "observed_at": 9998, "schema": "history-v1" } }, { "source": "issuer", "status": "valid", "elapsed_ms": 34.88120900000003, "http_status": 200, "body": "{\"counts\": {\"attempts\": 200, \"declines\": 8}, \"entity\": \"demo-card\", \"observed_at\": 9700, \"schema\": \"history-v1\"}", "body_sha256": "0ffc24ac5d2c19280f90cca5549cd8d758017332602e3fb9aa3ae6ad02e29fe5", "value": { "counts": { "attempts": 200, "declines": 8 }, "entity": "demo-card", "observed_at": 9700, "schema": "history-v1" } } ], "outcome": { "path": "reduced", "score": 0.024677030382598993, "bundle": "direct-only-v1", "bundle_sha256": "35541904046b4529f68e161bc8151f2f5063bb2ce089e73097f7b3494b16472b", "feature_vector": [ 3.713572066704308, 0, 0, 0, 0 ], "threshold": 0.08, "reason": "history_unavailable_select_reduced_model" } }
These are saved results. Switching examples runs no model or external service.
Limits of this experiment
- Service delays and faults are authored; measured milliseconds describe this local execution, not a Nubank SLA or load test.
- The deadline bounds dependency waiting; model execution has no independent timeout or resource quota in this study.
- The fallback was checked on the synthetic full test population, not a representative dependency-failure population. Its threshold is not a financial operating recommendation.
Inspect the recorded provenance
{
"recording_sha256": "d517cbc7fb3de8213afe67e89d8876443f2787b095c74eee93733d74aec64936",
"basis": {
"model.py": "3dcf7fb7fb2d6a21799800a931bb6f934dc5cabeec78540bb479aa4ab632c39a",
"serving.py": "60dc5354e5a1fd28aca15c02dbc6e472141ae1de9ec9e27170651843d3a4875f",
"run.py": "96f2e9aeb84a9a85293ff02ed9400804d87a45bcca427e8f064987ae6620efe4",
"train.py": "f3c3c3343dcc5d246575bdb3ce8565a37821a59026266dad5027ec6a555d3fd7",
"config.json": "d918fe7e34306505208625df38a5db977b0d8f14ee6e249c626a9a93fd1d5e3f",
"context.json": "9625e4d062a62641f29fec35091280a18c5382ec469067ccd2d6191efb83e375",
"full-model.json": "79fbfef4d60f37c270af0bae1b12949a2baed6ca18e9216251b5f0073ae428bc",
"reduced-model.json": "d125b4626b789c598c932e353d20954f836d96caace102743c69fb7d58e4c8c1",
"source-events.csv": "5b5829abf4bd3d92aa5b748a7339b7ca5f59c0e6063cf4bed6afb5ca50a388b4",
"lineage.json": "b72a462dff9f7dbba5dd63cb578e685e589bc3b98eb6f62dd32598811aed64e8",
"sources.json": "d65e45bd8cbf04b034449289ff2a049b17546c2745fa0d4ae0eddf201f65cc6b"
},
"runtime": {
"python": "3.9.6",
"system": "Darwin",
"machine": "arm64"
},
"lineage": {
"source-events.csv": {
"path": "engineering-lab/paypal/events.csv",
"sha256": "5b5829abf4bd3d92aa5b748a7339b7ca5f59c0e6063cf4bed6afb5ca50a388b4"
},
"full-model.json": {
"path": "engineering-lab/paypal-shadow/model.json",
"sha256": "79fbfef4d60f37c270af0bae1b12949a2baed6ca18e9216251b5f0073ae428bc"
}
},
"source": {
"article": "https://building.nu.com/practices-to-scale-machine-learning-operations/",
"csv_row": 24,
"csv_url": "https://building.nubank.com/practices-to-scale-machine-learning-operations/",
"publication": "2025-04-07",
"scope": "Independent dependency and model-selection experiment, not Nubank's fraud system",
"python": "https://docs.python.org/3/library/asyncio-task.html"
},
"training": {
"training_rows": 3240,
"validation_rows": 1080,
"threshold": 0.08,
"feature_names": [
"log_amount",
"night",
"weekend",
"issuer_1",
"issuer_2"
],
"test": {
"full": {
"threshold": 0.1,
"test_rows": 1080,
"brier": 0.05630538054980963,
"mean_score": 0.04555680920857979,
"flags": 26,
"tp": 2,
"fp": 24,
"fn": 63,
"arbitrary_cost_units": 402
},
"reduced": {
"threshold": 0.08,
"test_rows": 1080,
"brier": 0.056598238813166786,
"mean_score": 0.041071455546883566,
"flags": 42,
"tp": 4,
"fp": 38,
"fn": 61,
"arbitrary_cost_units": 404
}
}
}
}For a payment-analytics adaptation, I would begin with an explicit caller contract: what context is mandatory, which model versions accept which available inputs, and what the caller does with a withheld score. This study complements Faire’s availability-aware histories, Pinterest’s capture boundary and Shadow’s separate candidate execution. They address different points at which a model can receive or publish the wrong evidence.
Source credit and offline reproduction
The primary design reference is the Nubank article, CSV logical row 24. The experiment’s model predicts a synthetic issuer decline, while the source discusses fraud infrastructure. The label and deployment distinction are preserved. lineage.json identifies copied events and the full-model artifact; the original studies remain unchanged.
In engineering-lab/nubank-serving, run python3 run.py to verify and export the retained execution without network calls. python3 verify.py additionally reproduces the reduced-model fit. A separate copy without a recording accepts python3 run.py --execute to start temporary loopback services and collect a new run. Its README and explicit manifest document the data, model and operating boundaries.