Skip to main content

Real architecture · Mid

Nubank: real-time ML alerts and automatic retraining

Real production architecture. Key points: drift alerts and retraining pipelines.

15 min read · Source: Nubank · Content reviewed on October 23, 2026

Short answer

Real production architecture. Key points: drift alerts and retraining pipelines. Nubank's ML team starts from an observation: a model served on demand is software, but with an important difference, because it can fail silently, producing wrong predictions without any exception or error message. That is the starting point for talking about monitoring and observability in an ML system.

01 · CONTEXT

Models that fail silently

Nubank's ML team starts from an observation: a model served on demand is software, but with an important difference, because it can fail silently, producing wrong predictions without any exception or error message. That is the starting point for talking about monitoring and observability in an ML system.

This case study brings together complementary Nubank topics: how to quickly warn when something is wrong with the served model, and how to replace it carefully with a retrained version.

Beyond the usual failures of any software, the source lists typical ML failure modes: missing or broken features and sudden shifts in the population distribution, both leading to wrong predictions.

02 · ALERTS

From the served model to the on-call

  1. The diagram shows business requests reaching the model, which reads its features from its own source.

    Architecture diagram: Alerts for a real-time ML model
    CLBusiness request
    CPReal-time model
    DBFeature source
    NWLogs, metrics, and traces
    CPHeartbeat checker
    CPAlert rules
    CLOn-call owner
  2. Even without exceptions or error messages, the model may be returning wrong predictions.

    Architecture diagram: Alerts for a real-time ML model
    CLBusiness request
    CPReal-time modelsilent failure
    DBFeature source
    NWLogs, metrics, and traces
    CPHeartbeat checker
    CPAlert rules
    CLOn-call owner
  3. Missing or broken features and sudden shifts in the population distribution are among the causes of wrong predictions in ML.

    Architecture diagram: Alerts for a real-time ML model
    CLBusiness request
    CPReal-time model
    DBFeature sourcebroken features
    NWLogs, metrics, and traces
    CPHeartbeat checker
    CPAlert rules
    CLOn-call owner
  4. In the diagram, logs and metrics feed alert rules. The alert text should say what was expected and the interval evaluated, and give the responder a clear link or course of action.

    Architecture diagram: Alerts for a real-time ML model
    CLBusiness request
    CPReal-time model
    DBFeature source
    NWLogs, metrics, and traces
    CPHeartbeat checker
    CPAlert rulesrule evaluated
    CLOn-call owneracknowledges the alert
  5. If the service stops completely, there may be no logs, averages, counts, or sums. A heartbeat alert fires when the expected ping does not arrive within the configured period.

    Architecture diagram: Alerts for a real-time ML model
    CLBusiness request
    CPReal-time modelno sign of life
    DBFeature source
    NWLogs, metrics, and traces
    CPHeartbeat checkermissing ping
    CPAlert rules
    CLOn-call owner

The source describes ways an alert can stop working over time: becoming too sensitive, which causes alert fatigue, or becoming dulled and never firing again. That is why anyone should be able to edit the threshold to calibrate signal and noise.

PracticeWhat the source recommends
Alert textState what was expected and include the time interval evaluated.
Responder actionInclude a clear link or course of action.
ConfigurationAllow editing the configuration, with adjustable thresholds to calibrate signal and noise.
AudienceTailor the metrics: engineering, data science, and business.

Scaling tips: a minimum sample size avoids firing without enough data, and using a sample of the data instead of the full set contains cost, as long as the underlying distribution is large enough. And, like any code, the alert should be tested.

03 · RETRAINING

Retraining without giving up control

The source states that models lose performance because they were trained on a static snapshot of the world, and that often the simplest way to update them is to retrain with newer data, without new features.

  1. The diagram shows the retraining path: data, pipeline, pull request, CI/CD, and the model in production.

    Architecture diagram: Automatic retraining with human review
    NWModel monitoring
    DBTraining and holdout data
    CPRetraining pipeline
    CPPull request with comparison
    CLHuman reviewer
    CPCI/CD
    CPModel in production
    CPPolicy layer
  2. Before automating, the source requires foundations: CI/CD, model monitoring, and a data pipeline that generates training and test sets programmatically and reliably.

    Architecture diagram: Automatic retraining with human review
    NWModel monitoringmonitoramento
    DBTraining and holdout datadata pipeline
    CPRetraining pipeline
    CPPull request with comparison
    CLHuman reviewer
    CPCI/CDone-click deployment
    CPModel in production
    CPPolicy layer
  3. The pipeline retrains with newer data and compares baseline and challenger on an unbiased test set that is not part of the training sets.

    Architecture diagram: Automatic retraining with human review
    NWModel monitoring
    DBTraining and holdout data
    CPRetraining pipelinechallenger
    CPPull request with comparison
    CLHuman reviewer
    CPCI/CD
    CPModel in production
    CPPolicy layer
  4. Instead of deploying on its own, the pipeline's last step can open a pull request with the compared performance of baseline and challenger.

    Architecture diagram: Automatic retraining with human review
    NWModel monitoring
    DBTraining and holdout data
    CPRetraining pipeline
    CPPull request with comparisoncomparison recorded
    CLHuman reviewer
    CPCI/CD
    CPModel in production
    CPPolicy layer
  5. The pull request still needs manual approval before the deployment that replaces the model in production.

    Architecture diagram: Automatic retraining with human review
    NWModel monitoring
    DBTraining and holdout data
    CPRetraining pipeline
    CPPull request with comparison
    CLHuman reviewermanual approval
    CPCI/CD
    CPModel in production
    CPPolicy layer
  6. The way other teams use the model's predictions is called policy. When retraining, the policy may need adjusting too.

    Architecture diagram: Automatic retraining with human review
    NWModel monitoring
    DBTraining and holdout data
    CPRetraining pipeline
    CPPull request with comparison
    CLHuman reviewer
    CPCI/CD
    CPModel in production
    CPPolicy layermay need adjustment

04 · PITFALLS

What to check before swapping the model

The policy is often the neglected part. According to the source, depending on complexity, it is harder to retrain or readjust the policy than the model, and using calibrated probabilities makes these adjustments easier.

CheckWhat the source describes
Fair comparisonEvaluate baseline and challenger on an unbiased set that is not part of any training.
No unbiased setDeploy both versions together in an A/B test.
Synthetic examplesScore examples that any model should classify well.
EstratosEvaluate baseline and challenger separately on each stratum.

Feedback loops deserve attention: use of the model affects the future training set. In credit, for example, you only observe default among those who received money, which adds a noticeable bias to the data collected after the model was introduced.

Other cautions from the source: the label of an example scored today may only become available after some time, and this should be considered when choosing training and validation periods. Retraining costs should be weighed against the expected benefit, and the pipeline should not be coupled to a single model or use case.

05 · LESSONS

How to bring this into an interview

In a design discussion, it is worth showing that you anticipate how the model will be watched, how the swap will be proposed and reviewed, and how the policy that consumes the score will be kept in sync with it.

Frequently asked questions

What is Nubank: real-time ML alerts and automatic retraining?

Real production architecture. Key points: drift alerts and retraining pipelines.

What does the Nubank: real-time ML alerts and automatic retraining design cover?

It is organized in these sections: Models that fail silently, From the served model to the on-call, Retraining without giving up control, What to check before swapping the model, and How to bring this into an interview.

How long is Nubank: real-time ML alerts and automatic retraining and what level is it?

It takes about 15 minutes to read and is rated Mid level.

Now design it yourself

Run this case as an interview in the System Design school: you make the decisions, the tutor challenges them and you see how your design scores.