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.
In AI Foundations, LLMs is a foundation the later lessons build on, so it is worth getting exactly right.
- 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.
Put together, the throughline is that an LLM predicts the next token from context.
- 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.
Read the LLMs example as a procedure you can repeat: name the action, the result, the data that proves it, and the point where it could fail.
The numbers change, but the link between action, proof, and risk is what makes LLMs transfer to your own decisions.
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.
The fix for this LLMs mistake is to state the hidden assumption in one sentence and check it against the takeaways above.
Treat any LLMs mistake as a signal to slow down and demand evidence, especially when the decision feels obvious.
Risk notes
Reading the risk in LLMs
Hallucination, stale information, prompt injection, and hidden assumptions can lead to poor trading or security decisions.
When the LLMs evidence is thin, keep your exposure small and stay in research mode until it improves.
Knowing the LLMs failure modes in advance is what lets you act decisively when the setup is genuinely sound.
- Explain next-token prediction.
- Identify one hallucination risk.
- Verify critical facts outside the model.
Practice
Turn LLMs into a habit
Treat How LLMs Work as a drill, not a definition: pick one live AI Foundations product, market, screen, or claim and trace it end to end.
Aim for LLMs judgement you can defend, not a tidy summary you can merely recite.
- 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…