Skip to content
Sign in

How Large Language Models (like ChatGPT and Gemini) Work: A Plain-English Guide for Students

What happens when you ask an AI chatbot a question? Understand tokens, training, prediction, context windows and hallucinations without any heavy maths, plus how to use AI to study smarter.

CodeOrbit Learn TeamPublished 4 min read

AI chatbots can explain photosynthesis, write code and plan your study week. It feels like magic, but the core idea is surprisingly simple. Understanding it helps you use these tools well and know when not to trust them.

The core idea: predict the next word

A large language model (LLM) is a program trained to do one thing: given some text, predict what comes next.

If you read "The capital of Bihar is", you would predict "Patna". An LLM does the same, but it has practised on a huge amount of text, so it has learned patterns of grammar, facts, reasoning styles and even code.

To write a full answer, it predicts one piece, adds it to the text, and predicts again, over and over:

Plain Text
Question: What is photosynthesis?
Step 1 → "Photosynthesis"
Step 2 → "Photosynthesis is"
Step 3 → "Photosynthesis is the"
...       (until it predicts an "end" marker)

Tokens: how the model reads text

Models don't see words the way we do. Text is split into tokens, small chunks that are often parts of words.

Text

Possible tokens

learning

learn · ing

unbelievable

un · believ · able

नमस्ते

often several smaller pieces

This is why models sometimes struggle with letter-counting puzzles ("how many r's in strawberry?"): they don't see individual letters, they see tokens.

Training: learning from examples

Training happens in stages:

  1. Pre-training: the model reads billions of sentences and repeatedly guesses the next token. Each wrong guess slightly adjusts its internal numbers (called parameters, often billions of them). Slowly the guesses get better.
  2. Fine-tuning: it is then trained on examples of helpful conversations, so it learns to answer questions instead of just continuing text.
  3. Feedback: people rate answers, and the model is tuned to prefer clear, safe and useful replies.

Context window: the model's short-term memory

Everything in your conversation, your question plus the earlier messages, is fed to the model each time. The maximum amount it can consider at once is its context window. Very long chats may push early details out, which is why a bot can "forget" what you said at the start.

Why AI sometimes makes things up

Because the model predicts likely text, it can produce an answer that sounds right but is wrong. This is called a hallucination. Common examples:

  • Inventing a formula, a date or a quote that looks plausible.
  • Giving a confident answer to a question that has no single answer.
  • Making arithmetic slips in long calculations.

How to use AI to study smarter

AI is best as a tutor that explains, not a machine that does your work.

  1. Ask for explanations at your level. "Explain recursion to a Class 11 student with a real-life example."
  2. Ask it to quiz you. "Give me 5 MCQs on the French Revolution, one at a time, and wait for my answer before showing the next."
  3. Explain back. Write your own explanation and ask the AI to point out mistakes. Teaching is the fastest way to learn.
  4. Get step-by-step help, then solve the next one alone.
  5. Make a study plan. "I have 30 days and 2 hours a day for BPSC TRE Computer Science. Make a weekly plan with revision days."

Good prompts vs weak prompts

Weak prompt

Better prompt

explain DBMS

Explain DBMS normalisation (1NF, 2NF, 3NF) with one student-database example, in simple words

solve this

Solve this step by step and explain why each step is needed

notes on motion

Make short revision notes on Class 9 Motion with formulas and 3 practice numericals

Key terms at a glance

Term

Meaning

LLM

A model trained on large amounts of text to predict the next token

Token

A chunk of text the model reads and writes

Parameters

The billions of internal numbers adjusted during training

Context window

How much text the model can consider at once

Hallucination

A confident but incorrect answer

Prompt

The instruction or question you give the model

Tags:#AI#Machine Learning#LLM

Frequently asked questions

Does an AI chatbot understand what it says?

It has learned very rich patterns of language and reasoning, which lets it solve many problems, but it has no personal experience and can be confidently wrong. Treat it as a helpful, fallible assistant.

Is it cheating to use AI for studying?

Using AI to explain concepts, quiz yourself and check your work is smart studying. Copying AI answers into assignments without understanding them is not, and it won't help you in an exam hall.

Why do different AI tools give different answers?

They are different models trained on different data, and they also add a little randomness when choosing words. Asking the same question twice can give slightly different wording.