AI Foundations
How LLMs Work
Neural networks, LLMs, and machine learning for markets.
In this lesson
- How large language models work
- What 'hallucination' means
Key takeaways
- 1An LLM predicts the next token from context
- 2It can sound confident yet be wrong
- 3Always verify AI output before acting on it
Lesson summary
A large language model predicts likely next tokens from context.
Mental model
Getting LLMs straight
A large language model predicts likely next tokens from context. It can produce useful reasoning support, but it does not know truth the way a database query does.
- How large language models work
- What 'hallucination' means
Mechanics
How to reason about LLMs
Text is split into tokens and processed through a trained neural network.
The model generates output from statistical patterns and context.
Retrieval, tools, and verification improve reliability but do not remove the need to check.
- An LLM predicts the next token from context
- It can sound confident yet be wrong
- Always verify AI output before acting on it
Example
Seeing LLMs in action
An LLM can summarize a protocol document, but the user should still verify contract addresses, fee numbers, and risk claims from primary sources.
Common mistakes
How LLMs trips learners up
Fluent writing feels authoritative. That is dangerous in finance because a confident sentence can still be fabricated or outdated.
Risk notes
Reading the risk in LLMs
Hallucination, stale information, prompt injection, and hidden assumptions can lead to poor trading or security decisions.
- Explain next-token prediction.
- Identify one hallucination risk.
- Verify critical facts outside the model.
Practice
Turn LLMs into a habit
- Explain next-token prediction.
- Identify one hallucination risk.
- Verify critical facts outside the model.
Review
Key terms
- Large Language Model (LLM)
- An AI model trained to predict and generate text from context.
- Machine Learning
- Algorithms that learn patterns from data instead of being explicitly programmed.
- Neural Network
- A layered model loosely inspired by the brain, core to deep learning.
- Backtesting
- Testing a strategy on historical data before risking real capital.
Source notes
Editorial references
These references are starting points for verifying the mechanisms, risk checks, and product context behind this lesson.
Before you continue
Can you do these?
- Explain next-token prediction.
- Identify one hallucination risk.
- Verify critical facts outside the model.
Related learning
Keep reading
Checkpoint
Finish this lesson
Pass the check to save progress, then continue through the track in order.
Lock in this lesson
Answer every question correctly to complete the lesson.
A large language model predicts…

