Fine-tuning basics (TypeScript) · Chapter 20 of 20
Interview round
By the end of this chapter you have answered five timed questions a fine-tuning interviewer asks, each the way this lab taught you: say the answer in a sentence, then prove it with a small measurement. A split that leaks, a training file that passes and is still wrong, how many numbers LoRA trains, where to stop on a loss curve, and when to fine-tune and when to retrieve. Build it in your browser: a real editor and terminal, AI that explains, and tests that tell you when it works.
- Part: Proof
- 5 tasks
- TypeScript
- In the all labs plan
The first 2 chapters of Fine-tuning basics (TypeScript) are free. This one comes with the all labs plan.
Why you need this
The tagger is live. Mangala's leak queue gets every leak, Rashmi pays a few rupees a month to run it, and the type-ahead still finishes the agents' sentences. Chulha is hiring a second ML engineer, and Irfan runs the interview the way he ran this project: "I do not want definitions. Anyone can say 'overfitting'. Tell me why something is true, then show me a run that proves it, in ten minutes."
Each question takes one idea from the lab, with no hand-holding: the file has the question, and the check measures your proof. The ideas are below as a refresher, and as what an interviewer listens for. The answers are not.
What you build: 5 tasks
Each task has tests. You write the code in the lab's editor and press Check.
- Task 1 · interview question
Interview: leaky-split.ts, a split that leaks
Time yourself: 10 minutes. Export leaks(train, test): { customers, texts }, the test rows whose phone is also in train, and the test rows whose key(message) (given) is also a train message's key.
Under if (import.meta.main), take the rows of export.csv whose key is not empty, as { phone, message }, and for randomSplit(rows) then customerSplit(rows) (both given) print:
random split: C of N test rows share a customer with train, T share the words
split by customer: C of N test rows share a customer with train, T share the words
- Task 2 · interview question
Interview: bad-line.ts, lines that pass
Time yourself: 10 minutes. Export lint(jsonl): a list of problems the API's validation does not catch, line by line (line numbers count every line, blank ones too):
line N: the reply "Delivery" is not one of the six codes (the reply, the last message, is not exactly one of TAGS)
line N: the same message as line M with another reply (M: the first line with that user message)
For one line, the reply problem first. Under if (import.meta.main), print each problem of lint(INTERN) (given), then train.jsonl: N problems.
- Task 3 · interview question
Interview: lora-count.ts, count LoRA's numbers
Time yourself: 10 minutes. Export loraCount(shapes, rank): for weights given as [rows, cols], the numbers their adapters hold (A is rows × rank, B is rank × cols), added up.
Under if (import.meta.main), print:
chota, rank 8, wq wk wv wo of 2 layers: N of 45152 (P%)
7B model, rank 16, wq wv of 32 layers: N of 6738415616 (P%) (64 weights of 4096 × 4096; P with two decimals)
- Task 4 · interview question
Interview: read-curve.ts, read a loss curve
Time yourself: 10 minutes. Export stopAt(val, patience): { best, stop }, epochs numbered from 1: best is the epoch with the lowest loss so far (a tie is not lower), stop the first epoch at which patience epochs have passed since the best, or the last epoch.
Under if (import.meta.main), for patience 1, 2, 3 and 5 on CURVE (given), print:
patience P: best epoch B (val V), stops after epoch S (V with four decimals)
- Task 5 · interview question
Interview: rag-or-tune.ts, fine-tune or retrieve?
Time yourself: 10 minutes. Export retrieve(question, month): the agency the question names (its name without " Gas", a whole word, any case) and its price that month from prices.json, as Laxmi Gas: ₹905 per 14.2 kg refill (November 2026) ('2026-10' is October 2026); '' when no agency is named.
Under if (import.meta.main), ask 'laxmi gas ka rate kitna hai' three times and print:
fine-tuned: REPLY (the ready model, the question alone)
lab-chat, no context: REPLY (the question alone)
lab-chat, retrieved: REPLY (retrieve(question, '2026-11') as the system message)
What you will learn
- How to answer a fine-tuning question: the claim in one sentence, then the smallest run that proves it.
- Five ideas again, at interview depth: leaks between splits (chapters 4 and 5), what validation does not catch (6), LoRA's size (12 and 13), early stopping (14), and fine-tuning against retrieval (2).
More in Proof
Build "Interview round" yourself
Chulha, a Nagpur startup, tags WhatsApp messages for 40 LPG gas agencies, and a missed gas leak is not an option. You fine-tune chota, a tiny transformer, until it beats the best prompt while forgetting little. A real editor and terminal in your browser, AI that explains, and a Check that says when it works.
The first 2 chapters of Fine-tuning basics (TypeScript) are free. This one comes with the all labs plan.