Incident Severity Classification and Escalation Questions
Assigning severity to incidents, deciding when and whom to page, and moving an issue up defined escalation paths. Covers severity matrices and objective impact criteria (customer impact, scope, data loss, regulatory and financial exposure, multi-tenant and multi-region cases), major-incident declaration thresholds, triage and prioritization across concurrent incidents, escalation criteria and timing, executive and vendor escalation, and calibrating or auditing severity definitions over time, including severity metrics, rolling out threshold changes, centralized versus team-owned classification, training responders to classify, reducing false-positive top-severity pages, and automated or learned severity classification. Applied to services, data and reporting platforms, and machine-learning systems. The routing and prioritization discipline at the front of the incident lifecycle. Excludes running the response once staffed, on-call rotation and runbook design, incident status communication, and SLO definition.
Propose a machine-learning approach to predict incident severity from alert streams and telemetry. Describe candidate features (alert counts, aggregated error rates, recent deploys, service criticality, historical incident labels), how you would create labeled training data from past incidents, strategies to address class imbalance and concept drift, model choices, techniques for interpretability (e.g., SHAP), and runtime guardrails to prevent harmful automated decisions.
Sample Answer
The idea in plain words
The goal is a model that reads the early signals of an incident (alerts, error rates, recent deploys, how critical the service is) and suggests a severity level (SEV1 most serious). The honest framing for an interview is that this is a hard, low-data, high-stakes prediction: serious incidents are rare, the labels are human judgements that vary, and a wrong "low" is much more costly than a wrong "high". So the model should earn its place beside deterministic rules, start as an advisor that can only raise concern, and be wrapped in guardrails that make a harmful automatic decision impossible by construction.
Terms: class imbalance means some classes (SEV1) are far rarer than others. Concept drift means the relationship between inputs and the right answer changes over time (new services, new architecture, new severity definitions). SHAP (SHapley Additive exPlanations) is a method that assigns each input feature a signed contribution to one prediction, so a person can see why the model said what it said. Precision is the share of predicted-high incidents that really were high. Recall is the share of truly high incidents the model flagged. The false positive rate is the share of incidents that are not high which the model flags as high anyway. Alert fatigue is responders starting to ignore pages because too many of them turn out to be false. A service tier is a rank the organisation gives each service by how much the business depends on it (tier-0 is the most critical).
Not everything below carries equal weight. The core of the answer is: rules as the floor, features known at prediction time, labels from the post-incident review, a time-based split, per-class precision and recall instead of accuracy, a simple model, and the escalate-only guardrail. The rest (text embeddings, oversampling, a cost matrix, population stability index, a shadow challenger model, hard negatives) are refinements to reach for once the core is working.
Rules versus ML
| Rule-based | ML model | |
|---|---|---|
| Data needed | None, only agreed definitions | Hundreds to thousands of labelled incidents |
| Explainability | Complete | Needs tooling (SHAP) and still approximate |
| Maintenance | Manual edits as the system changes | Retraining, drift monitoring, label upkeep |
| Behaviour on unseen situations | Predictable, may be blunt | Unpredictable outside training data |
| Strength | Floors and hard policy ("data exposure is at least SEV2") | Combining many weak signals no rule captures |
Recommendation: keep rules as the floor and the source of truth for policy; use ML as an advisory ranker for the middle band where rules are ambiguous.
Features (all must be available at prediction time)
- Alert counts and their growth rate in the first 5 to 10 minutes, number of distinct services alerting.
- Aggregated error rates and latency versus baseline, share of traffic affected.
- Recent deploys or config changes to the service and its dependencies, and time since the last one.
- Service criticality (tier, the rank described above), number of dependent services, customer-facing flag, time of day.
- Historical incident labels for this service (its past severity distribution).
- Alert text: the words in alert titles and descriptions turned into features with TF-IDF (term frequency weighted by rarity) or text embeddings (lists of numbers for a piece of text in which similar meanings get similar numbers), because phrases like "data loss" or "payment" carry severity information that numeric signals miss.
Leakage trap: never use fields written after the incident (postmortem text, duration, final impact). The model must only see what the on-call engineer would see at the moment of classification.
Creating labels
Use the severity assigned in the post-incident review, not the first guess, because it reflects the true impact. Limits to state plainly:
- Severity is a judgement. Two reviewers disagree sometimes, so measure agreement on a sample and treat noisy labels as a ceiling on achievable accuracy.
- Definitions change. If the severity criteria were revised on a date, either relabel the older incidents with the new criteria or train only on incidents after that date.
- Missing incidents: events that were never declared have no label. Sample alert clusters that never became incidents as low-severity negatives, and say that this is an approximation.
Class imbalance (with numbers)
Assume 1,000 labelled incidents over two years: SEV1 20, SEV2 80, SEV3 300, SEV4 600.
- A model that answers SEV4 every time is 600 / 1,000 = 60% accurate and useless, which is why accuracy is the wrong metric. Use per-class precision and recall and a cost-weighted confusion matrix (a table of true severity against predicted severity in which each kind of mistake is given a price, so that predicting low for a real SEV1 counts far more than the reverse).
- Inverse-frequency class weights, wc=k⋅ncn with n=1000 incidents, k=4 classes and nc the count in class c: SEV1 1000 / (4 x 20) = 12.5, SEV2 1000 / (4 x 80) = 3.125, SEV3 1000 / (4 x 300) = 0.833, SEV4 1000 / (4 x 600) = 0.417.
- With only 20 SEV1 examples, a separate SEV1 class is too thin to learn or to evaluate. Merge SEV1 and SEV2 into one "high" class (100 examples), and let rules distinguish SEV1.
- Other options: oversample the rare class (resample its rows so the model sees them more often) inside training folds only, meaning after the split so that copies of a row never reach the test data, or predict an ordered target (SEV1 ranked above SEV2 and so on, instead of unrelated labels) with a cost matrix that makes under-prediction expensive.
- False positives still matter. Suppose 100 of the 1,000 are truly high, the model has recall 90% and a false positive rate of 5% (it flags 5% of the other 900 by mistake). Then true positives are 0.90 x 100 = 90, false positives are 0.05 x 900 = 45, and precision is 90 / (90 + 45) = 66.7%. One in three high flags would be false, so the model is a suggestion shown to a person, not an automatic pager.
Concept drift
Split data by time (train on older, test on newer), never randomly. Monitor: input distributions (for example the population stability index, PSI, per feature: it compares the share of values in each bin between training data and recent data, and a larger number means a bigger shift), the share of predictions by class, and rolling recall measured on each month's reviewed incidents. Retrain on a schedule and on a drift trigger. Run a challenger model in shadow (a new model that scores the same incidents but whose output nobody acts on) beside the live one and promote only if it wins on recent data.
A tiny PSI calculation with two bins and assumed shares: in training, 80% of incidents had an error rate below baseline-times-2 and 20% above; in the last month it is 60% and 40%. For each bin the term is (recent share minus training share) times the natural log of (recent share divided by training share): bin 1 is (0.6 - 0.8) x ln(0.6 / 0.8) = (-0.2) x (-0.2877) = 0.0575, and bin 2 is (0.4 - 0.2) x ln(0.4 / 0.2) = 0.2 x 0.6931 = 0.1386. PSI is 0.0575 + 0.1386 = 0.196. A common rule of thumb reads below about 0.1 as stable and above about 0.25 as a major shift, so 0.196 is a moderate shift worth investigating, not an automatic retrain. Treat a definition change or a major architecture migration as a hard reset of the label history.
Models
Start with a transparent baseline (logistic regression) and then a gradient-boosted tree model on the tabular features, with text features added. A gradient-boosted tree model builds many small decision trees one after another, each correcting the mistakes of the ones before it. These handle mixed numeric and categorical data well with a few thousand rows. A deep model is not justified with this data volume. Calibrate the probabilities (adjust the raw scores after training) so that "0.7" really means about 70%: of the incidents scored near 0.7, roughly 70% should truly be high, since downstream thresholds depend on it.
Interpretability
For each suggestion show the three features that pushed it up or down most (SHAP values for tree models), for example "service tier 0 (+), error rate 6x baseline (+), deploy 12 minutes ago (+)".
A tiny numeric breakdown (illustrative, shown in probability units for simplicity; many tree explainers work in log-odds, where the same adding-up rule holds): the model's average prediction of "high" across all past incidents is 0.10. For this incident, service tier 0 adds +0.25, error rate 6x baseline adds +0.30, the deploy 12 minutes ago adds +0.12, and all other features together add -0.02. The prediction is 0.10 + 0.25 + 0.30 + 0.12 - 0.02 = 0.75. The contributions always add up from the average to this prediction, which is what "signed contribution" means: positive pushes toward high, negative pushes away. SHAP explains the model's behaviour, not causation, and correlated features can split credit unpredictably, so it supports analyst review rather than proving the model right.
Runtime guardrails
- The model is advisory and escalate-only: final severity is the higher of the rules' floor and the model suggestion, and the model can never lower a severity or suppress a page.
- Out-of-distribution check (does this input look unlike anything the model was trained on?): if the incident looks unlike training data (new service, missing features), fall back to rules and flag it.
- Confidence threshold, a rate limit on automated changes per hour, a human override that sticks, and a kill switch that disables the model.
- Log model version, inputs and explanation on every suggestion for audit.
How an analyst validates it
- Time-split evaluation with per-class precision and recall and a cost-weighted confusion matrix.
- Calibration check (do predicted probabilities match observed frequencies in bins?).
- Read every case where model and rules disagree in a sample (for example 30), judging who was right.
- Evaluate by service tier and team, since a good average can hide a bad slice.
- A shadow period in which the model's suggestions are compared with what humans decided in real time.
- False-positive handling: collect the cases where the model said high and the review said low as hard negatives (confident mistakes that are the most informative rows to learn from), retrain with them, and track alert fatigue as a first-class metric.
Common mistakes
- Random train/test splits that leak the future.
- Reporting accuracy on imbalanced data.
- Letting the model lower severities.
- Using post-incident fields as features.
Design an escalation policy and decision matrix for when to involve SRE, product, legal or executives in a model-deployment incident whose impact on revenue, privacy and user trust is uncertain. What trigger thresholds apply, and how do you act before impact is measurable?
Sample Answer
The idea in plain words
A model-deployment incident is a problem caused by releasing a new or retrained machine learning model: its outputs may be wrong, unsafe, slow or leaking data, but the usual evidence (revenue, complaints, churn) arrives hours or days late. So the policy cannot wait for impact to be measured. It must (1) detect trouble from leading signals that move within minutes, (2) route people by kind of risk (money, privacy, trust) and not only by volume, and (3) start with the cheapest reversible action. Terms used below: a canary is a rollout to a small share of traffic first, and a canary ramp is the schedule that raises that share step by step; drift means the model's inputs or outputs have shifted from a reference period; a fallback is a simpler backup behaviour (such as a fixed rule) served when the model cannot answer; a guardrail metric is a safety or health measure that must not move even if the headline metric looks good; an SRE (Site Reliability Engineer) owns the serving platform's reliability.
Why waiting for revenue evidence fails (assumed numbers)
Suppose the canary receives 5,000 sessions per hour and the baseline conversion rate is 4%.
- Expected conversions per hour: 5,000 x 0.04 = 200.
- Random variation of that count, measured by the standard deviation (the typical distance by which a count scatters around its expected value from one hour to the next; here the binomial formula np(1−p) for n sessions each converting with probability p): 5000×0.04×0.96=192≈13.9.
- A true 10% relative drop is 200 x 0.10 = 20 conversions, which is 20 / 13.9 = 1.44 standard deviations (1.443 before rounding). Counts like this follow a bell-shaped normal curve closely, and the area of that curve beyond 1.443 standard deviations on the low side is about 0.0745, found from a normal table or any statistics library. So noise alone produces a drop that large about 7.4% of the time, and one hour of canary data cannot confirm it.
- To see a 10% relative drop (0.004 absolute) clearly, require the drop to be 3 standard deviations of the measured conversion rate (3 is a conventional strict bar, since noise alone rarely reaches it). A conversion rate measured over n sessions has standard deviation p(1−p)/n, so the condition 0.004≥3p(1−p)/n rearranges to the sample size below. You need n≥0.00429p(1−p)=0.0000169×0.0384=21,600 sessions, which is 21,600 / 5,000 = 4.32 hours of canary traffic.
(This compares the canary with a known baseline and ignores uncertainty in the baseline itself, so real tests need somewhat more.) The conclusion: revenue proof arrives after roughly four hours, so the first hours must be run on leading signals and on expected-cost reasoning.
Leading signals and starting thresholds (assumptions to calibrate)
Each threshold is measured against the same hour of the previous 7 days, sustained for the stated time.
| Signal | Threshold | Why it is a leading signal |
|---|---|---|
| Serving latency p95 (95th percentile: 95% of requests are faster than this value) | above 2x baseline for 5 min | Heavier or broken model, visible at once |
| Error or fallback rate | above 2% absolute, or above 3x baseline, for 5 min | Model failing to answer |
| Output drift (population stability index, PSI, a single number summing how much each band of the score distribution has shifted compared with the reference period; 0 means identical) | PSI above 0.25 (a common rule of thumb for a large shift, not a standard) | Outputs changed before outcomes can be judged |
| Safety or privacy filter hits | any confirmed personal-data leak, or hit rate above 3x baseline | Direct harm indicator |
| Business proxy (click-through or suggestion acceptance on the canary) | down more than 10% relative for 2 consecutive hours | A prompt for review, not proof (see the arithmetic above) |
| Support contacts mentioning the feature | above 3x hourly baseline | Customers notice before dashboards do |
Severity and who is called
| SEV1 (highest level) | SEV2 (second highest) | |
|---|---|---|
| Trigger | Confirmed or credibly suspected personal-data exposure; harmful or unsafe outputs reaching users; two or more signals breached at full traffic; projected loss above 10,000 USD per hour (assumed) | One signal breached at full traffic, or the business proxy tripped, with no privacy or safety flag |
| Paged now | Incident commander, ML on-call engineer (owner of the model), SRE on-call, product owner | ML on-call engineer, SRE on-call |
| Brought in | Privacy or legal counsel immediately; communications lead; executive sponsor told within 15 minutes of declaration (informed, not on the call) | Product owner informed within 30 minutes; legal on standby, and joins immediately if any privacy flag appears |
| Not involved | n/a | Executives |
Escalation by kind: any privacy flag goes to counsel regardless of volume, because notification clocks can start when the organisation becomes aware. For example, under GDPR (European Union) Article 33 a controller (the organisation that decides why and how personal data is processed) notifies the supervisory authority (the national data-protection regulator) within 72 hours of becoming aware of a personal-data breach, where feasible, unless the breach is unlikely to result in a risk; other regimes and sectors have their own clocks, and counsel (the organisation's lawyers) decides whether a given event is notifiable. Revenue-only issues do not need legal at all.
Acting before impact is measurable
- Freeze the ramp (stop increasing the traffic share). It costs nothing.
- Contain: route the canary back to 0%, roll back to the previous model version, or switch to a fallback (a simple rule-based answer). Cheap when the previous version is still deployed.
- Preserve evidence: keep the model artifact, a sample of inputs and outputs, and the logs. Do not delete the bad outputs, because the postmortem and any legal review need them.
- Decide by expected cost. Roll back when p×L×t>c, where p is your honest probability that the model is bad, L the loss per hour if it is, t the further hours you would wait, and c the cost of rolling back.
Worked: assume L=12,000 USD per hour, c=1,500 USD (the revenue lift forgone by rolling back, meaning what the new model would have added, plus engineer time), t=1 hour and p=0.20 from the proxy signals. Waiting costs in expectation 0.20 x 12,000 x 1 = 2,400 USD, which exceeds 1,500, so roll back. The break-even probability is 1,500 / 12,000 = 0.125. At p=0.10 waiting costs 1,200 USD, below 1,500, so freeze the ramp and keep gathering evidence instead. This calculation prices revenue only. Privacy and safety harm are not traded against it: a credible flag escalates and contains regardless.
Commitment
I would adopt the table of signals, the two-level call list, and the rule "freeze first, then roll back when expected cost says so or any privacy or safety flag is credible". A numeric threshold is only useful if an on-call engineer can read it from a dashboard in a minute, so each one appears as a single tile.
Common mistakes
- Waiting for a revenue dip that cannot be seen for hours.
- Calling executives for volume instead of kind, so the one privacy case that needs counsel at minute 10 gets treated like a latency blip.
- Rolling back by deleting evidence.
- Setting drift thresholds once and never recalibrating, which teaches engineers to ignore them.
You have three simultaneous alerts: a latency spike affecting 5% of users, an ingestion failure in a non-critical feature pipeline, and a small but steadily growing accuracy drop in a fraud-detection model. How do you prioritize them, and how do you weigh a slow-growing silent problem against a visible one?
Sample Answer
The idea in plain words
Prioritising simultaneous alerts means ranking them by the harm each is doing now, how fast that harm is growing, and how hard it is to undo, not by how loud each one is. A visible problem (latency) generates complaints that force attention. A silent problem (a fraud model slowly getting worse) generates none, so it needs a deliberate deadline or it will wait forever. Trajectory means the direction and speed of change in impact. Model accuracy drift means a machine-learning model's predictions getting worse as the data it sees changes. Severity here is the level (SEV1 most serious) reflecting impact. Assume this scale: SEV1 is an outage or major loss for most users, SEV2 is a significant degradation for a meaningful slice of users or growing money loss, SEV3 is limited impact or a slow loss that is not yet large, and SEV4 is minor. A fraud-detection model scores each payment for how likely it is fraud; its features are the input columns it reads (for example "number of payments from this card in the last hour"), and a feature pipeline is the job that computes those columns from raw data and feeds them to the model. If that job breaks, the model keeps running but reads stale or empty values. Recall (also called the catch rate) is the share of truly fraudulent payments the model flags. A percentage point is an absolute step on a percentage: recall falling from 90% to 89% is a fall of 1 percentage point, which is not the same as a 1% relative fall.
The three questions I ask about each alert
- How big is the harm now (who is affected, how badly)?
- How fast is it growing, and is it reversible (can we get back what is lost)?
- Is it already being noticed by someone who will act, or will it stay hidden?
Applying them
| Alert | Harm now | Trajectory | Noticed? | Provisional call |
|---|---|---|---|---|
| Latency spike for 5% of users | Real and visible; users are slower, not blocked | Unknown: check whether the 5% is growing | Yes, quickly | SEV2 (the highest of the three) until its trend is known |
| Ingestion failure in a non-critical feature pipeline | Small if truly non-critical | Stable, but data backlog accumulates | Probably not | SEV4, unless it feeds something important |
| Slow, steady accuracy drop in the fraud model | Small today | Growing every day, money is lost | No | SEV3 now, with a hard deadline today, and SEV2 once the cumulative loss passes a business limit |
Order I would work in, and why
Step 1, five minutes, before anything else: check the dependency. Ask whether the "non-critical" feature pipeline feeds the fraud model. If it does, stale or missing features are the first explanation to test for the accuracy drop, and the two alerts are one incident. This cheap check can change the whole ranking.
Step 2: latency first, time-boxed. It is active, user-visible and often has a fast lever (a recent deploy to roll back, a saturated dependency to relieve). Spend up to 30 minutes establishing its cause and trend. If it is stable at 5% and a mitigation is not obvious, hand it to the service owner with a named update time.
Step 3: fraud model the same day, not "later". Assign an owner and a deadline. Why: the harm grows with time and nobody is pushing. Assumed numbers: 1,000,000 transactions a day, 0.5% fraudulent, so 5,000 fraudulent transactions a day. The model's catch rate (recall) falls by 1 percentage point per day, so each day it misses 1% of 5,000 = 50 more fraudulent transactions than the day before. At an assumed average loss of 80 dollars per missed fraud:
- Day k costs about 50 x k x 80 = 4,000 x k dollars more than the original baseline.
- Over 7 days the cumulative extra loss is 4,000 x (1 + 2 + ... + 7) = 4,000 x 28 = 112,000 dollars.
- Over 30 days it is 4,000 x (30 x 31 / 2) = 4,000 x 465 = 1,860,000 dollars.
The growth is quadratic in time under a steady decline, which is why a "small" drift deserves a deadline. Why quadratic: the extra loss on day k is 4,000 x k, which grows in a straight line, but the cumulative loss adds those daily amounts, 4,000 x (1 + 2 + ... + n) = 4,000 x n(n + 1) / 2, and n(n + 1) / 2 grows roughly like n squared. Doubling the wait from 7 to 14 days takes the total from 112,000 to 4,000 x 105 = 420,000 dollars, nearly four times as much, not twice. These inputs are illustrative; the real decline rate and loss per fraud need measuring.
Step 4: the ingestion failure goes to the normal queue with an owner, unless step 1 found a link. Re-check that "non-critical" is true: what consumes this data, and how long before the backlog becomes unrecoverable?
If there are several engineers, do not serialise: give each alert an owner and run them in parallel. The ranking matters when responders are scarce.
Weighing slow-silent against visible
- The visible problem is bounded and self-reporting. The silent one is unbounded and self-hiding.
- Compare the cumulative harm over the time you would otherwise leave each alone, not today's harm alone.
- Silent problems need three things: a named owner, a date, and a metric that makes them visible (a dashboard line for recall, an alert on its rate of decline).
- Also ask how to detect it faster next time. A slow drop found by chance suggests a missing alert on model quality.
What would flip the order
- If the latency is stable, small and has a known low-risk fix pending, the fraud investigation can start first.
- If the fraud decline accelerates, or if confirmed fraud losses cross a business limit, it moves to the top and a second responder joins.
- If latency affects the payment path itself, it directly raises the fraud and revenue risk and moves higher.
Common mistakes
- Ranking only by what the dashboard shows red.
- Declaring the pipeline "non-critical" without checking its consumers.
- Parking the silent problem with no owner or date.
- Reporting current harm without projecting it forward.
Your team wants to automate triage by classifying incoming incident reports for a production ML system into cause categories (data, model, infrastructure, security) so each reaches the right owner. Propose a lightweight classifier design, the training data it needs, how you would evaluate it, and how you would limit the damage when it misroutes an incident.
Sample Answer
The idea in plain words
Triage means deciding who looks at a problem first. Here the input is the free text of an incoming incident report on a production machine-learning (ML) system, and the output is one of four owners: the data team, the model team, the infrastructure team or the security team. The classifier is a router, not a decision maker. It picks where a report goes first, it never sets severity, and it never closes anything. Because a router will sometimes be wrong, the design question that matters most is what happens on the wrong path, so the design below has four parts: a small text model, training data built from final root causes, an evaluation that prices mistakes by their cost, and containment around every misroute.
A few terms used throughout:
- Root-cause category: the owner who in the end fixed the problem, taken from the closed ticket or postmortem (the written review after an incident).
- TF-IDF (term frequency, inverse document frequency): turns a report into numbers by weighting each word higher when it is frequent in this report and rare across all reports.
- Logistic regression: a linear model that outputs a probability for each category. Its largest weights can be read, which helps when an owner asks why a report came to them.
- Precision for a category: of the reports sent to it, the share that truly belong. Recall: of the reports that truly belong to it, the share that were sent to it.
- Confusion matrix: a table of true owner (rows) against routed owner (columns).
- Abstain: the model declines to route and the report goes to a human queue.
- Confidence: the highest of the four probabilities the model gives a report. Calibrated means those probabilities are honest: of the reports scored about 0.7, roughly 70 percent really belong to the predicted owner.
- Held-out data is data the model never trained on, kept back so the test is fair. Drift is the incoming reports changing over time (new services, new wording) until the model's accuracy decays.
- Escalation policy: the on-call tool's rule that pages the next person if nobody acknowledges a report within a set time.
Model choice: small and readable first
A TF-IDF plus logistic regression baseline trains in seconds on a few thousand reports, runs in microseconds per report, and exposes the words that drove a decision. Start there and move to a heavier text model only if the baseline's measured errors justify it. A heavier model would still sit behind the same confidence gate, human queue and security rule below, because those controls do not depend on which model sits inside.
Training data the classifier needs
- Source: closed incident tickets with the report text exactly as first filed (title, description, alert name, service tag).
- Label = final root-cause category, not the queue the ticket first landed in. The first queue records past misroutes. Training on it teaches the model to repeat them. The final owner is what a correct route would have been.
- Only fields known at report time. Exclude comments, resolution notes and postmortem text. A model trained on words that appear only after diagnosis looks excellent in testing and is useless at filing time (this is called label or feature leakage).
- Split by time: train on older tickets, test on later ones, because the live system always routes tomorrow's reports using yesterday's data.
- Enough examples per category to measure it. Security is usually the rarest category, so it is the one whose recall is hardest to know. With 57 test examples a result of zero misses only tells you the miss rate is probably below about 3/57 = 0.053, which is 5.3 percent (the "rule of three" approximation for an upper 95 percent bound when zero events are seen). Collect more security examples, or synthesise carefully labelled ones, before trusting a security number.
- Multi-cause incidents: store one primary category plus an optional secondary one (a data change that triggers a model regression). Route on the primary and show the secondary to the receiving owner.
- Label quality: have two people re-label a random sample of about 100 tickets and measure how often they agree. If humans disagree on a category boundary, the model cannot be held to it.
- An "unclear" bucket for tickets that took triage multiple handoffs, so that unclear reports can be recognised as unclear.
Evaluation: price the mistakes, not only the accuracy
Accuracy alone hides which owner is being let down. Report per-category precision and recall, the confusion matrix, and a cost number, because a misroute to the wrong owner delays work by a few dozen minutes but a missed security incident can cost hours.
The program below builds a labelled set of 2,000 older and 600 later reports from template phrases (a synthetic assumption: every phrase, the class mix of 35, 25, 30 and 10 percent, the 10 percent of vague reports and the 30 percent of the remaining reports that carry a misleading clue are invented to show the mechanics, and none of it is a measurement of any real system). It trains the model, prints the confusion matrix, and then compares three routing policies over confidence thresholds. The delay costs are also assumptions: 15 minutes for a person to route a report from the manual queue, 40 minutes for a wrong owner to notice and hand it on, 240 minutes for a security incident that reaches no security responder, and 5 minutes for security to read a copy.
The three policies are: model (route by the model when confident, else manual queue), override (a keyword rule replaces the route with security whenever it matches), and notify (the model's route stands and the keyword rule adds a copy to security). The cost for one policy is
where nmanual is reports sent to the manual queue, nbounce is auto-routed reports that reached the wrong owner but were still picked up (including security reports rescued by a copy), nlost is security reports that reached no security responder, and ncopy is security copies for reports whose primary route was not security.
Before the program, two reports traced by hand under the cost rules (hypothetical reports, with the model's confidence assumed above the 0.7 floor). Report 1 is truly a security incident: "api key exposed in a public repo, dashboard shows errors", and the model confidently routes it to the data team. Under model it reaches no security responder, so it is lost: 240 minutes. Under override the keyword "exposed" matches and it goes to security: 0 minutes. Under notify the data team still gets it, which bounces (40 minutes), but security also gets a copy (5 minutes): 45 minutes in total. Report 2 is truly an infrastructure problem: "checksum mismatch on the cached build, pods restarting", and the model correctly routes it to infra. Under model: 0. Under override the harmless keyword "checksum" sends it to security instead, which bounces: 40. Under notify infra keeps it and security reads a copy: 5. So override is cheapest on report 1 and worst on report 2, model is the reverse, and notify pays a small fixed price on both.
import re
import random
import numpy as np
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.linear_model import LogisticRegression
from sklearn.metrics import confusion_matrix, accuracy_score
CLASSES = ["data", "model", "infra", "security"]
PHRASES = {
"data": ["null values in a feature column", "schema change upstream broke the feature pipeline",
"training data has not refreshed since last week", "label distribution shifted",
"duplicate rows in the input table", "missing partition for yesterday",
"feature values out of range"],
"model": ["accuracy dropped after the new model version", "predictions skew toward one class",
"model drift on recent traffic", "calibration looks off", "regression after retraining",
"embedding version mismatch", "threshold change flipped many decisions"],
"infra": ["pods restarting with out of memory", "gpu node unavailable", "timeouts calling the inference service",
"autoscaler stuck at minimum replicas", "disk full on the serving host",
"network partition between zones", "deployment rollout stuck"],
"security": ["unauthorized access to the model registry", "api key exposed in a public repo",
"suspicious login from an unknown location", "prompt injection attempts in inputs",
"possible data exfiltration from the feature store", "unexpected admin role granted",
"model artifact checksum mismatch"],
}
SHARED = ["predictions look wrong", "latency is higher than normal", "users are complaining",
"alert fired for the scoring service", "dashboard shows errors", "something changed since the last release"]
PRIOR = [0.35, 0.25, 0.30, 0.10]
def make_report(rng):
label = rng.choices(CLASSES, weights=PRIOR)[0]
parts = []
if rng.random() < 0.10: # vague report: one clue at most
if rng.random() < 0.5:
parts.append(rng.choice(PHRASES[label]))
else:
parts += rng.sample(PHRASES[label], rng.choice([1, 2]))
if rng.random() < 0.30: # misleading clue from another class
other = rng.choice([c for c in CLASSES if c != label])
parts.append(rng.choice(PHRASES[other]))
parts += rng.sample(SHARED, rng.choice([1, 2]))
rng.shuffle(parts)
return ", ".join(parts), label
def make_set(seed, n):
rng = random.Random(seed)
rows = [make_report(rng) for _ in range(n)]
return [r[0] for r in rows], np.array([CLASSES.index(r[1]) for r in rows])
Xtr_text, ytr = make_set(1, 2000) # older reports
Xte_text, yte = make_set(2, 600) # later reports, held out
vec = TfidfVectorizer(ngram_range=(1, 2), min_df=2)
Xtr = vec.fit_transform(Xtr_text)
Xte = vec.transform(Xte_text)
clf = LogisticRegression(C=10, max_iter=1000).fit(Xtr, ytr)
proba = clf.predict_proba(Xte)
pred = proba.argmax(axis=1)
conf = proba.max(axis=1)
print("held-out reports:", len(yte), " per class:", dict(zip(CLASSES, np.bincount(yte, minlength=4).tolist())))
cm = confusion_matrix(yte, pred, labels=range(4))
print("confusion matrix (rows = true owner, columns = routed owner)")
print(" " + " ".join(f"{c:>8}" for c in CLASSES))
for i, c in enumerate(CLASSES):
print(f"{c:>10} " + " ".join(f"{v:>8}" for v in cm[i]))
for i, c in enumerate(CLASSES):
p = cm[i, i] / cm[:, i].sum()
r = cm[i, i] / cm[i].sum()
print(f"{c:>10}: precision {p:.3f} recall {r:.3f}")
print(f"overall accuracy {np.trace(cm) / cm.sum():.3f}")
# Cost per report, in minutes of delay (assumptions, not measurements).
HUMAN = 15 # a person reads a report in the manual queue and routes it correctly
BOUNCE = 40 # a wrong owner receives it, notices, and hands it on
SEC_MISS = 240 # a security incident that reaches no security responder
FYI = 5 # security reads a copy of a report whose primary owner is someone else
SEC_RULE = re.compile(r"unauthorized|exposed|suspicious login|exfiltration|admin role|injection|checksum")
HIT = np.array([bool(SEC_RULE.search(t)) for t in Xte_text])
IS_SEC = yte == 3
def policy(conf_min, mode):
"""mode: 'model' (threshold only), 'override' (rule replaces the route), 'notify' (rule adds a copy to security)."""
primary = np.where(conf >= conf_min, pred, -1) # -1 = manual queue
if mode == "override":
primary = np.where(HIT, 3, primary)
copy_to_security = HIT if mode == "notify" else np.zeros(len(yte), dtype=bool)
return primary, copy_to_security
def cost_vectorised(primary, copy):
manual = primary == -1
wrong = ~manual & (primary != yte)
rescued = wrong & IS_SEC & copy
lost = wrong & IS_SEC & ~copy
return (HUMAN * manual.sum() + BOUNCE * (wrong & ~lost).sum() + SEC_MISS * lost.sum()
+ FYI * (copy & (primary != 3)).sum())
def cost_loop(primary, copy):
total = 0
for p, c, t in zip(primary.tolist(), copy.tolist(), yte.tolist()):
if p == -1:
total += HUMAN
elif p != t:
total += BOUNCE if (t != 3 or c) else SEC_MISS
if c and p != 3:
total += FYI
return total
print("\nmode threshold auto wrong-of-auto security-reached total-minutes")
for mode in ("model", "override", "notify"):
for t in (0.0, 0.5, 0.7, 0.8, 0.9):
primary, copy = policy(t, mode)
auto = primary != -1
wrong = auto & (primary != yte)
reached = (primary[IS_SEC] == 3) | (primary[IS_SEC] == -1) | copy[IS_SEC]
cv, cl = cost_vectorised(primary, copy), cost_loop(primary, copy)
assert cv == cl, (mode, t, cv, cl)
print(f"{mode:<9} {t:>9.1f} {auto.sum():>4} {wrong.sum():>13} {reached.mean():>16.3f} {cv:>13}")
primary, copy = policy(0.7, "notify")
manual = primary == -1
wrong = ~manual & (primary != yte)
lost = wrong & IS_SEC & ~copy
n_manual, n_bounce, n_lost = int(manual.sum()), int((wrong & ~lost).sum()), int(lost.sum())
n_copy = int((copy & (primary != 3)).sum())
parts = (HUMAN * n_manual, BOUNCE * n_bounce, SEC_MISS * n_lost, FYI * n_copy)
print(f"\nnotify at 0.7: manual {n_manual}, bounced {n_bounce}, lost {n_lost}, security copies {n_copy}")
print(f"minutes: {parts[0]} + {parts[1]} + {parts[2]} + {parts[3]} = {sum(parts)}")
assert sum(parts) == cost_vectorised(primary, copy) == cost_loop(primary, copy)
assert abs(accuracy_score(yte, pred) - np.trace(cm) / cm.sum()) < 1e-12
print("\ncheck passed: accuracy from the confusion matrix equals sklearn accuracy_score; vectorised cost equals loop cost on all 15 policies")
Output:
held-out reports: 600 per class: {'data': 214, 'model': 137, 'infra': 192, 'security': 57}
confusion matrix (rows = true owner, columns = routed owner)
data model infra security
data 197 8 7 2
model 6 119 11 1
infra 5 10 176 1
security 4 1 0 52
data: precision 0.929 recall 0.921
model: precision 0.862 recall 0.869
infra: precision 0.907 recall 0.917
security: precision 0.929 recall 0.912
overall accuracy 0.907
mode threshold auto wrong-of-auto security-reached total-minutes
model 0.0 600 56 0.912 3240
model 0.5 572 37 0.947 2500
model 0.7 533 14 0.965 1965
model 0.8 512 6 1.000 1560
model 0.9 488 1 1.000 1720
override 0.0 600 85 0.965 3800
override 0.5 574 67 1.000 3070
override 0.7 546 47 1.000 2690
override 0.8 533 41 1.000 2645
override 0.9 524 36 1.000 2580
notify 0.0 600 56 0.965 2815
notify 0.5 572 37 1.000 2085
notify 0.7 533 14 1.000 1775
notify 0.8 512 6 1.000 1790
notify 0.9 488 1 1.000 1985
notify at 0.7: manual 67, bounced 14, lost 0, security copies 42
minutes: 1005 + 560 + 0 + 210 = 1775
check passed: accuracy from the confusion matrix equals sklearn accuracy_score; vectorised cost equals loop cost on all 15 policies
The checks in the program are two independent recomputations that can fail: accuracy from the confusion matrix against scikit-learn's own accuracy function, and the vectorised cost against a plain loop that applies the same rules one report at a time (the program stops with an assertion error if the two implementations of the cost rules disagree). The security-reached column counts a security report as reached when the model routes it to security, when the manual queue holds it (a person will read it), or when the keyword copy goes to security.
Walking through the program
make_reportbuilds one fake report: it picks an owner using the class mix, then writes one or two phrases that belong to that owner, sometimes adds a misleading phrase from another owner, and always adds one or two generic phrases anyone might write.make_setrepeats that and returns the texts with their true owner as a number from 0 to 3. Seeds 1 and 2 make the older and later sets reproducible.TfidfVectorizer(ngram_range=(1, 2), min_df=2)turns each report into word weights, counting single words and two-word pairs, and ignores any term that appears in fewer than 2 training reports.fit_transformlearns the vocabulary from the older reports;transformapplies it unchanged to the later ones.LogisticRegression(C=10, max_iter=1000)learns one weight per term per owner.Csets how much freedom the weights get (larger means a weaker penalty against large weights) andmax_itercaps the solver's steps.predict_probagives four probabilities per report that sum to 1.argmaxpicks the owner with the largest (pred), andmaxis the confidence (conf).policydecides the route.np.where(conf >= conf_min, pred, -1)keeps the model's owner when it is confident enough and otherwise writes -1, meaning the manual queue. Inoverridemode a secondnp.wherereplaces the route with security (3) wherever the keyword rule matched; innotifymode the route stays and a copy flag is set instead.cost_vectorisedcomputes the total minutes with whole-array operations, using boolean masks:manualis reports with no auto route;wrongis routed reports whose owner differs from the truth;lostis wrong security reports with no copy (wrong & IS_SEC & ~copy, where&means "and" and~means "not").cost_loopcomputes the same total one report at a time with plainifrules. Theassert cv == clline stops the program if the two ever disagree, which is the check that the vectorised version is written correctly.
Reading the output
- Confusion matrix: 197 + 119 + 176 + 52 = 544 reports sit on the diagonal, so accuracy is 544 / 600 = 0.907. The weakest category is
model(precision 0.862, recall 0.869), mostly confused withinfra(11 model reports routed to infra, 10 infra reports routed to model). Security has recall 52 / 57 = 0.912, and 4 of its 5 misses went to the data team. - Threshold effect (model only): raising the confidence floor from 0.0 to 0.8 cuts wrong auto-routes from 56 to 6 while 512 of 600 reports (85.3 percent) are still routed automatically. The price is a larger manual queue: 600 - 512 = 88 reports, 14.7 percent.
- Override versus notify: at threshold 0.7,
overridecosts 2,690 minutes andnotifycosts 1,775. The crude keyword rule matches harmless reports too (a "checksum" or "exposed" mention in a data or infrastructure report), and when it replaces the route those reports go to the wrong team: 47 wrong auto-routes underoverrideagainst 14 undernotify. - Decomposition for the recommended policy: with
notifyat 0.7, 67 reports go to the manual queue (15 x 67 = 1,005 minutes), 14 bounce (40 x 14 = 560), none are lost, and 42 security copies are sent (5 x 42 = 210). The total is 1,005 + 560 + 0 + 210 = 1,775 minutes, which is 2.96 minutes per report against 3,240 / 600 = 5.4 for routing everything by the model with no threshold, a reduction of about 45 percent under these assumed delay costs. - Where model-only looks cheaper:
modelat 0.8 costs 1,560 minutes, 215 fewer thannotifyat 0.7, and reaches all 57 security reports in this sample. That sample cannot tell a zero-miss classifier from one that misses 5 percent of security reports. If the true miss rate were 5 percent, the expected number of unprotected security reports in a set like this one is 57 x 0.05 = 2.85. Each costs 240 instead of 40 minutes without a copy, an extra 200, so the expected loss from not sending a copy is 2.85 x 200 = 570 minutes, which is more than the 215 the copies cost. That comparison, not the single run, is why the recommendation keeps the copy. In plain words: the run shows model-only at 0.8 costing less, but this sample happened to contain no security misses, so the 215 extra minutes of copies are the premium for protection you cannot see the need for yet, and the 570 minutes is what that protection would be worth if the true miss rate were 5 percent.
Limiting the damage when it misroutes
- Abstain below a confidence floor. Reports under the threshold go to a human triage queue, which is the same path every report took before the classifier existed. Choose the floor from the cost table (0.7 in the demo), and recheck it after every retrain. Raw logistic regression probabilities are not guaranteed to be well calibrated (a score of 0.7 should be right about 70 percent of the time), so verify on held-out data that reports scored 0.7 to 0.8 are right at roughly that rate.
- Add security, never replace the route. A fixed rule covering known security phrases sends a copy to the security responders even when the model's route is another team. The demo rule covers seven phrases and nothing more. A production version also needs signals the text lacks (the alert source, the identity of the reporter, data classification of the affected system), a reviewed allow list (an approved list of phrases and sources that may trigger a copy, with everything else ignored) so copies stay low-volume, and its own recall test on real security tickets. The rule stays independent of the model so a model failure cannot disable it.
- Make a bounce cheap and visible. The receiving owner can re-route in one action, and the ticket records the original route. Each re-route is a free label correction for retraining, and the share of re-routes per category is the live error rate.
- A clock that does not depend on the router. The normal escalation policy still fires when nobody acknowledges within its time limit, so a report stuck in the wrong queue is not stranded.
- Keep the classifier's authority narrow. It suggests an owner. It does not set severity, close, merge or suppress a report.
- Audit and drift checks. Each week a person reviews a random sample of auto-routed reports. Alert when the manual-queue share, the category mix or the re-route rate moves outside a band set from the first weeks of data (that movement is the visible sign of drift). A switch that sends everything to the manual queue is the rollback.
Recommendation
Ship notify with a 0.7 confidence floor as a suggestion engine to start. In this demo that routes 533 of 600 reports (88.8 percent) automatically with 14 wrong (2.6 percent of the routed ones), puts 67 (11.2 percent) in the manual queue, and costs 1,775 minutes against 3,240. Under real data the thresholds and costs will differ. What would change the decision: a much higher real cost of a wrong route than 40 minutes (raise the floor), a security copy volume the security team cannot absorb (tighten the rule or add context signals), poor agreement between human labelers on category boundaries (fix the taxonomy before the model), or a measured accuracy on later tickets well below the training-time figure (the data has drifted, retrain and widen the manual queue).
Supporting details: complexity and edge cases
Lead with the design above; complexity comes up only briefly for this kind of question.
- Complexity: fitting costs roughly the number of non-zero feature entries (the word-weight cells that are not zero; most are, because a report uses few of the thousands of known terms) times the solver iterations, and is run offline. Routing one report is a sparse dot product per category (multiplying only the few non-zero word weights of the report by the model's weights, so most of the work is skipped), so latency is not a concern at incident volumes.
- Edge cases: an empty or one-word report (low confidence, so manual queue), non-English text (the vocabulary will not match, so it falls to the manual queue unless it was in training), a pasted stack trace that swamps the useful words, one report describing two separate incidents, and brand-new terminology after a platform change (unseen words contribute nothing, so confidence falls and the queue share rises, which the drift alert catches). Report text from outside the team is untrusted input, so an attacker can word a report to look routine. This is another reason the security copy must not depend on the model alone.
Common mistakes
- Training on the first queue instead of the final root cause.
- Reporting only overall accuracy, so a weak security recall hides inside a high number.
- Letting the classifier decide severity or auto-close, which turns a routing error into a lost incident.
- Using a single random split, which lets near-duplicate tickets leak between train and test (the same incident filed twice, one copy in each side, so the test looks easier than real life).
- Treating the security keyword rule as a replacement for the model's route, or as complete.
- Never measuring the manual queue, so the abstain path quietly becomes the main path.
Running the code
Python 3.12, numpy 2.1.3, scipy 1.14.1, scikit-learn 1.5.2
Save the program as triage_classifier.py, then run:
python triage_classifier.py
Propose a three-tier severity scheme for a machine-learning system in production. Give an example incident at each tier, and show how signals such as model drift, a latency spike or harmful generated output map to tiers, who is notified, and how fast.
Sample Answer
The idea in plain words
A severity scheme for a machine-learning (ML) system has to cover a failure that ordinary services do not have: the model can be wrong while every health check is green. The service answers fast, returns HTTP 200 and still gives bad predictions. So the tiers should be defined by business and user impact, not by the signal that fired. Signals such as drift, latency and harmful output are inputs that suggest an impact; the tier is set by how much impact is confirmed or credible.
Terms used below. Severity (SEV) is the tier that decides who is notified and how fast. An incident commander is the one person who coordinates the response and makes decisions while others investigate. A kill switch is a control that turns a feature or model off immediately without a new deploy. Trust-and-safety is the team that handles harmful or policy-breaking content. A rules-based path is a simple hand-written fallback (fixed rules instead of the model). A labelled sample is a set of predictions whose correct answers are known, so accuracy can be measured. Proxy impact measures are indirect signs of harm available sooner than labels, such as complaint rate. Relative change means a share of the old value (a fall from 90% to 86.4% accuracy is 4% relative, but 3.6 percentage points), so always say which is meant. Model drift means the live inputs or the relationship between inputs and outcomes has moved away from what the model was trained on. PSI (population stability index) is one common way to measure input drift, comparing the share of traffic in each value bin now against a reference period. A bin is a range of values of one input, for example the age bands under 30, 30 to 50 and over 50; ln is the natural logarithm, which makes the term large when a bin's share changes by a large factor. Acknowledgement (ack) target is how quickly a human must confirm they have seen an alert. Mitigation is reducing harm before the root cause is fixed, for example switching to a previous model.
The three tiers
All times and thresholds (5 and 15 minutes, 30 minutes and 2 hours, 3 times latency for 40 minutes, a 4% relative accuracy drop) are proposals chosen so each tier is slower and calmer than the one above; they are not standards, and each organisation tunes them against its own incident history and the cost of a false page.
| Tier | Meaning | Example incident (hypothetical) | Channel and who is notified | Acknowledge | Start mitigation |
|---|---|---|---|---|---|
| Tier 1 (critical) | Confirmed or likely harm to users or the business now | A text-generating assistant is producing content that breaks the safety policy for real users, confirmed by human review of flagged samples | Pager to ML on-call; incident commander; product and trust-and-safety leads; legal and communications leads by phone or chat bridge | 5 minutes | Within 15 minutes (kill switch, feature off, or fall back to the last good model or a rules-based path) |
| Tier 2 (major) | Measurable degradation, no confirmed severe harm | After a deploy, p99 latency (the time under which 99% of requests finish) of the ranking model is 3 times its target for 40 minutes, or accuracy on a freshly labelled sample drops 4% relative | Low-urgency page in working hours or pager out of hours; ML owner and product owner by chat; email summary to stakeholders | 30 minutes | Within 2 hours |
| Tier 3 (minor) | Early warning with no evidence of user impact | A feature's PSI crosses an alert threshold but outcome metrics are flat | Ticket to model owner; weekly email digest | Next business day | Within the week's sprint planning |
How the signals map to tiers
The key move is to separate leading indicators (cheap, early, noisy) from impact measures (slower, confirmed), and to escalate when a leading indicator is corroborated by an impact measure.
- Model drift. A drift statistic alone is Tier 3. It moves to Tier 2 when a quality measure confirms damage (a labelled sample, a conversion rate, a complaint rate) and to Tier 1 when the affected decisions carry high stakes (money, safety, eligibility). Worked PSI arithmetic, using PSI=∑i(ai−ei)ln(ai/ei) where ei is the reference share and ai the current share of bin i:
- Take one input feature, applicant age, in three bins. Reference shares of traffic (under 30, 30 to 50, over 50) are 0.5, 0.3, 0.2; current shares are 0.4, 0.3, 0.3. Terms: (0.4−0.5)ln(0.8)=0.0223, 0, (0.3−0.2)ln(1.5)=0.0405. PSI =0.0223+0+0.0405=0.063.
- Same bins; reference 0.5, 0.3, 0.2; current 0.25, 0.30, 0.45 (the mix has shifted strongly towards the over-50 band). Terms: (−0.25)ln(0.5)=0.1733, 0, (0.25)ln(2.25)=0.2027. PSI =0.376.
- Rules of thumb often quoted treat below 0.1 as small and above 0.25 as large. These are conventions, not standards, and they say nothing about harm, so the first case stays Tier 3 and the second is only a trigger to look at outcome metrics.
- Latency spike. Use the service's latency target and the user effect. A short breach of the target where client retries absorb the timeouts, so users see at most a brief slowdown rather than failed requests, is Tier 3; sustained breach that users feel is Tier 2; latency so high that the product fails (timeouts everywhere) is Tier 1 because it is an outage.
- Harmful generated output. Severity depends on harm times reach, not on detector score. A classifier that flags outputs has false positives, so a spike of flags is first Tier 2 (page, sample and review in minutes), and becomes Tier 1 once reviewers confirm real violations reaching users or any single high-harm case (for example content that endangers a person). Mitigation is fast and reversible: stricter filter, fallback response, or disabling the feature.
Notification and response by tier
Channel follows urgency: pager (interrupts a person at any hour) for Tier 1, pager in business hours or chat with a page escalation for Tier 2, ticket plus email digest for Tier 3. Each tier has two clocks, acknowledgement and start of mitigation, as in the table. Remediation (the permanent fix such as retraining, data repair, a new filter) has an owner named in the ticket, normally the model owner, with a date set at the post-incident review for Tier 1 and 2.
Pitfalls
- Paging on the drift statistic alone trains the team to ignore pages.
- Waiting for labelled outcomes when labels arrive weeks later: add proxy impact measures such as complaint rate, human-review samples or downstream business metrics.
- No kill switch or fallback model, which makes the Tier 1 mitigation target unreachable.
- Reusing web-service tiers unchanged: an error-rate-only matrix would rate a silently wrong model as healthy.
That is every published Incident Severity Classification and Escalation question for Machine Learning Engineer so far. Browse the other topics in this category, or practice this one interactively.