AI Computer Institute
Expert-curated CS & AI curriculum aligned to CBSE standards. A bharath.ai initiative. About Us

Multi-Task Learning: Training Multiple Objectives Simultaneously

📚 Programming & Coding⏱️ 19 min read🎓 Grade 9
✍️ AI Computer Institute Editorial Team Updated: August 2026 CBSE-aligned · Peer-reviewed · 19 min read
Content curated by subject matter experts with IIT/NIT backgrounds. All chapters are fact-checked against official CBSE/NCERT syllabi.

Your school's exam-readiness app looks at three numbers about you — attendance percentage, hours studied this week, and last term's marks — and answers two completely different questions from that same data. Question one: "What marks will this student likely score in the next test?" Question two: "How urgently does the class teacher need to check in with this student?" Both answers come from the same input facts, but they are not the same question. One is about a number out of 100. The other is about a priority level for a teacher's attention list. If you were asked to write two separate programs for this — one that only ever thinks about predicted marks, and one that only ever thinks about teacher priority, never sharing anything between them — you would be throwing away something valuable: both programs need to first understand roughly the same idea, "how well is this student currently engaging with their studies?" Building that understanding twice, from scratch, in two isolated pieces of code, is wasteful. Multi-task learning is the technique of building it once and using it for both jobs at the same time. This chapter shows you exactly how, with numbers you can trace by hand.

What a "Task" Means in Machine Learning

Before going further, pin down the vocabulary precisely, because CBSE-style questions often test exact definitions. A task in machine learning is a specific prediction objective paired with its own labels and its own way of measuring error. "Predict the exam marks" is one task — its labels are numbers like 75 or 82, and its error is measured by how far off the prediction is. "Predict the teacher-attention priority" is a different task — its labels are priority scores like 3 or 8, with their own error measurement. Two tasks can use the exact same input data and still be genuinely different tasks, because what counts as "correct" is different for each one. This distinction matters because multi-task learning is not about having more input features. It is about having more than one output objective that the model must satisfy at once.

The Wasteful Way: Two Completely Separate Models

The most obvious approach is single-task learning, done twice. You build Model A, whose only job is predicting marks from (attendance, hours studied). You build Model B, whose only job is predicting teacher-attention priority from the same two inputs. Each model has its own internal weights, learned independently, using only its own task's errors to correct itself.

Here is the problem. Both tasks secretly depend on the same underlying pattern: a student who attends more and studies more is generally more "engaged," and engagement drives both a higher predicted mark and a lower need for teacher attention. Model A has to discover this engagement pattern using only marks-error feedback. Model B has to discover the very same pattern all over again, from zero, using only priority-error feedback. Two independent, weaker discovery processes replace what could have been one stronger, better-supervised one. You also end up storing and running two full models instead of one shared computation with two small extensions. In a classroom of 40 students and a school of 1,200, that duplicated computation adds up, and so does the duplicated risk of each model learning a slightly wrong version of "engagement" because it only saw half the evidence.

Building a Shared Representation, Step by Step

Multi-task learning fixes this by splitting the computation into two stages. First, a shared layer looks at the raw inputs and computes one intermediate value that captures the general pattern useful to every task — call it h, for "hidden representation." Second, each task gets its own small, separate task head that takes that same h and turns it into its own specific answer. The shared layer is trained using error feedback from every task combined. Each head is trained using error feedback from only its own task.

Let's compute this by hand for one student. Scale attendance to a 0–10 score and use hours studied per week directly:

  • x1 = attendance score = 9
  • x2 = hours studied per week = 5

Step 1 — Shared layer. Suppose the shared layer has learned the weights 2 and 3 for x1 and x2 (in a real network these weights start random and are adjusted by training; here we use already-learned values so you can trace the arithmetic):

h = 2 × x1 + 3 × x2 = 2 × 9 + 3 × 5 = 18 + 15 = 33

This single number, 33, is the shared representation. Notice it does not by itself mean "marks" or "priority" — it is a general-purpose summary of engagement that both tasks will now interpret in their own way.

Step 2 — Task-specific heads. Task A's head (predicted marks) has learned weight 2 and bias 4:

marks = 2 × h + 4 = 2 × 33 + 4 = 66 + 4 = 70

Task B's head (teacher-attention priority, on a 0–10 scale) has learned weight 1 and bias −30:

priority = 1 × h − 30 = 33 − 30 = 3

Both answers — predicted marks of 70 and a priority score of 3 (low urgency, since 33 reflects fairly strong engagement) — came from the same shared number 33, filtered through two different, independently-learned heads. This is exactly the code-level idea of a function whose return value gets reused by two different callers, and it maps directly onto programming practice: compute a value once, pass it to multiple functions, instead of recomputing it inside each one.

def shared_layer(x1, x2):
    # x1 = attendance score (0-10 scale)
    # x2 = hours studied per week
    return 2 * x1 + 3 * x2          # the shared representation, h

def task_a_head(h):
    # Task A: predict exam marks out of 100
    return 2 * h + 4

def task_b_head(h):
    # Task B: predict teacher-attention priority (0-10 scale)
    return h - 30

x1, x2 = 9, 5
h = shared_layer(x1, x2)
predicted_marks = task_a_head(h)
predicted_priority = task_b_head(h)

print(h, predicted_marks, predicted_priority)
# 33 70 3

Trace it line by line: shared_layer(9, 5) computes 2*9 + 3*5 = 18 + 15 = 33, so h = 33. Then task_a_head(33) computes 2*33 + 4 = 66 + 4 = 70. Then task_b_head(33) computes 33 - 30 = 3. The printed line matches exactly: 33 70 3. Everything here is plain integer arithmetic — the point is architectural, not the specific weight values, which in a real system would be discovered through training rather than chosen by hand.

x1 = attendance score = 9 x2 = hours studied = 5 Shared Layer h = 2x1 + 3x2 h = 18 + 15 = 33 (learned from BOTH tasks' errors) Task A head marks = 2h + 4 Output: 70 / 100 Task B head priority = h - 30 Output: 3 / 10

What "Training Simultaneously" Actually Means

The word "simultaneously" in this chapter's title is doing precise, technical work — it is not just a flourish. During training, for every student in the training data, the model computes both predictions in the same forward pass, compares both to their true labels, and combines both errors into a single number before adjusting any weights. That combined number is called the total loss, and it is usually a weighted sum of the individual task losses.

Suppose the true marks for this student turned out to be 75, and the teacher's actual assigned priority score was 4. Using squared error (a standard, simple way to measure "how wrong" a numeric prediction is — the difference, squared, so bigger misses are punished more and the sign of the error does not matter):

  • Loss_A (marks task) = (75 − 70)2 = 52 = 25
  • Loss_B (priority task) = (4 − 3)2 = 12 = 1

These two losses are not automatically equal in importance. Marks out of 100 and priority out of 10 live on different scales, and in this school's app, getting the marks prediction right matters far more to how the app is used than getting the priority score exactly right. So the combined loss uses task weights that reflect that importance — say 0.9 for the marks task and 0.1 for the priority task:

Total loss = (0.9 × Loss_A) + (0.1 × Loss_B) = (0.9 × 25) + (0.1 × 1) = 22.5 + 0.1 = 22.6

This single number, 22.6, is what actually drives the next round of weight adjustments. Crucially, because both Loss_A and Loss_B feed into it, the shared layer's weights (the "2" and "3" that produced h = 33) get nudged using information from both tasks at once, in the very same update. If h had been too low for the marks task (needing to go up to push marks closer to 75) but too high for the priority task (needing to go down to push priority closer to 4), those two pulls would partly cancel — a small tug-of-war that only exists because the tasks share the same underlying number. This tug-of-war is the heart of multi-task learning: it is also exactly why choosing sensible task weights, like the 0.9/0.1 split above, is itself an important design decision, not an afterthought.

A Common Misconception: "Simultaneous" Does Not Mean "One After Another"

A very natural but incorrect guess is that multi-task learning means: first train the model fully on Task A until it's good at predicting marks, then afterwards retrain it on Task B to also predict priority. That sequential process is a different technique entirely — it is closer to what is called transfer learning or sequential fine-tuning, and it carries a well-known risk called catastrophic forgetting: while the model is being retrained only on Task B's errors, nothing is protecting the weights that made it good at Task A, so its Task A performance can quietly degrade or collapse while Task B improves.

True multi-task learning avoids this by construction, because both tasks' errors are present in every single training step, combined into one total loss before any weight moves. The shared weights are never allowed to drift toward serving only one task, because they are updated by the combined pull of every task, every time. This is the precise, testable difference between "trained simultaneously" (multi-task learning) and "trained one after the other" (sequential/transfer learning) — and it is the detail most often confused, and most often worth stating explicitly in a board-exam answer.

Why Sharing Can Backfire: Negative Transfer

Sharing a representation only helps when the tasks genuinely benefit from similar underlying patterns. Predicted marks and teacher-attention priority both plausibly depend on "engagement," so forcing them through the same h is reasonable — the shared layer is being pushed to learn a genuinely useful, general feature rather than overfitting to noise specific to one task, which is itself a mild regularizing benefit of multi-task learning.

But imagine adding a third task to the same shared layer: "predict this student's favourite cricket team." That label has nothing meaningfully to do with attendance or study hours. Forcing the shared layer h to also help predict cricket-team preference means its weights now get pulled by an irrelevant error signal on every training step, distorting the "2" and "3" weights away from values that were genuinely useful for marks and priority. Task performance on the original two tasks can get measurably worse than if they had simply been trained alone. This effect has a specific name — negative transfer — and it is the main reason multi-task learning is not "always better, the more tasks the merrier." A designer choosing which tasks to bundle into one shared model has to judge, in advance, whether the tasks are related enough that sharing a representation will help rather than hurt.

Counting the Real Savings: Parameters and Supervision

It helps to make the efficiency claim concrete by literally counting numbers, not just asserting "it's more efficient." In the fully separate, single-task version: Model A needs its own two input weights plus its own head's weight and bias (4 numbers total). Model B independently needs its own two input weights plus its own head's weight and bias (another 4 numbers). That's 8 learned numbers in total, and the two input-weight pairs are each trained using feedback from only one task.

In the shared multi-task version worked out above: the shared layer needs only 2 weights (used by both tasks), Task A's head needs 2 more (weight and bias), and Task B's head needs 2 more. That's 6 learned numbers in total — 25% fewer than the separate approach — and, more importantly, the 2 shared weights receive gradient feedback from both tasks on every single training example, effectively doubling the amount of supervision each of those weights receives compared to a single-task model's hidden weights. Fewer parameters to learn, combined with more error signal per parameter, is precisely why multi-task models often generalize better on related tasks with the same amount of training data — not because of any magic, but because of this concrete arithmetic of sharing.

Where This Architecture Shows Up

The "shared bottom layers, separate task heads" pattern used above is called hard parameter sharing, and it is the most common multi-task setup in practice. Autonomous-driving perception systems are a well-known real example: a single shared visual backbone processes a camera image once, and separate heads branch off it to detect object boundaries, estimate distance to obstacles, and identify lane markings — three related tasks that all benefit from the same underlying visual features, computed once instead of three times. Multilingual translation systems are another: one shared model backbone handles many language pairs, with the shared layers learning general patterns of language structure that transfer across languages, while smaller task-specific components handle the details of each particular language pair.

Check Your Understanding

Question 1. A shared layer computes h = 3x1 + x2. For a student with x1 = 4 and x2 = 6, Task A's head computes output = 5h − 10, and Task B's head computes output = h + 20. Find h, Task A's output, and Task B's output.

Solution. h = 3(4) + 6 = 12 + 6 = 18. Task A = 5(18) − 10 = 90 − 10 = 80. Task B = 18 + 20 = 38.

Question 2. True label for Task A above is 85, and true label for Task B is 40. Using squared error and task weights 0.7 (Task A) and 0.3 (Task B), find the total loss.

Solution. Loss_A = (85 − 80)2 = 25. Loss_B = (40 − 38)2 = 4. Total = 0.7(25) + 0.3(4) = 17.5 + 1.2 = 18.7.

Question 3. A classmate says: "I trained my model on handwriting recognition for two weeks, then switched to training it only on speech recognition for two more weeks — that's multi-task learning." Explain what is wrong with this claim, and name the risk this approach specifically carries.

Solution. This is sequential/transfer learning, not multi-task learning, because the two tasks are never trained together in the same step with a combined loss — only one task's error signal is present at a time. The specific risk is catastrophic forgetting: while training only on speech recognition, nothing protects the weights responsible for handwriting recognition, so that earlier skill can degrade.

Question 4. Give one condition under which adding a third task to a shared model is likely to cause negative transfer rather than help.

Solution. When the third task's underlying pattern is unrelated to the patterns useful for the existing tasks, its error signal pulls the shared weights toward features that don't help (and may actively hurt) the original tasks' performance.

Summary

  • A task is a specific prediction objective with its own labels and error measure; multi-task learning trains a model against more than one task at once.
  • Hard parameter sharing splits the model into a shared layer, computed once from the inputs, and separate task-specific heads that each transform that shared value into their own output.
  • Training is simultaneous: every training step combines every task's loss into one total loss (often a weighted sum) before adjusting any weight, so the shared layer is shaped by every task's feedback together.
  • This differs fundamentally from sequential/transfer learning, which trains on tasks one after another and risks catastrophic forgetting of earlier tasks.
  • Sharing helps when tasks are genuinely related (fewer total parameters, more supervision per shared parameter) but can cause negative transfer — measurably worse performance — when unrelated tasks are forced to share a representation.
  • Choosing task weights in the combined loss is a real design decision, since tasks with different scales or different importance should not automatically be treated as equal.
← Active Learning: Smart Data LabelingMeta-Learning and Few-Shot Learning: Learning to Learn →

Found this useful? Share it!

📱 WhatsApp 🐦 Twitter 💼 LinkedIn