Assign several non-exclusive labels to each input
Some texts (or images) belong to more than one category—think hashtags, product facets, or moderation flags. With LLMs you can ask for all applicable labels in one go.
In the example below, we provide a news headline and ask the model to return all relevant labels from a predefined list—such as space, science, technology, and climate. Multiple labels can be assigned to a single input. The special label none is included to indicate when no categories are applicable, which is great in cases where the input is not relevant to any of the labels.
Use specific, non-overlapping labels
Example: "python_programming"
instead of just "programming"
Include a label such as “none” or “other”
This helps handle cases where no standard label applies
Test with edge cases
Try empty text, very long text, or mixed-language inputs to ensure robustness
Don’t use too many labels
For best accuracy, keep the label set under 20–30 options
Don’t mix abstraction levels
Avoid combining broad and narrow categories (e.g., "animal"
and "dog"
) in the same set
Don’t forget to handle empty results
Some content may not match any label; your code should account for this possibility