LLMs & Applied NLPIntermediate19 min read5 questions

LLM Fundamentals: Tokenisation, Pre-training & Scaling Laws

Everything downstream of the tokenizer depends on it. Understand BPE, the pre-training objectives, and the scaling laws that decide how big a model should be.

Covers: BPE tokenisation, embeddings, pre-training objectives, BERT vs GPT, scaling laws, emergent abilities

Applied LLM interviews start here. Before anyone asks about RAG or agents, they check that you understand what the model actually is: a next-token predictor over a learned vocabulary, trained under a compute budget governed by well-understood scaling relationships.

Filter
0/5 mastered
IntermediatetokenizationbpevocabularyAsked at OpenAI, Cohere

30-second answer

Word-level vocabularies explode in size and cannot handle out-of-vocabulary words; character-level sequences are far too long for quadratic attention. BPE starts from bytes and iteratively merges the most frequent adjacent pair, producing subwords that cover any input with a fixed vocabulary. The practical consequences are real: non-English text costs 2–3× more tokens, numbers tokenise inconsistently which hurts arithmetic, and trailing whitespace changes completions.

IntermediatebertgptpretrainingAsked at Google, Cohere

30-second answer

MLM masks ~15% of tokens and predicts them using bidirectional context — excellent representations, but it cannot generate and only trains on the masked fraction. CLM predicts the next token with causal masking — it trains on every position, generates naturally, and scales better. Use an encoder for classification, retrieval and NER where you need the best embeddings cheaply; use a decoder for generation and for anything you want to steer with instructions.

Advancedscaling-lawschinchillacompute-budgetAsked at OpenAI, Anthropic

30-second answer

Loss follows a power law in parameters, data and compute. Kaplan et al. concluded you should scale model size faster than data; Chinchilla corrected this with a fixed learning-rate-schedule methodology and found parameters and tokens should scale roughly equally — about 20 tokens per parameter. Given compute C ≈ 6ND, the optimal split is N ∝ C^0.5 and D ∝ C^0.5. In practice teams now deliberately overtrain small models because inference cost dominates over the model's lifetime.

Intermediatecontext-windowmemorysummarizationAsked at Anthropic, OpenAI

30-second answer

Options in increasing sophistication: sliding window over recent turns, recursive summarisation of older turns, retrieval over the conversation history so only relevant past turns are injected, and a structured memory store holding extracted facts. In production I would combine them — always keep the system prompt and the last N turns verbatim, retrieve relevant older turns, and maintain a running summary plus a structured fact store.

Intermediateembeddingsretrievalcontrastive-learningAsked at Pinecone, Weaviate

30-second answer

An embedding model maps text to a fixed-size vector optimised so semantically similar texts are close, typically trained with a contrastive objective on positive/negative pairs. Choose based on retrieval benchmark performance in your domain, dimension (which drives index cost), max sequence length, multilingual coverage, and whether you can self-host. Always evaluate on your own queries — MTEB rankings frequently do not transfer.

Showing 5 of 5 questions for llm-fundamentals-interview-questions.

Check your understanding

5 questions · no sign-up, nothing stored

0/5 answered
Question 1

1.Compared to English, Hindi text typically costs:

Question 2

2.The main reason decoder-only models displaced BERT-style encoders is:

Question 3

3.The Chinchilla result says that for compute-optimal training you should use roughly:

Question 4

4.'Lost in the middle' means:

Question 5

5.The highest-impact change when fine-tuning an embedding model is usually:

Hands-on challenge

Build it — this is what you talk about in a deep-dive round.

Build a token-aware LLM cost and quality analyser

Write a tool that quantifies the tokenisation and context decisions in a real prompt pipeline.

Requirements

  • Token counts and cost per request broken down by system prompt, retrieved context, history and user input.
  • Comparison of the same information rendered as JSON, YAML and prose; report the token delta.
  • Multilingual comparison across at least four languages with the cost multiplier for each.
  • A context manager implementing pinned system prompt + recent turns + summary + retrieval, with tests for the truncation edge cases.

Stretch goals

  • Run a needle-in-a-haystack evaluation at 5 depths × 4 context lengths and plot the accuracy surface.
  • Measure the cost saving from reordering the prompt to maximise prefix-cache hits.