A Generative AI Engineer must map 300,000 free-text job titles to a standard taxonomy of about 3,000 occupation codes, each with a short description. Listing every code in one prompt would far exceed the context budget per request. Accuracy matters more than speed, and the engineer wants an LLM to make the final choice of code. Which design fits?
Choose one.
When a label set is too large to put in a prompt, use embeddings to retrieve a few candidate labels, then let a generative model classify against that short list.
Two facts decide this. First, 3,000 labels cannot be listed in one prompt, so the LLM must see only a subset. Second, the requirement wants an LLM to make the final decision. Embedding retrieval (top-k candidate codes per title) solves the first, and an LLM choosing among the retrieved candidates satisfies the second. Pure nearest-neighbour skips the LLM, batching the taxonomy multiplies cost and needs reconciliation, and fine-tuning on one description per code has too little data.
- Note the constraint: the full label set does not fit in a prompt.
- Use embeddings to shortlist the most similar codes for each title.
- Pass only the shortlist, with descriptions, to the LLM for the final choice.
- Check that the design keeps the LLM as the decision-maker.
Exam tip: Too many labels for a prompt: retrieve candidates with embeddings, then classify with an LLM.
Databricks GenAI: Prompt Design, Output Formats and Model Task Selection — the lesson that teaches this.