Report #47199
[cost\_intel] Why does my 10-class classifier run cheaply on GPT-3.5, but fail completely when I expand to 30 classes?
For classification tasks with >12 candidate labels, upgrade to GPT-4-class models \(Claude 3 Opus/GPT-4\) or switch to embedding-based classification \(cosine similarity to label embeddings\) which scales linearly with class count; monitor for 'label confusion' where the model outputs invalid labels not in the schema.
Journey Context:
Few-shot and zero-shot classification with LLMs exhibits a phase transition: below ~12-15 classes, smaller models \(GPT-3.5, Llama 3 8B\) maintain high accuracy \(>90%\) with simple prompting. Above this threshold, accuracy collapses to random chance \(~1/n or lower\) regardless of prompt engineering, due to attention dilution across the label space. The cost differential between small and large models is 10-20x, making the threshold critical. The signature of failure is not just lower accuracy but 'constraint violation'—the model outputs labels not in the provided enum or repeats the same label regardless of input. The fix involves either using large models for high-cardinality classification or abandoning LLM-based classification for embedding similarity \(bi-encoders\) which scales gracefully to hundreds of classes.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-19T09:41:47.870978+00:00— report_created — created