LearnQuest  ›  Module 1: AI Literacy & Technical Fundamentals  ›  Lesson 1

Lesson 1: How Ranking Works

AGES 12–17  ·  ABOUT 40–45 MINUTES

You are the algorithm.

I can… explain that a feed is a ranking problem, read a scoring formula, and build a tiny ranker of my own.

How it works: 8 beats — Hook, Frame, Diagnose, Model, Compare, Build, Prove, Keep. Each beat has something to read, something to do, and a check. Answer a check right to unlock the next beat. Your progress saves on this device only — no account, nothing sent anywhere.

A note on what's real: the ideas in this lesson come from how recommendation systems are described publicly. The exact numbers inside a real app like TikTok are not public — this lesson teaches the mechanism, not secret numbers. Where a claim comes from one creator's breakdown, we say so.

Warm-up

Think of the last video app you opened. Did you search for something — or did it show you things first?

BEAT 1 · HOOK

A video app keeps showing you videos you actually like.

What did it learn from?

Your actions are data, and machines learn from data. The app watches what you do — what you finish, skip, like — and uses that to guess what to show next.

Now live it: you are the feed

Here are 6 videos the app is considering. For each one, tap what you would do. Watch how the feed learns from you.

0 of 6 judged.

See it? A feed is not a search. You never asked for anything — the app guessed, watched what you did, and re-ranked what was left. That loop — guess, watch, re-rank — runs over and over. That is the whole lesson.

Check 1 of 9

Is a feed a search?

A search starts with your question. A feed starts with a guess — then it learns from your reaction and guesses again.
Finish Beat 1's check to unlock this beat.
BEAT 2 · FRAME

Input → algorithm → output

Every AI follows one path: input (data in) → algorithm (steps to follow) → output (result out). Tap each card to flip it.

Fill in the blank

A photo tagged “cat” by a person has a ___.

The tag is the correct answer attached to the data — a label.

Step 1: candidate generation

A feed does not score every video in the world. First it pulls a few hundred things you might see — from people you follow, people like you, what's trending, and your history. Cheap and broad. Only that shortlist gets scored.

Pool (thousands) → shortlist (a few hundred) → scored & ranked → you see the top few

Put the steps in order

Tap the steps in the right order: first the dataset, then the learning algorithm, then the prediction.

The AI studies examples first, then predicts.

Check 2 of 9

What is output?

Input goes in, the algorithm works, output comes out.

Check 3 of 9

What does candidate generation do?

Scoring everything would be slow and expensive. The feed narrows the pool first, then scores only the shortlist.
Finish Beat 2's checks to unlock this beat.
BEAT 3 · DIAGNOSE

Will it work — or is it missing what it needs?

An engineer wants an AI to label photos of recyclables as “plastic” or “paper.” Sort each plan: will it work, or is it missing what the AI needs? Tap a plan, then tap a bucket.

Will work

Missing what it needs

To learn specific names like “plastic,” the AI needs labeled examples — all of them, or a few plus lots of unlabeled ones.

Same test, ranking version

Now sort ranker plans the same way.

Will rank

Missing what it needs

A ranker needs two things: data on what people did, and weights that say what matters. One without the other can't rank.

What does each machine learn from?

Sort each card into the right kind of learning. Tap a card, then tap its group.

Ask what it learns from: labels, no labels, a few labels, or rewards.

Check 4 of 9

A store groups shoppers by habits, with no group names given. Which type is this?

Nobody gave group names, so there were no labels — it found its own groups.
Finish Beat 3's check to unlock this beat.
BEAT 4 · MODEL

Where the math runs

The train-line analogy. Machine learning is like learning a new train line by riding it. You notice patterns — the express skips 23rd, it's packed at 8am — and start predicting. More rides (data) = better predictions.

In the analogy, each ride is…

Each ride is another example to learn from.

“It'll be packed at 8am” is the…

A best guess from patterns — a prediction.

On the phone, or on a server?

Scoring a video on your phone means no round-trip per swipe, and it works offline. The phone model is a compressed version of the server model — same shape, fewer parameters. Context — time of day, battery, mute, brightness — can shift what gets shown. In the model this lesson uses, raw context stays on the phone: the server sees scores, not necessarily the raw signals.

Try it: flip the switches and watch one video's score move. Each switch says where that piece was computed.

“My Cat vs. a Cucumber” — demo score0.00

Base score 1.00. Evening +0.10 (on-device) · Low battery −0.15 (on-device) · Muted −0.05 (on-device) · Bright screen +0.05 (on-device) · On mobile data −0.10 (server).

Check 5 of 9

Why run a model on the phone at all?

On-device scoring is fast and offline-friendly. The phone model is smaller — a compressed version of the server one.
Finish Beat 4's check to unlock this beat.
BEAT 5 · COMPARE

Two teams, one winner

Two teams build an AI to spot which cafeteria meals students will skip. Vote for the better plan before you see the pros and cons.

Team A

Feeds the AI 3 days of lunch data and launches.

Team B

Feeds it a full semester of meals with how much was thrown away, then tests predictions on a new week.

Winner: Team B. Team A: fast — but tiny dataset, misses pizza Fridays and holidays, predictions will be shaky. Team B: bigger labeled dataset, tests on new data, catches weekly patterns — it just takes longer to collect. More (and better) data plus testing on new examples beats a quick guess from a tiny dataset.

Same comparison, ranking version

Two teams build a feed ranker. Which one wins?

Team A

One day of clicks, launch tomorrow.

Team B

A month of labeled watch-and-skip data, tested on a brand-new week.

Winner: Team B, same reason. One day of clicks can't tell a fad from a habit — and it was never tested on data it hadn't seen.

Vote: pick the better answer in each pair

Pair 1. A feed that shows only what you already liked, or a feed that mixes in one new thing each day?

A feed that only shows what you already liked traps you in a loop. One new thing a day is how you discover anything.

Pair 2. A ranker that only counts likes, or one that counts finish + comments + skips?

One signal is easy to game and easy to misread. Several signals, weighted, tell a fuller story — that's why the formula has more than one term.

Check 6 of 9

Recommendation algorithms mainly do what?

That's how your feed picks the next video.
Finish Beat 5's check to unlock this beat.
BEAT 6 · BUILD

Build it yourself — with Byte

Byte, your AI Engineer Mentor — curious, precise, asks “what does the machine learn from?” Byte never designs the system for you. Your turn first.

Build 1: an AI that predicts which students might need extra help in math

What data goes in? Keep privacy in mind.

Which type, and why?

What does it produce, and who uses it?

Build 2: the Score Lab

Now the formula itself. Each video has predicted chances — the chance you'll finish it, like it, comment, follow, how long you'll stay, and the chance you'll skip. The score adds them up, each multiplied by a weight. The weights are the product decision: raise one, and a different kind of video wins.

score = wfinish×P(finish) + wlike×P(like) + wcomment×P(comment) + wfollow×P(follow) + wstay×stay − wskip×P(skip)

Nothing in the formula knows what a video is — only what people like you did with things like it. Stay time is counted in minutes, so a 42-second watch counts as 0.70.

Build 3: the same machine, different data

Rank Pattern Flip levels instead of videos. Same shape, new numbers — these are illustrative, not measured from real players:

level_score = wcomplete×P(complete) + wretry×P(retry) − wquit×P(quit)

Near-miss idea: a level players almost finish but then quit is a “1 flip away!” moment — a great hook, a bad first level. The flagged level above is the one with the highest finish × quit combination.

Check 7 of 9

If you raise the follow weight, what kind of video wins?

The weight is the decision. Raise w_follow and the feed favours creators you'll follow; raise w_stay and it favours long watches.

Check 8 of 9

Why is there a minus sign on skip?

Every term is a predicted action. Skip is the one you want less of, so it subtracts.
Finish Beat 6's checks to unlock this beat.
BEAT 7 · PROVE

Prove it — fast warm-ups

Two fast ones before the exit ticket. No timer on screen — just answer from what you know now.

Warm-up 1. A robot vacuum gets better at avoiding chairs by bumping into them. That's…

Trial and error with feedback — reinforcement.

Warm-up 2. The steps a computer follows are the…

Step-by-step instructions — the algorithm.

Check 9 of 9

Your ranker can surface one Flip level next. Which should go first — and why?

The score is the decision, not the difficulty. The top-ranked level is the one the math says players will finish, retry after failing, and not quit on.

Reflect

Many apps learn from you to keep you watching. Who benefits when you stay longer — the company, advertisers, you, or more than one?

When would you want a feed to show you something hard?

Finish Beat 7's checks to unlock this beat.
BEAT 8 · KEEP

Keep it

Your recap:

My ranker → Input: … · Weights: … · Output: …

Takeaway: Input → algorithm → output. Ask what it learns from: labels, no labels, a few labels, or rewards.

Summary

1. A feed is a ranking problem, not a search. 2. It narrows to candidates, scores each one by predicting your actions, then sorts. 3. The weights are the product decision — they pick the winner. 4. Small models can run on your phone; context can shift the scores. 5. The same math ranks videos, levels, or anything else you can score.

Two things people get wrong

“The feed knows what I like.” It doesn't. It predicts what people statistically like you did — and the gap is where the feed feels wrong. “More data always wins.” More good data, tested on new examples, wins. A tiny dataset, however fast, makes shaky predictions.

How sure are you?

How sure are you that you can explain how ranking works — 1 (not at all) to 4 (I could teach it)?

Exit ticket

One question stands between you and the badge. Get it wrong and you can retry as many times as you like — the badge waits until it's right.

A feed shows you a video because…

Ranking, not mind-reading: predicted actions, weighted, sorted. That's the lesson.
Finish Beat 7 to unlock this beat.

Glossary

Candidate
One thing the feed is considering showing you.
Ranking
Putting candidates in order by score, best first.
Score
One number per candidate, built from predicted actions and weights.
Probability
How likely something is — a number from 0 (never) to 1 (always).
Weight
How much one predicted action counts in the score. The product decision.
Model
A trained system that makes predictions from patterns in data.
On-device
Computed on your phone, not on a server.
Server
A faraway computer that does the heavy work and sends results back.
Context signal
Something about the moment — time, battery, mute — that can shift a score.
Retention
Keeping you watching, or bringing you back.

Sources & honesty note: the ranking mechanism in this lesson is drawn from public descriptions of recommendation systems and from the LearnQuest v1 lesson “How Machines Learn.” The exact weights and signals inside any real app are not public, and the numbers here (video predictions, Flip level numbers) are illustrative teaching numbers, not measured data.

← Module 1 · LearnQuest home · Privacy