Generate Knowledge
Think before answering
The Problem: Sometimes AI needs background knowledge to answer well, but that knowledge isn't in the prompt. How can we help AI access its own relevant knowledge?
The Solution: Brainstorm Before Answering
Generated Knowledge Prompting is a two-step technique. Instead of asking the model to answer a hard question directly, you first ask it to write out the facts that are relevant to the question, and only then ask it to answer — feeding the just-generated facts back in as context. It's like brainstorming what you already know before tackling a problem, rather than blurting out the first thing that comes to mind. The technique was introduced by Liu et al. (2022) for commonsense reasoning, where models often have the right knowledge stored internally but fail to surface it on the first pass.
How it works
A language model predicts text token by token, so the words it has already produced become part of the context for everything that follows. When you force the model to spell out relevant facts first, those facts sit in the context window and condition the final answer, making the model far more likely to reason from solid premises instead of a shallow guess. This is closely related to Chain-of-Thought prompting: both work by writing intermediate reasoning into the context before committing to an answer. The difference is emphasis — Chain-of-Thought lays out reasoning steps, while Generated Knowledge front-loads factual statements. Unlike RAG, no external database or retrieval system is involved; the knowledge comes from the model's own parameters, so the technique is cheap to run but still bounded by what the model learned during training.
When to use it — and the pitfalls
Reach for it on commonsense, science, and trivia questions where the model probably knows the answer but tends to answer carelessly. The headline pitfall is hallucination: if step one generates a confident but false "fact," step two will faithfully build a wrong answer on top of it — so this technique improves recall of latent knowledge, not factual coverage the model never had. For volatile or proprietary facts, prefer RAG. Worked example: ask "Can a fish drown?" directly and many models snap to "no." Ask the model to first generate knowledge — "Fish breathe by extracting dissolved oxygen from water through their gills; in oxygen-depleted water they suffocate" — and the same model, reading its own note, now answers "yes, in effect, when the water lacks enough oxygen."
Think of it like a brainstorming session:
- 1. Question: "Is glass a solid or liquid?"
- 2. Generate knowledge: "Glass is an amorphous solid... molecules don't flow..."
- 3. Use knowledge: Include generated facts in context
- 4. Answer: More accurate response with proper background
Where Is This Used?
- Science Questions: Generating relevant scientific background
- Common Sense Reasoning: Making implicit knowledge explicit
- Trivia/Knowledge Tasks: Recalling relevant facts first
- Writing Tasks: Generating research before drafting
Fun Fact: This technique mimics how humans think! We often "warm up" our memory by recalling related facts before answering. Studies show this improves accuracy on common-sense reasoning tasks by 5-10%.
Try It Yourself!
Use the interactive example below to see how generating knowledge first leads to more informed and accurate answers.
Generate Knowledge Prompting
First generate relevant knowledge, then use it to answer
Part of golf is trying to get a higher point total than others. Yes or No?
How It Works
When to Use Generate Knowledge
- • Questions requiring specific facts
- • Commonsense reasoning tasks
- • When direct answers might be inaccurate
- • To improve accuracy without external sources
Generate 3-5 facts that would help answer the question:
"{question}"
Facts should be relevant and accurate.Using the following knowledge:
{generated_knowledge}
Answer the question: "{question}"The technique is described in the paper "Generated Knowledge Prompting for Commonsense Reasoning" (Liu et al., 2022). Research showed 3-5% improvement on commonsense benchmarks compared to direct answers.
| Aspect | Direct Answer | Generate Knowledge | RAG |
|---|---|---|---|
| Knowledge Source | Within model | Within model (explicit) | External documents |
| Infrastructure | Not needed | Not needed | Vector DB |
| Recency | Up to training date | Up to training date | Current |
| Accuracy | Basic | Improved (+3-5%) | High |
Frequently asked questions
What is Generated Knowledge Prompting?
It is a two-step prompting technique: first you ask the model to write out the facts relevant to a question, then you feed those facts back into the context and ask for the answer. This makes the model reason from explicit premises instead of a shallow first guess. It was introduced by Liu et al. (2022) for commonsense reasoning.
How is Generated Knowledge different from Chain-of-Thought?
Both work by putting intermediate text into the context before the final answer. The difference is emphasis: Chain-of-Thought writes out reasoning steps, while Generated Knowledge front-loads factual statements. You can combine them — generate facts first, then reason step by step on top of those facts.
How is Generated Knowledge different from RAG?
In RAG the facts come from an external source (a vector database, search, or documents), so they can be fresh and verifiable. In Generated Knowledge the model produces facts from its own parameters with no external infrastructure — cheaper and simpler, but bounded by the model's training cutoff and prone to errors. For current or proprietary data, prefer RAG.
When does Generated Knowledge fail and what are its downsides?
The main downside is hallucination: if step one produces a confident but false fact, the model will faithfully build a wrong answer on it. The technique improves recall of knowledge the model already has, but does not add facts it never learned. It is a poor fit for recent news, niche, or private data — use RAG or fine-tuning there instead.
Try it yourself
Interactive demo of this technique
Answer the question: is glass a liquid or a solid?
Glass is a liquid that flows very slowly. That is why old window panes are thicker at the bottom.
Let me first generate key facts:
- Glass is an amorphous solid — its molecules do not form a crystalline lattice.
- When a melt cools, glass undergoes vitrification — a transition to a solid state without crystallization.
- The myth of "flowing glass" has been debunked: uneven thickness in old panes is a result of manufacturing techniques, not flow.
- The viscosity of glass at room temperature is so high that noticeable flow would take longer than the age of the universe.
Answer: Glass is an amorphous solid. The common myth that glass is a slowly flowing liquid is not supported by science.
Without knowledge generation, the model reproduced a popular myth. Pre-generating facts activated accurate scientific knowledge and helped filter out misconceptions.
Create a free account to solve challenges
6 AI-verified challenges for this lesson
This lesson is part of a structured LLM course.
My Learning Path