← Questions

Multitask regression with targets on different scales

0
StripeAI/ML designLast asked Apr 2026

An AI/ML design interview question asked in Stripe's technical phone screen, last asked Apr 2026. It tests regression, multitask learning and feature scaling.

You train one model with a shared representation and two regression heads. Every example has two continuous labels: target A is never positive (a loss, for example), ranging from about -10,000 to 0; target B is never negative (revenue, for example), ranging from about 0 to 50. Design the preprocessing and the training objective so the model learns both tasks at once, then explain how predictions get back to the original units.

Requirements

  • Functional: handle the sign of target A; normalize both targets so neither one dominates the loss; combine the two losses; invert every transform at inference time; evaluate each task in its own units.
  • Non-functional: transforms fitted on training data only, the same at training and serving time, and predictions that respect each target's sign.

Clarifying questions

  • How are the targets distributed: heavy tails, many exact zeros, outliers?
  • Which matters more to the business, and which error matters: absolute error in dollars or relative error?
  • Are both labels present for every example, or is one sometimes missing?
  • What is the model (a neural network with two heads, or something else) and what does it feed downstream?

What a strong answer covers

  • Handling the sign: predict the magnitude of A (for example -A) and restore the sign, or use an output activation that cannot cross zero.
  • Scaling: standardization, min-max or a log transform (log1p of the magnitude) for the wide-range target, fitted on the training split only, with the reason for the choice.
  • Loss combination: per-task losses on comparable scales, fixed weights vs learned uncertainty weights vs gradient balancing, and a robust loss when tails are heavy.
  • Inverting the transforms correctly, including the bias a log transform introduces in the mean, and clipping to the valid sign.
  • Pitfalls: leaking statistics from the test set, one task's gradients swamping the shared layers, evaluating in scaled units instead of real ones, missing labels.

Follow-ups

  • One task gets much worse as soon as you train them together. How do you diagnose and fix it?
  • Half of the examples have no label for B. How do you train?
  • The business only cares about errors on the largest losses. What changes in the loss or the metric?

Where it's asked

  • Stripe · Technical phone screen · Last asked Apr 202660 min · One realistic task in parts, in a project editor (CoderPad project mode or HackerRank Projects) with several files and tests

What it tests

regression · multitask learning · feature scaling

Your canvas
Draw your answer hereBoxes, arrows and notes, saved for you to come back to.Sign in to start drawing