LearnSystem design

ML platform for a bank (feature store, registry, deployment)

Design the internal platform that lets data scientists take a model from notebook to batch and real-time production safely, inside a regulated bank whose production stack is mostly Go microservices.

ML engineering8 parts

Contents

Constraints

  • 50 data scientists
  • 100 production models
  • real-time p99 budget 50 ms for payment-path models
  • hundreds of features shared across teams

What to cover

Sketch your own design first. A complete answer has these parts; the notes say what each should settle.

  1. RequirementsDesign the internal platform that lets data scientists take a model from notebook to batch and real-time production safely, inside a regulated bank whose production stack is mostly Go microservices.
  2. Estimates50 data scientists; 100 production models; real-time p99 budget 50 ms for payment-path models; hundreds of features shared across teams.
  3. API
  4. Data model
  5. ArchitectureMonorepo with dataset-creation and training jobs; managed training compute.; Model registry with validation status and lineage.; Feature definitions in SQL (e.g. dbt) materialised offline in the warehouse and synced to an online KV store.; Batch inference via a scheduler (e.g. Airflow) publishing events; real-time Python inference services behind a Go gateway.; Monitoring for systems, features (data tests and freshness alerts) and model performance.; Approval workflow for model risk; self-serve templates.
  6. Deep dives
  7. Trade-offsbuild vs buy (Vertex/SageMaker vs custom); framework freedom vs standardisation; a Python model service inside a Go ecosystem; one-off pipelines vs a shared feature store.
  8. EvaluationPlatform metrics: time from notebook to production, number of incidents attributable to the platform, feature reuse rate, p99 inference latency, cost per model.; User satisfaction surveys.

Reference design

One way to answer it, part by part. Open a part once you have your own version of it.

Requirements

Functional: a paved road from notebook to production for both batch and real-time models — reproducible dataset creation and training, shared feature definitions usable offline and online, a model registry with validation status and lineage, deployment (shadow, canary, live) into a Go microservice estate, monitoring, and a model-risk approval workflow.

Users: ~50 data scientists who know Python and SQL, not Go or Kubernetes; backend engineers who call models from Go services; model-risk and compliance reviewers.

Constraints

  • Regulated bank: auditable lineage (which data and code produced which model and decision), approvals proportional to risk (payment and credit decisions vs internal analytics), PRA model risk management expectations, Consumer Duty, explainability where customers are affected.
  • Real-time p99 ≤ 50 ms for payment-path models, including feature lookup.
  • ~100 production models, hundreds of shared features.
  • Existing stack (assumption): GCP, BigQuery, dbt, Airflow, Cassandra, Go microservices, an event bus, Grafana and Looker.

Success: time from notebook to production falls from months to weeks for standard models; fewer incidents; features reused rather than rebuilt.

Estimates

  • Models: ~100 in production, say 70 batch and 30 real-time; ~10 new or retrained models per week across teams.
  • Real-time traffic: payment-path models see ~1k requests/s at peak (card authorisations, transfers); other real-time models (chat routing, fraud on logins) a few hundred requests/s combined.
  • Online features: 10M customers × ~300 features × ~8 bytes ≈ 24 GB of values, ~100 GB with replication and overhead — small for Cassandra; read path p99 5–10 ms for a single-partition lookup.
  • Batch: ~70 Airflow DAGs nightly; BigQuery scans of a few TB/day for feature materialisation; predictions written back to BigQuery and published as events.
  • Latency budget (payment path, p99 50 ms): Go service → gateway 2 ms, feature fetch (one partition read) 10 ms, model inference (GBDT) 5 ms, serialisation and network 5 ms, gateway checks and logging 3 ms → ~25 ms, leaving ~25 ms headroom for tails and retries; a fallback default decision if the model does not answer within ~40 ms.
  • Training compute: most bank models are GBDTs or small networks trained on CPU in minutes to hours; occasional GPU jobs (text models) on a managed queue.
  • Platform team: ~6–8 engineers can run this if most components are managed services.

API

The platform’s interfaces are mostly declarative files and CLIs:

# features/customer_spend.yml (dbt model + metadata)
entity: customer_id
owner: fincrime-ds
freshness_sla: 1h
online: true
features: [spend_7d, spend_30d, distinct_merchants_30d]
ml train   --config train.yml           # dataset snapshot + training job, logs lineage
ml register --run r_123 --risk-tier 1   # → registry entry, status "draft"
ml validate --model fraud-auth:v12      # standard checks + validation report
ml deploy  --model fraud-auth:v12 --mode shadow|canary:5%|live

Serving contract for Go callers (protobuf over gRPC via the gateway):

Predict(model: "fraud-auth", entity_ids, request_features) → {score, version, reason_codes, latency_ms}

Batch outputs: BigQuery table per model plus an event prediction.published for downstream services.

Data model

  • FeatureDefinition: name, entity, SQL/dbt model, owner, version, freshness SLA, online flag, data classification, tests.
  • FeatureValue (online): Cassandra partition per entity → feature values with event timestamps.
  • DatasetSnapshot: query, as-of time, feature versions, row counts, storage URI, hash — point-in-time correct joins.
  • Model: name, version, artefact URI, framework, training code commit, dataset snapshot, feature list and versions, metrics, risk tier, owner, intended use, limitations.
  • ValidationRecord: checks run (performance, stability, bias, explainability), validator, findings, status (draft → validated → approved → deployed → retired).
  • Deployment: model version, environment, mode (shadow | canary | live), traffic share, start/end, rollback reference.
  • PredictionLog: request id, model version, feature values used, output, latency — basis for audit and for training on logged features.
  • MonitorConfig: metrics, thresholds, owners, escalation.

Architecture

Flow · 4 stepsNotebook to production: batch and real-time

Notebook to production: batch and real-timeA left-to-right flow: monorepo (dataset and training code from the notebook) feeds CI, then managed training compute, then the model registry, then the approval workflow and deploy step. Deploy splits into a batch branch (Airflow DAG scoring into BigQuery and an event) and a real-time branch (Go gateway to a Python model service to Cassandra). A feature store branch (dbt SQL in BigQuery synced to Cassandra) feeds the online store, and monitoring observes the serving path.Monorepofrom notebook: dataset + trainingcodeCItests, lint, data checksFeature storedbt SQL in BigQuery,synced to CassandraManaged training computeKubernetes / VertexModel registryartefact, lineage, validation status,risk tierApproval workflowtier 1 sign-off; tier 3 self-approvalDeployshadow | canary | liveBatch scoringAirflow DAG: BigQuerytable + eventGo gatewayauth, timeouts, circuitbreaker, fallbackMonitoringGrafana, dbt tests,LookerPython modelservicetemplate, autoscaledCassandraonline features, one partition perentityregisterbatchreal timefeature lookupfeature definitionssync1234BuildGovernanceServingObserve
  1. Build and train Dataset and training code live in the monorepo; CI runs tests, lint and data checks, then managed training compute trains the model.
  2. Register and approve The run is registered with lineage and validation status, then passes the risk-tier approval workflow before deployment.
  3. Serve Batch models score via the Airflow DAG into BigQuery and an event; real-time models pass through the Go gateway to the Python service, which reads Cassandra.
  4. Monitor Systems, features and model performance are monitored across both serving paths.

The paved road runs from the monorepo through CI, training, registry and approval to deployment, then splits into batch (Airflow DAG) and real-time (Go gateway, Python service, Cassandra).Diagram drafted by a local AI model (Inkling 2 Mini) from this page's text and drawn from data. Checked by an independent reviewer.
Data
Steps
StepTitleWhat happens
1Build and trainDataset and training code live in the monorepo; CI runs tests, lint and data checks, then managed training compute trains the model.
2Register and approveThe run is registered with lineage and validation status, then passes the risk-tier approval workflow before deployment.
3ServeBatch models score via the Airflow DAG into BigQuery and an event; real-time models pass through the Go gateway to the Python service, which reads Cassandra.
4MonitorSystems, features and model performance are monitored across both serving paths.

Source: This page's text

Boxes
BoxGroupDetail
MonorepoBuildfrom notebook: dataset + training code
CIBuildtests, lint, data checks
Managed training computeBuildKubernetes / Vertex
Model registryGovernanceartefact, lineage, validation status, risk tier
Approval workflowGovernancetier 1 sign-off; tier 3 self-approval
DeployGovernanceshadow | canary | live
Batch scoringServingAirflow DAG: BigQuery table + event
Go gatewayServingauth, timeouts, circuit breaker, fallback
Python model serviceServingtemplate, autoscaled
CassandraServingonline features, one partition per entity
Feature storeBuilddbt SQL in BigQuery, synced to Cassandra
MonitoringObserveGrafana, dbt tests, Looker

Source: This page's text

Stack · 5 layersOne feature definition, offline and online

  1. dbt SQL plus metadata: entity, owner, freshness SLA, online flag, features.

  2. dbt SQL in BigQuery, point-in-time joins for datasets.

  3. Sync job to Cassandra; Go stream processors for payment path, backfilled offline with the same definitions.

  4. Cassandra partition per entity, feature values with event timestamps.

  5. Daily tests compare offline and online values on sampled entities.

A single dbt feature definition feeds both the offline BigQuery path and the online Cassandra path, with daily tests comparing the two.Diagram drafted by a local AI model (Inkling 2 Mini) from this page's text and drawn from data. Checked by an independent reviewer.
Monorepo (dataset + training code, templates) ─► CI (tests, lint, data checks)
   ─► Managed training compute (jobs on Kubernetes / Vertex)
   ─► Model registry: artefact, lineage, validation status, risk tier
   ─► Approval workflow (tier 1: independent validation + sign-off;
      tier 3: owner self-approval with automated checks)
Features: dbt SQL in BigQuery (offline, point-in-time) ─► sync job ─► Cassandra (online)
          streaming features for payment path: Go stream processors writing
          to Cassandra, backfilled offline with the same definitions
Serving:
   batch ─► Airflow DAG template: score in BigQuery/Python ─► table + events
   real time ─► Go gateway (auth, timeouts, circuit breaker, schema checks,
                fallback default, logging) ─► Python model service (template,
                autoscaled) ─► Cassandra features
Monitoring: systems (Grafana), features (dbt tests/alerts), model performance
   and drift (Looker dashboards on prediction logs + labels), on-call per model

Deep dives

Sequence · 4 stepsSafe deployment: shadow, canary, live

Safe deployment: shadow, canary, liveA sequence from data scientist to registry, Go gateway, Python model service and monitoring. The deploy command is recorded against the registry entry; shadow traffic is scored and logged only, then compared with the incumbent; canary sends a small traffic share with automatic rollback on alarms; live serves full traffic.Data scientistModel registryGo gatewayPython modelserviceMonitoring1ml deploy --mode shadowscore (log only)2log predictionscomparison report3ml deploy --mode canary:5%canary trafficrollback on alarm4ml deploy --mode livefull traffic
Safe deployment: shadow, canary, liveA sequence from data scientist to registry, Go gateway, Python model service and monitoring. The deploy command is recorded against the registry entry; shadow traffic is scored and logged only, then compared with the incumbent; canary sends a small traffic share with automatic rollback on alarms; live serves full traffic.DatascientistModelregistryGogatewayPythonmodelserviceMonitoring1ml deploy --mode shadowscore (log only)2log predictionscomparison report3ml deploy --mode canary:5%canary trafficrollback on alarm4ml deploy --mode livefull traffic
  1. Shadow Shadow scores real traffic and logs only; the incumbent still serves.
  2. Compare Shadow output is compared with the incumbent on live data.
  3. Canary Canary sends a small traffic share; alarms trigger automatic rollback.
  4. Live Live serves full traffic; every deploy and rollback is recorded against the registry entry.

A model moves from shadow (log-only scoring of real traffic) through canary to live, with automatic rollback on latency or score-distribution alarms.Diagram drafted by a local AI model (Inkling 2 Mini) from this page's text and drawn from data. Checked by an independent reviewer.
Data
Messages
StepFromToMessage
1Data scientistModel registryml deploy --mode shadow
1Go gatewayPython model servicescore (log only)
2Python model serviceMonitoringlog predictions
2MonitoringData scientistcomparison report (reply)
3Data scientistModel registryml deploy --mode canary:5%
3Go gatewayPython model servicecanary traffic
3MonitoringGo gatewayrollback on alarm
4Data scientistModel registryml deploy --mode live
4Go gatewayPython model servicefull traffic

Source: This page's text

Training–serving skew. The most common real-time failure: a feature computed one way in SQL for training and another way in Go for serving. Mitigations: one definition per feature with tests comparing offline and online values on sampled entities daily; log the features actually used at serving time and train new versions on those logs where possible; point-in-time joins for offline datasets so no future data leaks in.

Python models inside a Go estate. Data scientists keep Python; the Go gateway owns everything operational (auth, deadlines, retries, circuit breaking, fallbacks, typed protobuf contracts), so Go services never depend on Python internals. For the strictest latency paths, GBDTs can be compiled (e.g. ONNX or a tree compiler) and served natively from Go, trading framework freedom for a removed network hop.

Safe deployment. Shadow first (score real traffic, log only), compare with the incumbent on live data, then canary with automatic rollback on latency or score-distribution alarms, then live. Every deploy and rollback is one command and is recorded against the registry entry for audit.

Trade-offs

  • Build vs buy (Vertex/SageMaker vs custom): managed services reduce platform toil but fit awkwardly with a Go estate, an existing Cassandra store and bank-specific approvals. Buy commodity parts (training compute, experiment tracking), build the thin glue the bank’s constraints require.
  • Framework freedom vs standardisation: freedom speeds research; standard templates (GBDT and PyTorch serving images, one feature API) make 100 models operable by a small team. Allow anything in research, require a template for production.
  • A Python model service inside a Go ecosystem: Python keeps data scientists productive but adds a hop and a second runtime to operate; contain it behind the gateway, and compile models to native code where latency demands.
  • One-off pipelines vs a shared feature store: one-off pipelines ship faster for the first model and then duplicate, drift and break; a shared store costs governance effort but gives reuse, consistency and lineage.

Evaluation

  • Platform metrics: median time from notebook to production per model type; number of incidents attributable to the platform (vs model logic); feature reuse rate (share of features used by more than one model); p99 inference latency per real-time model against its budget; cost per model (compute, storage, serving).
  • Governance metrics: share of production models with complete lineage and current validation (target 100%), approval cycle time, overdue revalidations.
  • Model health: drift and performance dashboards per model with owners; alerts on feature freshness, missing values, score distribution shifts, and outcome metrics once labels arrive.
  • User satisfaction surveys: quarterly survey of data scientists and backend engineers (ease of deployment, debugging, documentation), plus support-ticket themes driving the platform roadmap.

What a strong design shows

  • Designs the paved road end to end — features, training, registry, approvals, deployment, monitoring — around a Go estate and a regulated bank.
  • Keeps one feature definition across offline and online paths and actively tests for training–serving skew.
  • Proportions model-risk approvals to risk tier and records lineage for audit.
  • Isolates Python serving behind a Go gateway with deadlines, fallbacks and typed contracts, meeting a 50 ms p99 budget.
  • Measures the platform by time to production, incidents, reuse, latency and cost, plus user feedback.

Study material compiled with AI: drafted by a local model (Inkling 2 Mini) from public sources, then checked against those sources by independent AI reviewers (Claude) in November 2026. Not reviewed line by line by a person.