All skills
oaustegard avatar

/hallucinating-labels

@7977b11

Assign items to a CLOSED label vocabulary that is too large to put in a prompt — product taxonomies, category hierarchies, tag vocabularies, routing tables, ICD/SIC-style code lists. A cheap model writes the label it thinks the vocabulary would use, and an embedder snaps that writing onto the nearest legal value, so the schema is never transmitted and the output is always in-vocabulary. Use for "classify these into our taxonomy", "tag these against the existing tag list", "map these queries to categories", "the enum is too big to send", or a Literal/enum that hits a provider cap. NOT for a vocabulary that fits in a prompt — structured output measured 0.701 acc@1 there against this pattern's 0.564. NOT for open-ended labelling with no fixed vocabulary, and not for ranked retrieval over documents (bm25).

  • 5 files
  • 25 KB
  • Updated last month
  • GitHub

Use this Skill: https://skilld.dev/gh/oaustegard/claude-skills/hallucinating-labels

This session only. Nothing lands on disk.

README.md

≈496 tokens on demand. Your agent reads this file only when SKILL.md points to it.

hallucinating-labels

Assign items to a closed label vocabulary too large to put in a prompt. A cheap model writes the label it thinks the vocabulary would use; an embedder snaps that writing onto the nearest legal value. The schema is never sent to the model, and the output is always in-vocabulary.

See SKILL.md for the full reference, the measured boundary, and the prompt.

Quick start

python3 scripts/snap.py build --vocab categories.txt --out .snap-index.pkl
# write labels yourself, 40 per call, using the register prompt in SKILL.md
python3 scripts/snap.py snap --index .snap-index.pkl --labels written.txt --k 3

--backend minilm needs sentence-transformers; the default tfidf needs only scikit-learn.

Read the boundary before adopting it

When the whole vocabulary fits in a prompt, ship it and ask for a constrained choice instead — that scored 0.701 acc@1 on WANDS against this pattern's 0.564. This pattern is for the case where the tokens are the problem, and there it beats every model-free baseline.

Two more measured rules, both in SKILL.md. Anchor the prompt on the vocabulary's register, never on novelty — it is the largest single variable in the pattern, and the source post gets it wrong. A Haiku subagent that obeyed "never-seen-before" scored 0.100 against a 0.500 no-model control; on a distinctive vocabulary the same wording cost 30 points and inverted the verdict. And pass --union for long documents, where the written label and the direct embedding are complementary (0.508 and 0.416 alone, 0.672 interleaved).

For a no-API setup, gte-small int8 is 33 MB and snaps the raw query at 0.455 acc@1; a tiny local LM in place of the writing half makes it worse, not smaller — see SKILL.md.

Origin: Doug Turnbull, "Don't classify. Hallucinate!", 2026-08-10. Arms and artifacts: oaustegard/experiments/hypothetical-classification.

Source: SKILL.md on GitHub

No third-party reports yet.

Signed by skilld at 7977b11. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub yesterday.

Activeupdated last month
metadata
{
  "version": "0.1.0"
}

README badge

README badge for oaustegard/claude-skills/hallucinating-labels