Give a near miss for a category

Read each example as a phrase before typing its label. · 165 words

Use the Franklin Public Library catalog export, whose fields are book_id, title, summary, and genre. Define space_opera as a novel whose main story occurs in outer space. A positive example is "S-101, Orbits of Ash, A pilot and her crew search for a missing colony ship beyond Mars, space_opera." Now add a near miss: "S-102, A Walk Through the Stars, An illustrated reference to constellations, planets, and telescopes, not_space_opera." The hard negative also discusses space, so the model must learn that topic alone is not enough.

Test a third catalog row: "S-203, Mars Without Footprints, A field guide explains how wind, dust, and gravity shape Martian deserts." The prompt asks for JSON with book_id, label, and a short reason. A checkable output is {"book_id":"S-203","label":"not_space_opera","reason":"nonfiction field guide"}. Although Mars strongly suggests the category, genre and purpose place the book outside it. The useful design move is to state the category rule, show one clear positive, and add a contrasting example close enough to reveal the boundary.

Check your recall

Why is "A Walk Through the Stars" a near miss, and what label should "Mars Without Footprints" receive?

Check your answer

It is a near miss because it concerns outer space but is a nonfiction reference book rather than a novel set there. "Mars Without Footprints" should also receive not_space_opera because it is a nonfiction field guide.

Sources and credits

Original KeyTouch lesson. Background reading · DAIR.AI · Few-Shot Prompting.