In this article
Before you start
This page reads the question as a machine-learning design question, not as a job scheduler or task queue. It is a technical probe in the hiring manager round.
Why interviewers ask this
The question tests whether you design for the messy part of production: several kinds of input competing for one model. A hiring manager hears how you think about shared cost, interference between teams' needs, and ownership when quality drops in one area. They also listen for your own part in such a design, which is what the question about your exact contributions to past projects probes.
A weak answer says "train one big model on everything." A strong answer separates sharing from isolating, says how domains are weighted, and says how each domain is measured so a regression is visible. A Staff-level answer adds a rule for when to stop sharing and split the model.
Multi-task design from first principles
- Task head
- A task head is a small output layer or module attached to a shared backbone that turns its general representation into the output one task or domain needs, such as a class label or a score.
In plain words
Think of one kitchen cooking for five restaurants. The ovens and knives are shared, so the cost is low. Each restaurant still has its own recipe card. The analogy breaks when one restaurant's rush starves the others of oven time; a model has no such manager unless you build one.
A backbone is the large shared part of a model that turns raw input into a general representation; the heads and adapters sit on top of it. In one precise sentence: a multi-task system shares most parameters across domains, adds a few domain-specific parameters, and controls how training effort is divided.
The main risk is negative transfer, where one domain loses quality while others train beside it, and adapters are the usual way to contain it. The design has two stages. Stage 1 trains the backbone and the heads together on all domains, with balanced sampling and per-domain measurement; Steps 1 to 3 belong here. Stage 2 freezes that backbone and adds adapters where a domain suffers or a new domain arrives; Step 4 belongs here.
Step-by-step description
- One backbone, one head per domain.
- Temperature sampling lifts small domains.
- Evaluate each domain on its own.
- Adapters contain interference.
- A shared backbone feeds a task head for each domain.
- Temperature sampling gives small domains a larger share.
- Each domain is evaluated on its own held-out set.
- Adapters contain negative transfer between domains.
Step 1: Share a backbone and give each domain a head
Hard parameter sharing means one backbone, often a transformer encoder, is trained on all domains at once and each domain or task gets its own task head. Input: text, images or records from any domain. Output: a domain-specific prediction. Ruder (2017), an overview of multi-task learning in deep neural networks, introduces the two most common methods; the other, soft parameter sharing, gives each task its own model and keeps their parameters close with a penalty.
Sharing pays when domains are related, because the backbone learns from more data than any single domain has. It also means one model to deploy, monitor and patch. State this reason aloud in the interview: you share because the cost and the data are shared. You now have the baseline design, and its weakness is that every domain pulls the same shared weights, so one domain's gain can come at another's expense.
Step 2: Balance how often each domain is sampled
If you sample in proportion to data size, the largest domain dominates and small ones barely train. Temperature-scaled sampling is a way of choosing training examples that raises each domain's share to the power one over a temperature, so a higher temperature flattens the mix; it is a common practice when one model trains on many datasets or languages. In an illustrative mix of four domains with 1,000,000, 200,000, 20,000 and 5,000 examples, the smallest gets 0.41% of samples proportionally, 4.26% at temperature 2 and 11.51% at temperature 4.1
Sampling matters in stage 1, where all domains share weights; frozen per-domain adapters do not compete with each other. Flattening is not free: it repeats small-domain examples more often, which can overfit them. Treat the temperature as a setting tuned on per-domain held-out results.
Step 3: Evaluate each domain on its own and route
Each domain is evaluated on its own held-out set, never only through a pooled average, because a pooled number can hide a drop in a small domain. Report one metric per domain on that set. Compare each domain against a single-domain baseline; if the shared model loses to it by more than your tolerance, that domain moves to Step 4: an adapter, a larger adapter, or a split from the shared backbone.
At serving time, route each request to its domain's head or adapter using a domain label or a lightweight classifier, and send unclear inputs to a safe default. Monitor per-domain quality after launch, since traffic mix drifts.
Step 4: Contain interference between domains
When one domain's updates hurt another, that is negative transfer, and stage 2 contains it. Once Step 3 shows a domain losing quality, one common containment is to freeze the shared backbone and train an adapter per domain. Houlsby et al. (2019) report that adapter modules add few trainable parameters per task (3.6% on the General Language Understanding Evaluation (GLUE) benchmark), leave the original network fixed, and let new tasks be added without revisiting old ones. They transferred BERT (Bidirectional Encoder Representations from Transformers) to 26 text classification tasks and, on GLUE, came within 0.4% of full fine-tuning.
Storage shows the gain. Take an assumed 110 million parameter backbone with adapters at 3.6% of its size (Houlsby's figure on BERT-large, so an illustrative scaling): full copies for 50 domains total 5,500 million parameters, and a backbone plus adapters totals 308 million.1 Other options include mixture-of-experts routing, which sends each input to a few expert sub-networks, or gradient surgery, which edits conflicting gradient directions between tasks; name them, then pick one for your constraint.
Text description of the diagram
- Full copies for 50 domains total 5,500 million parameters in this illustrative case.
- A backbone plus adapters totals 308 million parameters for 50 domains.
Knowing it is half the job. Saying it is the other half.
Interview Clozo is an AI interview copilot for real interview rounds: it hears the question and puts a strong answer on your screen, and you say it in your own words. See the features or how it works.
Start Free Trial →The Staff-level answer
How would you design a multi-task system that handles varying domains?
I would start by training a shared backbone with a small head per domain, jointly on all domains, because related domains share data and cost. I would balance sampling with a temperature so small domains still train, then evaluate every domain separately against its own single-domain baseline. If one domain's gain hurts another, that is negative transfer, so I freeze the backbone and train adapters for the affected or new domains. If a domain still loses to its baseline beyond a tolerance, I split it out. I would also assign an owner per domain for monitoring after launch.
What makes it Staff-level is the explicit exit rule: sharing is a hypothesis you test per domain, with a stated condition for abandoning it.
The rubric
| Dimension | Weak answer | Strong answer | Staff answer |
|---|---|---|---|
| Correctness | One model on all data | Shared backbone plus domain heads | Adapters or experts chosen for a named constraint |
| Depth | Ignores interference | Names negative transfer | Detects it per domain and contains it |
| Trade-offs | None stated | Cost versus quality | Splits the model when a domain loses to its baseline |
| Communication | Lists techniques | Walks through steps in order | Ties each step to a failure it prevents |
| Follow-up readiness | Stalls on "what if" | Handles data imbalance | Covers adding a domain and ownership |
Three variants of this question
How would you add a new domain to a live multi-task system?
Train a new adapter and head on the frozen backbone, so existing domains are not retrained. Houlsby et al. note that new tasks can be added without revisiting previous ones. Then run every domain's evaluation again before release, and extend the evaluation set with the new domain's held-out examples.
What if one domain has very little data?
During the joint stage, share the backbone so the domain benefits from the other domains, and raise its sampling share with a higher temperature. If you later give it an adapter, keep that adapter small to limit overfitting. Report its metric on its own held-out set.
Why not just train one model per domain?
Separate models avoid interference but multiply storage, deployment and monitoring work by the number of domains. They are the right choice when a domain loses to its baseline inside the shared model or has different requirements, such as privacy, latency or release timing.
Common mistakes
- "More tasks always means better results." (wrong) Tasks can interfere. (right) "I test each domain against its single-domain baseline."
- "I would report the average accuracy." (wrong) A pooled number hides a small domain's drop. (right) "I report one metric per domain."
- "Multi-task and multi-domain are the same." (wrong) Different tasks differ in the output; domains differ in the input. (right) "My heads handle tasks and my adapters handle domains."
- "One shared model is always cheaper." (wrong) Interference can force adapters or a split. (right) "I share until a measured regression says stop."
Follow-up questions
How do you know a new domain is hurting an old one?
Compare the old domain's held-out metric before and after the new domain joins training. A drop beyond your tolerance, with other domains steady, points to negative transfer.
What happens when the router sends a request to the wrong domain?
The request meets the wrong head or adapter and the answer degrades silently. Use a confidence threshold on the router and send low-confidence inputs to a safe default, and track the router's error rate per domain; someone must own it, an ownership question of the kind in lead developer or manager.
How do you size an adapter?
Start small and grow it only for a domain that loses to its baseline. Houlsby et al. report 3.6% of the parameters per task on GLUE, within 0.4% of full fine-tuning, which is a reasonable starting point to tune from. The machine learning system design guide shows where this sits in a full design.
What if two domains need different label sets?
Give each its own task head. The shared backbone produces one representation, and each head maps it to that domain's labels, so label sets never have to match.
What does an adapter cost at serving time?
An adapter adds a few extra layers to each request, which costs a little compute. The larger cost is operational: requests for different domains use different adapters, so batching them together is harder than with one shared model.
- Share a backbone because related domains share data and cost.
- Balance sampling with a temperature for whatever is trained jointly.
- Contain negative transfer with per-domain adapters on a frozen backbone.
- Evaluate every domain against its own baseline, never only a pooled average.
- State the rule for splitting a domain out of the shared model.
Sources
- An Overview of Multi-Task Learning in Deep Neural Networks (arXiv 1706.05098) — arXiv (Ruder), 15 Jun 2017
- Parameter-Efficient Transfer Learning for NLP (arXiv 1902.00751) — arXiv (Houlsby et al.), 2 Feb 2019