🚀
ArkyEdu BLOG TIC
RO Open App
Artificial Intelligence Grades 6–8 · Teachers 12 min read

How ChatGPT & LLMs Really Work (Tokens, Softmax & AI Hallucinations): A Practical Guide for Students & Teachers

Millions of students use AI assistants for study help, coding explanations, and translations—yet few know what actually happens inside the „black box” after pressing Enter. Understanding tokenization, next-token probability, and hallucinations turns students from passive copy-pasters into sharp critical thinkers.

💬 WhatsApp ← ICT Blog & Guides
Quick Answer (TL;DR)

A Large Language Model (LLM) does NOT think like a human or look up verified encyclopedia facts. It splits text into numeric chunks called tokens (~3–4 characters each) and predicts the most statistically probable next token using Softmax and a Temperature setting. Because it optimizes linguistic plausibility rather than ground truth, an LLM can invent false citations or math answers convincingly (AI hallucinations).

1. Step One: How LLMs Slice Sentences Into Tokens (Not Whole Words)

Neural networks cannot multiply letters—they only process numbers. Before your prompt enters a Transformer model, a Tokenizer breaks the text into common character chunks called tokens and maps each chunk to an integer ID.

In English, 1 token averages roughly 4 characters (~0.75 words). Unusual names, code punctuation, and accented characters split into multiple smaller tokens—meaning longer prompts consume more of the model’s context window.

Real subword tokenization examples
Input TextHow the LLM Tokenizes ItToken CountKey Takeaway
"algorithm"["algorithm"]1 tokenCommon English word -> single token ID
"algorithmic"["algorithm", "ic"]2 tokensPrefixes/suffixes split cleanly
"for(int i=0;i<n;i++)"["for", "(", "int", " i", "=", "0", ";", "i", "<", "n", ";", "i", "++)"]13 tokensOperators and brackets consume tokens individually
"9.11 > 9.9?"["9", ".", "11", " >", " ", "9", ".", "9", "?"]9 tokensThe model sees separate text tokens "9" and "11", not a decimal value!
Why LLMs Sometimes Fail „How Many R’s Are in Strawberry?”

The model never sees individual letters s-t-r-a-w-b-e-r-r-y—it receives two or three integer token IDs like ["str", "aw", "berry"]. Unless it spells the word out step by step, it has to guess from patterns!

2. Next-Token Prediction: Softmax Probabilities & Temperature

After passing tokens through Transformer attention layers, the model scores every ~100,000 tokens in its vocabulary and applies the Softmax function to convert scores into percentages summing to 100%.

For „The capital of Romania is...”, „Bucharest” might get 98.5%. The Temperature dial adjusts how strictly or creatively the model picks from those percentages:

  • Temperature = 0.0–0.2 (Deterministic): Almost always picks the #1 token. Best for C++ debugging, Excel formulas, translations, and factual summaries.
  • Temperature = 0.7 (Balanced): Allows natural phrasing variety—the typical default for everyday chat.
  • Temperature = 1.2+ (Creative / Risky): Flattens Softmax probabilities, boosting creative stories while raising hallucination risk.

3. Why AI Hallucinations Happen (Top 4 Homework Traps)

An AI hallucination occurs when a chatbot states fabricated information in a confident, polished tone. It happens because LLMs are trained to generate smooth, fluent completions even when they lack verified data:

  1. Invented page numbers & book quotes: Asking „Which exact page covers Topic X?” without uploading the textbook often produces a plausible-sounding fake number.
  2. Dead 404 URLs: LLMs guess web links that look grammatically realistic rather than checking live pages.
  3. Mental multi-digit arithmetic: Without an attached Python or calculator tool, large multiplication is only approximated.
  4. Leading false questions: Asking „Explain why Nikola Tesla invented Wi-Fi in 1995” can nudge weak models into playing along with the false premise.

4. The 60-Second Anti-Hallucination Check

Before trusting any AI output in an essay, lab report, or coding assignment, run these four quick checks:

Zero-Hallucination Verification Protocol
1. Can I confirm proper names, dates, and definitions in a primary source (textbook / official site)?
2. For C++ code or Excel formulas, did I actually run them on 3 test inputs (including edge cases)?
3. Did I explicitly give the AI permission to reply "I cannot verify this"?
4. Can I explain every claim out loud in 30 seconds without reading off the screen?
Test real hallucination stress-test scenarios interactively inside the ArkyEdu AI & Deepfake Lab.

5. Five High-Impact Educational Prompt Templates

Better prompts give clear Role, Context, Task, and Guardrails. Try these five study-safe templates:

  • 1. Socratic Tutor (No Spoilers): „Act as a 7th-grade CS teacher. Do not write the full solution—give me only one hint for why my while loop never ends.”
  • 2. Trace Table Debugger: „Walk through my C++ snippet on input n = 2040 using a step-by-step variable trace table.”
  • 3. Kid-Friendly Analogy: „Explain RAM vs. SSD to an 11-year-old using the analogy of a desk and a filing cabinet.”
  • 4. Teacher Quiz Builder: „Create 5 multiple-choice questions on Excel SUM, AVERAGE, and IF for Grade 8, including one trap involving absolute reference $A$1.”
  • 5. Self-Critique Check: „List 3 assumptions or potential inaccuracies in your answer above.”

✅ Smart LLM Usage Checklist

  • I remember LLMs predict statistical tokens rather than verifying objective truth.
  • I always test generated code and verify names, dates, and links against primary sources.
  • I ask AI for hints, analogies, and error traces rather than raw copy-paste answers.
  • I never enter personal IDs, passwords, addresses, or private photos into public AI chats.

❓ Frequently Asked Questions

What is a token in ChatGPT or Gemini?
A token is the basic text unit fed into the model—typically a short word, word fragment, or punctuation mark (~3–4 characters in English).
Why can the same prompt produce slightly different AI answers?
When Temperature is above zero, the model samples probabilistically from the Softmax distribution instead of always picking the exact #1 token.
How can I reduce AI hallucinations?
Paste the reference text directly into your prompt, tell the model to say „I don’t know” when uncertain, avoid leading false premises, and double-check facts.
Does ArkyEdu have a live tokenizer and Softmax simulator?
Yes! Visit the ArkyEdu AI & Deepfake Lab (/laborator-ai/) to type any text and inspect color-coded tokens, adjust Softmax Temperature, and test prompt structures.
Is using AI safe for middle-school homework?
Yes—when used as an interactive tutor for step-by-step hints and practice examples without sharing personal data.

More Study Guides

← Back to Blog Index