Phase 19: Capstone Projects

Hypothesis Generator

A research agent that asks the same question twice is wasting tokens. The trick is forcing each draft to land somewhere new. Drive a sampler from a seed prompt and turn its outputs into typed hypothesis records. Ramp the sampler temperature on each pass so the next draft drifts further from the last. Filter near duplicates with a small embedding model and a cosine distance threshold. Rank the survivors with a scoring function that blends novelty, specificity, and testability. Hold every step deterministic so the same seed always produces the same queue. A planner that asks one model one time gets one hypothesis. That is fine for a worked example. For a research loop it is the wrong shape. The loop wants a ranked queue with depth, so when the first hypothesis fails the runner has the next one ready without paying for another full sampling pass. Two ideas combine to produce that queue. The first is temperature ramping: each pass through the sampler raises the temperature a notch, so later drafts are encouraged to wander. The second is novelty filtering: after each draft, the generator measures the embedding distance from every prior survivor and rejects anything inside the cluster. The lesson ships a mock language model that returns scripted token sequences for fixed prompts. The mock is enough to…

Hypothesis Generator: A research agent that asks the same question twice is wasting tokens. The trick is forcing each draft to land somewhere new.

This free lesson is part of the AI Engineering from Scratch curriculum. Read the full explanation, run the lesson code, and verify the result in the interactive reader or from the repository source.

Browse the complete course catalog or open this lesson on GitHub.