Training and optimization
From Product Goals to Trainable Objectives
Learn how to choose surrogate objectives without pretending that a differentiable loss is identical to the real-world goal.
By the end you can
- Distinguish business outcomes, decision metrics, model metrics, and differentiable losses
- Explain why most training objectives are surrogates rather than direct goals
- Identify objective mismatch, gaming, and omitted constraints before training
- Draft an objective stack for a concrete machine learning system
Example
A risk score that worked while predicting the wrong thing
A widely used commercial health-risk algorithm was taken apart, level by level, in Science in 2019. Obermeyer and colleagues did the dissecting. Nothing below is hypothetical. The whole failure is one substitution between two levels.
- Outcome: find the sickest patients and give them additional help. The study set out to dissect racial bias in an algorithm used to manage the health of populations.
- Decision rule: a risk score sorts patients, and those above the line receive extra help. “Remedying this disparity would increase the percentage of Black patients receiving additional help from 17.7 to 46.5%”.
- Model metric: the score was graded against the quantity it had been fitted to, because “the algorithm predicts health care costs rather than illness”.
- Training target: health care cost, because it was there in the data. The authors' verdict on that choice: “We suggest that the choice of convenient, seemingly effective proxies for ground truth can be an important source of algorithmic bias in many contexts.”
- Missing constraint: nothing in the stack compared illness at a fixed score. “At a given risk score, Black patients are considerably sicker than White patients”, and no metric anyone was reading would have said so.
One goal becomes several linked specifications
A product goal is usually delayed, partly observed, and influenced by people. An optimizer needs a numerical signal available for each batch or sequence.
Whoever maps one level onto the next is making a modeling decision. It should stay visible, because each level can fail while another still looks successful. The algorithm New York's regulators would later name as Optum's Impact Pro broke between the top of the stack and the bottom. Illness was the outcome. Health care cost was the training target. Nothing in between recorded that a substitution had been made, so every level below the swap kept reporting success.
A differentiable loss is an instrument for learning, not a complete definition of success.
Comparison
Direct goals, surrogates, and constraints
Three components do different jobs. A direct outcome sits close to the real consequence and arrives late, sparse, and contaminated by policy changes. A surrogate objective is trainable and produces gradients every batch, but it tracks the desired behavior only under assumptions someone has to state. A guardrail is a condition that must not be traded away for average performance. It is frequently non-differentiable, which is exactly why it goes missing at model selection.
The Cardiac Arrhythmia Suppression Trial is what it costs to let the second stand in for the first. The surrogate endpoint was ventricular ectopy after myocardial infarction. Drugs were selected because they suppressed it.
The trial randomised 1,498 patients to encainide or flecainide or their placebos. Of those, 857 were assigned to encainide or its placebo: 432 to active drug and 425 to placebo. The other 641 were assigned to flecainide or its placebo: 323 to active drug and 318 to placebo. After a mean follow-up of 10 months, 89 patients had died. Of those deaths, 59 were arrhythmic: 43 receiving drug against 16 receiving placebo, P = 0.0004. Echt and colleagues reported it for the CAST Investigators in the New England Journal of Medicine in 1991. Their conclusion reads: “There was an excess of deaths due to arrhythmia and deaths due to shock after acute recurrent myocardial infarction in patients treated with encainide or flecainide.”
The American College of Cardiology keeps its own record of the trial, which the NHLBI sponsored and which enrolled 2,309 patients. It states the harm as a ratio — “Encainide and flecainide caused increased cardiovascular mortality with a relative risk of 2.5” — and concludes that suppressing asymptomatic ventricular arrhythmias after myocardial infarction “does not improve survival and can increase mortality”.
The surrogate moved in the intended direction the whole time. The direct outcome moved the other way, and the encainide and flecainide arms were stopped early for excess mortality. Imperfect alignment is not a caveat you note and move past. It is the entire result.
Direct outcome
A quantity close to the real consequence but often delayed or confounded.
- Example: fraud loss after investigation
- Useful for: product evaluation
- Limitation: sparse or slow feedback
- Risk: influenced by policy changes
Surrogate objective
A trainable signal correlated with desired behavior under stated assumptions.
- Example: weighted cross-entropy
- Useful for: frequent gradient updates
- Limitation: imperfect alignment
- Risk: optimization exploits shortcuts
Constraint or guardrail
A condition that should not be traded away for average performance.
- Example: maximum review volume
- Useful for: operational safety
- Limitation: may be non-differentiable
- Risk: ignored during model selection
Objectives should evolve through evidence, not convenience
A changed objective creates a new experiment, even when the architecture stays fixed. Record the reason, the expected effect, and the metrics that should move.
Stopping is part of the same discipline. In the Cardiac Arrhythmia Suppression Trial the encainide and flecainide arms were halted early for excess mortality. That decision was taken against the objective, not against the model that optimized it. The revision that matters is rarely a new hyperparameter. It is the moment someone writes down that the quantity being improved was the wrong quantity, and says on what evidence.
A contractor paid by a single construction metric
A contractor rewarded only for finishing quickly will finish quickly. Speed may increase while safety checks, material quality, and whatever it costs to keep the building standing later are neglected.
The contractor at least decides to cut those corners. An optimizer decides nothing, so whatever the objective failed to mention is not being neglected. It was never in the room. One measurable proxy cannot encode every valued outcome.
YouTube's recommender ran on clicks, and then it did not. Covington and colleagues wrote the switch down in 2016, in the section of the paper on ranking. The objective first: “Our final ranking objective is constantly being tuned based on live A/B testing results but is generally a simple function of expected watch time per impression.” Then the reason the earlier proxy was abandoned: “Ranking by click-through rate often promotes deceptive videos that the user does not complete (“clickbait”) whereas watch time better captures engagement”.
Nothing there says the click model was inaccurate. It was accurate, and it bought behavior nobody wanted. Notice also what replaced it. Expected watch time per impression is another proxy, carrying its own assumptions about what a completed video means. Proxies get replaced by proxies, not by the goal.
A useful objective stack combines a learning signal with independent guardrails.
Steps
Build an objective stack before choosing a loss
This exercise exposes missing links before they become expensive experiments. Name the consequence in ordinary language. Specify the decision: how outputs turn into actions, rankings, abstention or review. List the measurable evidence, including the slices that could falsify the proposed benefit. Select a trainable target from the labels, preferences, sequences or rewards actually available at training time. Add guardrails: cost, fairness checks, latency, capacity, abstention. Then predict the gaming routes, the shortcuts that would reduce loss without improving the intended outcome.
Step six is the one that gets skipped, so here is a gaming route with a number attached. Networks trained to find pneumonia learned to find the hospital. Zech and colleagues trained convolutional neural networks across 158,323 chest radiographs from three hospital systems. What they reported in PLOS Medicine: “CNNs were able to directly detect hospital system of a radiograph for 99.95% NIH (22,050/22,062) and 99.98% MSH (8,386/8,388) radiographs”. That capability was worth something to the loss, because disease was not evenly spread: “The prevalence of pneumonia was high enough at MSH (34.2%) relative to NIH and IU (1.2% and 1.0%) that merely sorting by hospital system achieved an AUC of 0.861 (95% CI 0.855-0.866) on the joint MSH-NIH dataset”. Guessing the hospital, and nothing about the lungs, scored 0.861. The best internal model reached an AUC of 0.931. Tested externally, it fell to 0.815. The authors' conclusion: “CNNs robustly identified hospital system and department within a hospital, which can have large differences in disease burden and may confound predictions.”
The mechanism reproduces in other tasks. DeGrave and colleagues, writing in Nature Machine Intelligence, report that “we demonstrate that recent deep learning systems to detect COVID-19 from chest radiographs rely on confounding factors rather than medical pathology, creating an alarming situation in which the systems appear accurate, but fail when tested in new hospitals”. The US Agency for Healthcare Research and Quality cites that work. It names the remedy as “better training data, improved choice in the prediction task, and external validation of the AI system prior to dissemination and implementations in different hospitals”. Note the middle item. The choice of prediction task is listed alongside the data, not underneath it.
1. Name the consequence
Write the user or system outcome in ordinary language.
2. Specify the decision
Describe how outputs influence actions, rankings, or review.
3. List measurable evidence
Choose metrics and slices that can falsify the proposed benefit.
4. Select a trainable target
Define labels, preferences, sequences, or rewards available during training.
5. Add guardrails
Record costs, fairness checks, latency, capacity, and abstention requirements.
6. Predict gaming routes
List the shortcuts that would reduce loss without improving the intended outcome.
Visual
The objective stack from consequence to gradient
Five layers, and each one should explain how evidence flows to the next. The operational outcome is what should improve for users or the physical system. The decision policy turns predictions into action, abstention, review or ranking. The evaluation measures test the intended behavior offline and online. The model target is what the system is asked to estimate or rank. The training objective is the differentiable quantity that actually produces an update.
The Epic Sepsis Model lets you read three of those layers off a published paper. The decision policy is an alert at an ESM score of 6 or higher. The evaluation measure, when Wong and colleagues tested it at Michigan Medicine, was a hospitalization-level area under the receiver operating characteristic curve of 0.63 (95% CI, 0.62-0.64). The model target is sepsis. The training objective is the layer a hospital using it cannot inspect at all, because the model is proprietary. That is the point of drawing the stack. A layer nobody can see is still a layer that decides what the system does.
Operational outcome
What should improve for users, organizations, or the physical system.
Decision policy
How predictions trigger actions, abstention, review, or ranking.
Evaluation measures
Which offline and online observations test the intended behavior.
Model target
What output the model is asked to estimate or rank.
Training objective
Which differentiable quantity produces an update signal.
Key idea
Optimization increases pressure on weak proxies
When a proxy becomes the target, the system searches for any pattern that reduces it. That pattern may include leakage, annotation quirks, spurious correlations, or behavior that shifts costs elsewhere. Hospital identity standing in for pneumonia is the clean example, worth an AUC of 0.861 on its own. This is not evidence that optimization is malicious. It is evidence that the objective omitted part of the intended task.
The effect has been measured, not merely warned about. Gao and colleagues replaced human labellers with a fixed larger gold-standard reward model. They then fitted the divergence between proxy reward and true reward as a function of optimization pressure. Reinforcement learning and best-of-n sampling came out with different functional forms, and the coefficients scaled smoothly with reward-model size. The paper, presented at ICML in 2023, is called Scaling Laws for Reward Model Overoptimization. Its abstract states the mechanism plainly: “Because the reward model is an imperfect proxy, optimizing its value too much can hinder ground truth performance, in accordance with Goodhart's law.”
The useful part is that the degradation has a shape. It is not a rumor about strong optimizers. It is a curve that can be fitted, which means the point at which more optimization starts costing you can be estimated rather than argued about.
The stronger the optimizer, the more carefully the proxy must be audited.
Where objective mismatch first appears
If every disappointing result leads to another loss term, the objective can become an opaque patchwork. Prefer a small, interpretable stack and remove terms that no longer earn their complexity.
Earning it is a measurement, not an argument. Coste and colleagues rebuilt that same setup for ICLR 2024, added 25% label noise, and reported that conservative ensemble objectives improved performance by up to 70% for best-of-n sampling. Their abstract restates what they were building on: “Gao et al. (2023) studied this phenomenon in a synthetic human feedback setup with a significantly larger "gold" reward model acting as the true reward (instead of humans) and showed that overoptimization remains a persistent problem regardless of the size of the proxy reward model and training data used.” The extra structure was kept because it was scored against a standard held outside the proxy. A term added because the last experiment disappointed has no such record. It also has no criterion for ever being removed.
Objective design is versioned product reasoning, not a one-time formula choice.
Case
Where an objective mismatch shows up first: alert burden
The Epic Sepsis Model was validated externally, across 38,455 hospitalizations at Michigan Medicine. Wong and colleagues published the result in JAMA Internal Medicine. “The ESM had a hospitalization-level area under the receiver operating characteristic curve of 0.63 (95% CI, 0.62-0.64)”. The number a hospital actually lives with is in the next sentence: “The ESM also did not identify 1709 patients with sepsis (67%) despite generating alerts for an ESM score of 6 or higher for 6971 of all 38 455 hospitalized patients (18%), thus creating a large burden of alert fatigue.” The authors do not treat this as a local problem: “The widespread adoption of the ESM despite its poor performance raises fundamental concerns about sepsis management on a national level.”
It was not a one-hospital result. Ostermayer and colleagues evaluated the same v1 model in 2023 across 145,885 emergency department encounters at two county hospitals, and published it in JAMIA Open. Within a six-hour window they found sensitivity of 14.7%, specificity of 95.3%, a positive predictive value of 7.6% and a negative predictive value of 97.7%. The alert fired in 7,183 encounters, 4.9% of the total, with a median lead time of 0 minutes. Another 3,180 sepsis cases occurred with no alert at all.
A positive predictive value of 7.6% is the mismatch in the form clinicians meet it. Roughly nine-tenths of the interruptions lead nowhere, and the cases that matter arrive unannounced. Mismatch shows up as workload long before anyone reopens the objective.
Position
Choosing the proxy is the product decision, not a step that follows it
Ask why a model failed and the answers arrive in a familiar order. Bad data, too little training, a threshold set wrong, the wrong architecture. The objective itself is rarely on that list. It gets treated as bookkeeping, written down once the real decisions have been made.
Two documents dated 25 October 2019 say otherwise. The first is the study in Science. Its case turns on one substitution: the label was health care cost, the thing that mattered was illness. “At a given risk score, Black patients are considerably sicker than White patients”. “Remedying this disparity would increase the percentage of Black patients receiving additional help from 17.7 to 46.5%”. What Obermeyer and his co-authors blame is not a bug but a habit — “convenient, seemingly effective proxies for ground truth”.
The second document is a letter, and it is the reason this is not merely an interesting finding. New York's Department of Financial Services and Department of Health wrote jointly to UnitedHealth Group's chief executive, David S. Wichmann, naming Optum's Impact Pro: “This is why reports of the discriminatory effects from your algorithm's reliance on past health costs are so troubling: a black patient's actual medical needs may not be accurately captured by his or her prior health costs.”
They did not ask for a more accurate model. “These discriminatory results, whether intentional or not, are unacceptable and are unlawful in New York.” And, generalising past the one company: “neither you nor any other healthcare or insurance entity may produce, rely on, or promote an algorithm that has a discriminatory effect”. The demand was to demonstrate that the algorithm was not racially discriminatory or to stop using it. A regulator can order a company to abandon a label. That is how far upstream of the training run the decision sits.
The same decision looks like this from inside a product. Covington and colleagues objected to clicks, and not because the ranking was inaccurate: “Ranking by click-through rate often promotes deceptive videos that the user does not complete (“clickbait”) whereas watch time better captures engagement”. So the objective became a simple function of expected watch time per impression — another proxy, carrying its own assumptions.
And the mismatch surfaces long before anyone reopens the objective. In the external validation of the Epic Sepsis Model: 38,455 hospitalizations, an area under the curve of 0.63, alerts on 6,971 of them, 1,709 patients with sepsis not identified. It arrives as workload and missed cases well before it arrives as a number anyone reviews.
So the question worth asking before training is not which loss is differentiable. It is what this objective would reward that nobody wants. That step sits last in the workshop above, and it belongs first. A proxy chosen because the data was there is still a decision about what the system is for — and, in New York in 2019, one a company was told it could not keep making.
Figure
Key takeaways
- Product outcomes, decision policies, evaluation measures, model targets and training losses form one linked stack. In the health-risk algorithm dissected in Science, illness sat at the top and health care cost at the bottom, and nothing in between recorded the swap.
- Most differentiable losses are surrogates whose assumptions need separate validation. In the Cardiac Arrhythmia Suppression Trial the surrogate improved while 89 of 1,498 patients died, 59 of arrhythmia, 43 receiving drug against 16 receiving placebo (P = 0.0004).
- Guardrails protect capacity, latency, subgroup behavior and safety from being traded away silently. The Epic Sepsis Model alerted on 6,971 of 38,455 hospitalizations (18%) at Michigan Medicine, a constraint no loss term was watching.
- Objective mismatch means the optimized quantity improves while the intended behavior does not. The same model did not identify 1,709 patients with sepsis (67%), and an independent evaluation of 145,885 emergency department encounters found sensitivity of 14.7% and a positive predictive value of 7.6%.
- A stronger optimizer raises the need to audit leakage and shortcuts. Gao and colleagues fitted the divergence between proxy and true reward as a curve, and on pneumonia radiographs the shortcut of merely sorting by hospital system reached an AUC of 0.861 (95% CI 0.855-0.866).
- Objective changes are versioned experiments with reasons and removal criteria. YouTube's ranking moved from click-through rate to expected watch time per impression for a stated reason, and New York's Department of Financial Services and Department of Health demanded a company demonstrate its algorithm was not racially discriminatory or stop using it.