Building a production chatbot requires more than a large language model. Pure LLM systems often hallucinate intent boundaries and struggle with structured data extraction, while traditional natural language understanding frameworks provide deterministic slot filling but lack conversational flexibility. A hybrid architecture that pairs an NLU layer for intent classification and entity extraction with an LLM for dialogue generation and reasoning gives you the precision of rules and the fluency of generative AI. This guide walks through building that system, from designing intent schemas to deploying a scalable inference backend.
Why Combine LLM and NLU?
LLMs excel at open-ended generation, but they are probabilistic. When a user says, "I want to transfer $500 to checking," you need 100% accuracy on the intent (transfer_funds), the amount (500), and the destination (checking). NLU engines provide that guarantee. The LLM handles the rest: clarifying ambiguous requests, recovering from edge cases, and generating natural responses. This separation of concerns reduces latency, because the NLU layer can run a lightweight classifier, while the LLM only activates for complex generation tasks.
Architecture Overview
A robust chatbot stack has four core layers:
- Input preprocessing: ASR, spell check, and normalization.
- NLU engine: Intent classification, entity recognition, and slot filling.
- Dialogue manager: State tracking, context window management, and policy execution.
- LLM response generation: Natural language generation, reasoning, and tool use.
Oxlo.ai sits in the generation layer, providing the inference backend for response synthesis, reasoning, and function calling. Post-processing guardrails sit between the LLM and the user.
Step 1: Model Your Intents and Entities
Start with a strict schema. Define intents as discrete actions your bot must recognize, and map each intent to required and optional slots (entities). The NLU layer will enforce this contract, so the LLM never has to guess whether a transfer is a transfer.
{
"intents": {
"transfer_funds": {
"required_slots": ["amount", "to_account"],
"optional_slots": ["from_account", "transfer_date"]
},
"check_balance": {
"required_slots": ["account_type"],
"optional_slots": []
}
},
"entities": {
"amount": "number",
"to_account": "string",
"from_account": "string",
"transfer_date": "date",
"account_type": "string"
}
}
Step 2: Select an Inference Provider
For the LLM layer, you need low latency, broad model choice, and predictable costs. Oxlo.ai offers a developer-first inference platform with request-based pricing: one flat cost per API request regardless of prompt length. Unlike token-based providers such as Together AI, Fireworks AI, OpenRouter, Replicate, and Anyscale, cost does not scale with input length, so Oxlo.ai is significantly cheaper for long-context and agentic workloads.
The platform runs 45+ open-source and proprietary models across 7 categories, is
Top comments (0)