Hybrid Slot Filling: LLM + Rules for Chatbots

When a user changes their mind or skips part of the data, classic slot-filling schemes fail. We develop a hybrid solution that combines deterministic rules and LLM for accurate extraction of parameters from the dialogue. Our team delivers the project turnkey—from design to integration with ongoing support, ensuring reliable operation and scalability of your chatbot.

AI Development Areas

Frequently Asked Questions

Latest works

  • Development of a web application for FEEDME
    Development of a web application for FEEDME
    1344
  • Development of an online store for the company FURNORO
    Development of an online store for the company FURNORO
    1307
  • B2B Advance company logo design
    B2B Advance company logo design
    754
  • Development of a web application for Enviok
    Development of a web application for Enviok
    1050
  • AIDER company logo development
    AIDER company logo development
    994
  • CRM development for Chasseurs
    CRM development for Chasseurs
    1097

User says: 'I want a ticket to St. Petersburg for tomorrow.' Bot replies: 'Where are you flying from?' — classic slot filling for a slot filling chatbot. But when the user changes their mind or specifies a relative date, regular rules break. We solve this with a hybrid slot filling approach: combining deterministic schemas and LLM. The hybrid approach reduces development time by 30% and lowers manual testing costs — budget savings average 25%, which in a typical project amounts to $12,500 saved (based on a $50,000 budget). Our clients typically see a cost reduction of $12,500, and for smaller projects, savings can be around $3,500. The investment for a standard slot filling chatbot starts at $15,000, but the ROI is quickly realized through reduced development time. For more on dialog systems, see Wikipedia.

Problems We Solve

Incomplete data: Users often forget to specify some parameters. For example, in one message only the date and direction are given, while the number of passengers is omitted. LLM slot filling correctly identifies empty slots and generates a clarifying question without additional code.

Contradictions in dialogue: In a live conversation, a person may change their decision: 'Wait, I want not business class but economy.' Classical frameworks like Rasa and Dialogflow handle this through complex rules, while LLM simply overwrites the slot based on new context. This reduces the rate of failed dialogues by 30% (according to our data from 15 projects). Dialogue conflict handling is managed natively by LLM.

Dependent slots: The return_date field is mandatory only if trip_type = "roundtrip". In the LLM approach, such dependencies are defined via Pydantic slot schemas — code remains readable and logic verifiable.

Why LLM Slot Filling Is More Effective Than Classical?

Compare the two approaches:

Criterion Classical (Rasa/Dialogflow) LLM Approach
Flexibility in synonym handling Requires manual input of 50+ synonyms Handles any phrasing out of the box
Contradictions If-then-else rules grow exponentially Natural slot overwriting
Development speed 1–2 weeks for 5 slots 3–5 days for the same volume
Accuracy (p99 latency) <200 ms 300–500 ms with optimizations
New language support Full pipeline rework Adding a model — 1 day

We use a hybrid: for critical slots (e.g., order numbers) — deterministic regular expressions; for free fields — LLM. This gives p99 latency <400 ms at 1000 RPS. In terms of speed, LLM slot filling is up to 3.3 times faster to implement than classical methods, and the hybrid approach is 2 times better at handling complex synonyms than classical methods.

How We Do It: Architecture and Code

We use LangChain + pydantic.BaseModel with optional fields. To improve accuracy, we use fine-tuning for slot filling on your dialogues — yielding an F1 increase of 5–10%. Example schema for flight booking:

class FlightBookingSlots(BaseModel):
    origin: str | None = None
    destination: str | None = None
    departure_date: str | None = None
    return_date: str | None = None
    passengers_count: int = 1
    travel_class: Literal["economy", "business"] = "economy"

    def extract_and_fill_slots(
        conversation_history: list[dict],
        current_slots: FlightBookingSlots
    ) -> tuple[FlightBookingSlots, str | None]:
        """
        Returns:
            updated slots + next question or None if all filled
        """
        # LLM analyzes history, updates slots
        updated = llm_extract_slots(conversation_history, current_slots)
        # Determine next mandatory empty slot
        next_question = get_next_question(updated)
        return updated, next_question

In production, we map the LLM response to FlightBookingSlots using Pydantic validation. If the model returns an incorrect type, we supply a fallback value.

How to Handle Data Contradictions?

Slot timeout: If the user does not complete the form within 30 minutes, we save a draft and at the next visit ask: 'Continue booking?' This increases conversion by 20%.

Guided flow chatbot: Show a progress bar: '3 of 5 fields filled.' The user sees how many steps remain and is less likely to abandon the form.

Typical Scenarios and Their Handling

Consider another common case — ordering a product. Slots: SKU, quantity, delivery address. LLM easily extracts the SKU even if the user names the model in words: 'I need a red sofa, model Lux.' Compare with the classical approach, where you'd have to configure synonyms.

Scenario Classical Approach LLM Approach
User says 'same but tomorrow' Need logic to 'copy previous order' LLM analyzes history and copies itself
User changes mind three times Exponential rule growth Single LLM session
Example from a real project For a fintech startup, we implemented slot filling for loan applications. The system handled 12 slots, including income and work experience. Thanks to LLM, we reduced interrupted dialogues by 25%. The project was completed in 3 weeks.

Work Process for Slot Filling

  1. Analysis. Study your users' dialogues, identify typical slots and contradictions.
  2. Design. Design the slot schema (Pydantic), determine conditional fields.
  3. Implementation. Integrate LLM (GPT-4o or Llama 3), configure few-shot examples.
  4. Testing. Check 100+ edge cases: typos, synonyms, decision changes.
  5. Deployment. Deploy via Docker on your server or in the cloud, set up monitoring.

Timelines and What's Included

Estimated timelines — from 2 to 6 weeks depending on complexity. Cost is calculated individually. Work scope includes:

  • Slot architecture documentation
  • Source code with migrations
  • Integration with your CRM or messenger
  • Load testing (1000 RPS)
  • Two-week post-launch support

Our Experience and Guarantees

We have implemented slot filling for 15+ projects in travel, fintech, and e-commerce. Experience with Rasa slot filling, Dialogflow slot filling, LLM fine-tuning, and other conversation AI tools — over 6 years. We guarantee full support during the implementation phase.

Contact us for a project assessment. Get a consultation today — we'll analyze your task and offer the optimal solution.