Yashotantra Academy logo
level 1
Curious · 0 XP
streak
0d
perfect
0
badges
0

100 XP to Apprentice

Foundations · easy

1. What a large language model actually is

An LLM is a next-token predictor trained on enormous text corpora.

1 min read3 questionsup to 50 XPtopic 1/12

Read in another language

AI translates the explanation and quiz text while preserving code and answer scoring.

A large language model is a neural network trained on one deceptively simple objective: given a sequence of tokens, predict the next token. Everything else — answering questions, writing code, summarising — is an emergent consequence of doing that extremely well at scale.

Training happens in stages: - Pre-training: self-supervised next-token prediction over trillions of tokens. - Supervised fine-tuning (SFT): curated instruction/response pairs teach the model to follow requests. - Preference optimisation (RLHF / DPO): human or AI preference data aligns tone, refusals, and helpfulness.

At inference the model outputs a probability distribution over its whole vocabulary for the next position, and a *sampler* picks one token. The chosen token is appended and the process repeats — this loop is called autoregressive decoding.

python
# Conceptually, generation is a loop over a probability distribution
tokens = tokenizer.encode("The capital of France is")
for _ in range(10):
    logits = model(tokens)[-1]        # scores for every vocabulary entry
    next_id = sample(logits, temperature=0.7)
    tokens.append(next_id)
print(tokenizer.decode(tokens))

Gotcha: the model has no built-in notion of truth. It optimises plausibility, which is why grounding (retrieval, tools, citations) matters so much in production systems.

How to study this topic

  1. 1. Read the explanation once end to end, skipping the code.
  2. 2. Re-read the code snippets and say out loud what each line does.
  3. 3. Answer the quiz without scrolling back — that is the real check.
  4. 4. Read every explanation, even for the answers you got right.

Scoring

  • · Up to 30 XP from quiz accuracy.
  • · +15 XP for a perfect first attempt.
  • · +5 XP while a 3-day streak is running.
  • · 75% or higher marks the topic complete.

Check your understanding

  1. 1. What is the core training objective of a base large language model?

  2. 2. Which stage teaches a base model to follow user instructions?

  3. 3. Why do LLMs hallucinate?

Badges

First light
Pass your first topic
Sharp shooter
3 perfect first-try quizzes
On a roll
Study 3 days in a row
Week warrior
Study 7 days in a row
Grinder
Earn 500 XP
Deep diver
Earn 1500 XP