HN Debrief

Don't classify, hallucinate

  • AI
  • Search
  • Ecommerce
  • Developer Tools

The post argues that when a user query does not line up cleanly with a fixed product taxonomy, you can let an LLM "hallucinate" the category in the taxonomy’s language, then use embeddings to snap that invented label back to the nearest real class. The example is ecommerce search, where a phrase like "brown coffee table" may map better after the model rewrites it into the site’s own category vocabulary. The point is not that the hallucinated label is true. It is that it can be closer to the schema than the raw query.

If you are classifying into a huge label set, test this as a candidate-generation step, not a final classifier. Compare it against direct query embeddings, rerankers, and hierarchical or structured-output approaches before paying an LLM tax in production.

Discussion mood

Cautiously positive. People liked the trick as a clever, familiar retrieval hack for large taxonomies, but the dominant mood was skeptical of unbenchmarked LLM complexity, cost, and claims of accuracy without strong baselines.

Key insights

  1. 01

    This is taxonomy translation, not magic classification

    The useful move is converting a messy user query into the vocabulary your schema already uses. That matters when the user says "blue shoes" and the system needs to separate attributes like color from item type, or when category names use specialized wording the raw query will not hit well. In that framing, the LLM is doing query understanding and vocabulary normalization before retrieval, which is a much narrower and more believable job than "classify anything by hallucinating first."

    Use this when your failure mode is language mismatch between users and your taxonomy. If your labels are already close to user language, direct embedding retrieval may get you most of the benefit without an extra model call.

      Attribution:
    • kgeist #1
    • softwaredoug #1 #2
  2. 02

    The pattern predates LLM hype

    People tied the idea to earlier retrieval systems, from word2vec-based category mapping to answer-first RAG and HyDE. That historical context changes the read on the post. It is less a new LLM capability than a modern version of a long-standing trick: generate a representation that sits closer to the target corpus than the original query does. The LLM just makes that representation easier to produce in natural language.

    Treat this as an extension of retrieval engineering, not a breakthrough in reasoning. That means you should evaluate it with the same discipline as any other search heuristic.

      Attribution:
    • alexpotato #1
    • andai #1
    • sergiotapia #1
    • apwheele #1
  3. 03

    Hierarchical narrowing may beat one-shot matching

    A stronger design for big taxonomies is to classify level by level or retrieve a shortlist first, then force the model to choose within that smaller set. That reduces token costs, keeps the model inside the schema at each step, and makes errors easier to inspect. It also matches how many real taxonomies are built, where the hard part is often picking the right branch before the final leaf.

    If your category tree is deep, test recursive structured outputs or top-N shortlist selection before full-schema matching. You will usually get better control and cheaper inference.

      Attribution:
    • pvillano #1
    • piterrro #1
    • softwaredoug #1
  4. 04

    Good shortlist, weak final answer

    Several practitioners converged on the same operational lesson. Embedding-based matching after an LLM rewrite can improve over no classification at all, but it rarely survives serious accuracy review as the final decision maker. It is strongest as a way to prune a huge label space. Once the stakes rise, you still want manual intervention for priority cases or a stronger model to verify the finalists.

    Design this as candidate generation with an audit path. Do not wire nearest-neighbor output straight into customer-facing behavior unless you have measured the miss patterns.

      Attribution:
    • softwaredoug #1
    • apwheele #1
    • iandanforth #1
  5. 05

    The real constraint is cost at taxonomy scale

    The technique resonated because brute force prompting does not scale. People described systems that stuffed 40,000 tokens of taxonomy into every request, paid a lot, and still got hallucinations. Others running HyDE-like flows in production said the latency and endpoint load become painful fast. That makes the post’s approach attractive mainly as a cost-control move for very large label sets, not because it guarantees better semantics.

    If you have a small or medium label space, start simple. This kind of indirection earns its keep only when your taxonomy is large enough that naive prompting is obviously uneconomical.

      Attribution:
    • eka1 #1
    • softwaredoug #1
    • memjay #1
    • estetlinus #1
  6. 06

    Open-ended clustering still needs humans

    For unlabeled data like support complaints, one workflow is to cluster embeddings first and then have an LLM name the clusters. The catch is that cluster boundaries are not natural facts waiting to be discovered. They depend heavily on threshold choices and the business question you care about. That is why people who have done this repeatedly said substantial human review remains unavoidable.

    Use LLM-labeled clustering to explore unknown issue categories, not to pretend the categories are objective. Budget review time for threshold tuning, deduping, and deciding which distinctions actually matter to the business.

      Attribution:
    • kgeist #1
    • nostrebored #1

Against the grain

  1. 01

    Better embedding models may remove the need

    Some people pushed back on the core premise by saying modern embedding models are explicitly trained for query-to-document retrieval, so the query vector itself may already be the right object to compare against category embeddings. If that is true for your stack, the hallucinated intermediate step is pure overhead and another source of errors.

    Re-run old retrieval assumptions against current embedding models. A cleaner direct-embedding baseline may have improved enough to make the LLM layer unnecessary.

      Attribution:
    • bonoboTP #1
    • ed #1
    • vessenes #1
  2. 02

    Supervised learning is still the obvious baseline

    One blunt objection was that large-label classification is not a new problem and has had workable supervised approaches for decades. If you can label even a modest training set, a task-specific model may outperform an elaborate prompt-and-retrieval pipeline while being cheaper and more stable to run.

    Before building an agentic classification loop, estimate the cost of labeling a few hundred or few thousand examples. A supervised model may be the simpler long-term system.

      Attribution:
    • runarberg #1
    • motoxpro #1
  3. 03

    This feels like formalizing slop

    The harshest critics saw the whole move as dressing up wrong answers and then post-processing them until they look useful. That complaint lands when the method is presented as cleverness rather than as a measurable engineering tradeoff. Without benchmarks, it reads like rationalizing unpredictability instead of reducing it.

    If you adopt this, lead with failure rates and benchmark deltas, not with the novelty of the trick. That is the difference between an engineering method and vibes.

      Attribution:
    • einpoklum #1
    • Sharlin #1

In plain english

BM25
A widely used ranking algorithm for full-text search that scores documents based on term frequency and rarity.
embedding
A numerical vector representation of text that lets software compare items by semantic similarity.
HyDE
Hypothetical Document Embeddings, a retrieval method where a model generates a plausible answer or document and embeds that generated text to improve search.
LLM
Large Language Model, a machine learning model trained to generate and analyze human-like text.
RAG
Retrieval-augmented generation, a setup where a model is given external documents or search results as context.
taxonomy
A fixed hierarchy or schema of categories used to organize items.
word2vec
An early machine learning method for representing words as vectors so semantic relationships can be learned from text.

Reference links

Papers and methods

  • HyDE paper on arXiv
    Shared as the canonical reference for Hypothetical Document Embeddings, the closest named method to the post’s approach.

Tools and libraries

Protocols and specs

  • OpenAI commerce product spec
    Referenced in a side discussion about using structured commerce protocols instead of pure semantic search for product discovery.