A classifier assigns text to a predefined category or intent so an application can route, filter, or moderate requests and responses. In a GenAI architecture, it can place a fast first-pass decision before an expensive model or screen generated content before delivery. section 10.5.1 section 10.6
Common application roles include:
- Route questions to a capable model only when a lightweight classifier identifies the relevant intent. section 10.5.1
- Detect and filter malicious prompts before they reach an LLM, and suspicious outputs after generation. section 6.6
- Screen responses for accuracy, bias, appropriateness, sensitive details, formatting, and compliance risks. section 10.6
Dog-question intent gate
A local Phi-2 model receives a question and is prompted to answer only “yes” or “no” to whether it concerns dogs. A positive result can trigger GPT-4 for a detailed answer; a negative result avoids the more expensive call. The implementation uses Transformers and PyTorch, with explicit output parsing and model-generation configuration. section 10.5.1
Policy-constrained intent classification
A classifier can return one of a small set of labels for a product-support request while enforcing rules about scope, proprietary information, competitors, formatting, and harmful or illegal requests.






























