Home › Prompt Engineering › Generated knowledge
✍️ · Ground

Generated knowledge

Having the model surface relevant facts first, then answer using them as its own context.

In one line

Generated knowledge prompting has the model list relevant facts first, then answer using them, which cuts errors on knowledge and commonsense questions.

ConceptWhat it is

Generated knowledge prompting is a two-stage technique: the model first generates a handful of relevant facts about the question, then answers the question with those facts placed back into its own context. It exists because models often hold the knowledge needed to answer correctly but fail to bring it to bear in a single pass — writing the facts down first makes that latent knowledge explicit and lets it condition the final answer.

It differs from retrieval in one important way: nothing external is consulted. The knowledge statements come from the model itself, so the method surfaces and organizes what the model already encodes rather than adding new, verified information. That keeps it cheap and self-contained, but it also means the generated facts carry no guarantee of being true.

How it worksThe mechanics

First, prompt the model to produce several short knowledge statements relevant to the question, often with a few demonstrations that show the style of facts wanted — this is the knowledge-generation step. Next, take those statements and prepend or append them to the original question in a second prompt, then ask for the final answer — the knowledge-integration step. Optionally generate several independent knowledge sets, run the answer step once per set, and keep the best-supported prediction, so a single bad fact is less likely to dominate the outcome.

At a glanceSee it

Generated knowledge diagram
Generated knowledge diagram 1

A selection layer — generated knowledge fits only when the fact lives inside the model yet a single pass fails to surface it, while external or fresh facts call for retrieval instead.

Generated knowledge diagram 2

Unpacking the several-sets branch — independently sampled fact sets each yield a candidate answer and cross-set agreement stands in for confidence, yet a shared bias can make the vote agree on the same wrong fact.

When to use itWhere it fits

  • Commonsense and general-knowledge questions the model likely knows but tends to fumble in one pass.
  • Tasks where surfacing the relevant facts first visibly steadies the final answer.
  • When you have no retrieval corpus but still want more considered, grounded-feeling responses.
  • As a cheap first upgrade over a plain zero-shot answer on knowledge-heavy prompts.

When NOT to use itLimits & anti-patterns

  • Questions needing authoritative or fresh facts — use retrieval, since generated facts are unverified.
  • Pure arithmetic or symbolic logic, where step-by-step reasoning or a real tool beats recalled facts.
  • Latency- or cost-sensitive paths, since it at least doubles the number of generations.
  • Simple lookups the model already answers correctly in a single shot.

Trade-offsAdvantages & costs

Advantages
  • Reduces errors on knowledge and commonsense tasks by making relevant facts explicit.
  • Self-contained — no retrieval index, database, or external tool to build or maintain.
  • Simple to add: two prompts that template cleanly over an existing pipeline.
  • The intermediate facts are inspectable, which aids debugging and trust.
Trade-offs & costs
  • Generated facts can be hallucinated, and a wrong fact can actively mislead the answer.
  • Costs at least one extra generation, adding tokens and latency.
  • Adds no genuinely new knowledge — it only re-surfaces what the model already encodes.
  • Quality depends on the generation prompt; vague cues yield vague or off-topic facts.

ExampleIn the real world

A commonsense question asks whether, on a golf course, taking fewer strokes gives a higher or a lower score. Answered directly, the model sometimes flips the convention. With generated knowledge, the first stage is prompted to list a few facts about golf scoring — that the objective is the lowest total, that par is a target number of strokes, and that fewer strokes is better. The second stage then answers the original question with those statements in context, and reliably concludes that fewer strokes means a lower, better score. The same two-stage pattern lifts accuracy across a batch of similar commonsense items without any external lookup.

ToolsHow to implement it

  • LangChainsequential chains that pass generated facts into the answering prompt.
  • LlamaIndexquery pipelines that stitch a knowledge-generation step before the final response.
  • DSPydeclare the two stages as modules and optimize their prompts against a metric.
  • Guidancetemplating that controls exactly how the generated facts are formatted and re-injected.

Cost & effortWhat it takes

Cheap to build and roughly one extra generation to run: expect at least double the calls, tokens, and latency of a direct answer, and more if you generate several fact sets and choose among them. There is no infrastructure to stand up — no index, no vector store — so the engineering effort is a couple of prompt templates. The real cost is quality assurance: because the facts are unverified, knowledge-heavy or high-stakes uses still need evaluation, and often retrieval, layered on top.

A living map of modern AI — kept current every morning