Text-to-SQL Task-oriented Dialogue Ontology Construction

Renato Vukovic, Carel van Niekerk, Michael Heck, Benjamin Matthias Ruppik, Hsien-Chin Lin, Shutong Feng, Nurul Lubis, Milica Gasic

TL;DR

TeQoDO is a zero-shot framework that leverages an LLM's SQL programming capabilities to autonomously build task-oriented dialogue (TOD) ontologies from scratch. By treating an ontology as a database schema and iteratively updating it through dialogue analysis, it outperforms existing supervised methods and creates structured knowledge that is immediately usable for downstream tasks like Dialogue State Tracking.

What Problem Does This Paper Address?

Task-oriented dialogue systems—the tech behind digital assistants that help you book flights or find restaurants—rely on ontologies. These are structured hierarchies of domains (e.g., "Hotels"), slots (e.g., "Price Range"), and values (e.g., "Cheap"). Traditionally, building these is a manual, expensive, and slow process.

While Large Language Models (LLMs) have vast internal knowledge, they are "black boxes" prone to hallucinations and lack explicit reasoning. Ontologies provide a human-readable "ground truth" that makes these systems more explainable and controllable. Existing automated methods for building them often struggle because they treat term extraction and relationship mapping as separate steps, leading to information loss and inconsistent naming.

Methods

The authors introduce TeQoDO (Text-to-SQL task-oriented Query Dialogue Ontology construction). Instead of asking an LLM to draw a graph, they ask it to manage a database.

The core innovation is an iterative three-step pipeline that treats the LLM like a database administrator:

  1. Query Existing DB: Before adding anything new, the model is prompted to query the current state of a local SQLite database. This ensures it knows what tables and columns already exist, preventing redundant entries (e.g., creating both a "Hotel" and a "Lodging" table).
  2. Dialogue State Tracking (DST) with DB Info: The model summarizes the current dialogue into a structured state based on the existing schema. This helps the model distinguish between information it already has and truly "new" information.
  3. DB Update with Success: The model generates CREATE TABLE, ALTER TABLE, and INSERT queries to update the ontology. Crucially, the prompt includes a "Success" instruction: only update the database if the information helps fulfill the user's goal expressed in the dialogue.

To improve consistency, the system uses semantic similarity matching (via sentence transformers) and column value examples to guide the LLM toward using existing naming conventions.

Datasets

The researchers evaluated TeQoDO across several diverse benchmarks:

  • MultiWOZ 2.1 & Schema-Guided Dialogue (SGD): The gold standards for multi-domain task-oriented dialogues.
  • Wikipedia & arXiv: To test if the method generalizes beyond dialogue to complex, multi-level hierarchical ontologies.
  • Spider: Used to verify the multi-turn Text-to-SQL capabilities of the underlying models.

Key Insights and Ideas

  • SQL as a Natural Language for Ontologies: LLMs are pre-trained on massive amounts of code. The authors found that LLMs are much better at generating valid SQL queries to define structures than they are at following abstract instructions to "build a hierarchy."
  • Modular TOD Concepts Matter: Simply asking an LLM to "extract an ontology" leads to high error rates. By forcing the model to perform "Dialogue State Tracking" and consider "Dialogue Success" within the prompt, the researchers reduced SQL error rates from roughly 30% down to 5%.
  • Zero-Shot > Supervised: Surprisingly, this zero-shot approach outperformed several "transfer learning" baselines that were specifically fine-tuned on dialogue data. This suggests that the inherent reasoning required for SQL generation is a powerful proxy for structural knowledge extraction.

Key Results

  • Superior Accuracy: On the MultiWOZ dataset, TeQoDO achieved a "Continuous F1" score (a metric for semantic and structural accuracy) of 65.25, vastly outperforming the DORE baseline (39.98) and GenDSI (29.15).
  • Downstream Utility: The authors used a TeQoDO-constructed ontology to power a zero-shot Dialogue State Tracking model (TripPy-R). It achieved a Joint Goal Accuracy (JGA) of 31.5%, which actually slightly outperformed the same model using the human-made ground truth ontology (30.1%).
  • Generalization: While designed for dialogue, TeQoDO proved competitive on Wikipedia and arXiv datasets, showing it can handle thousands of nodes and complex hierarchies, though it required some clustering-based post-processing to manage the scale.

Limitations and Future Work

  • Hierarchy Depth: SQL tables naturally represent a three-level hierarchy (Table $\rightarrow$ Column $\rightarrow$ Value). Mapping deeper, more complex hierarchies (like those found in scientific taxonomies) requires "parent-ID" workarounds that can be less intuitive for the model.
  • Sequential Bottleneck: Because the model processes dialogues one by one to maintain the database state, the process is inherently sequential and difficult to parallelize for massive datasets.
  • Threshold Sensitivity: The semantic similarity matching relies on a fixed threshold (0.436). Future work aims to incorporate human-in-the-loop feedback to refine these thresholds dynamically.
  • Refining Structure: The authors suggest that future versions could include a "restructuring" phase where the LLM reviews the entire constructed database at once to merge similar tables or normalize the schema.

Summary updated

BibTeX
@article{vukovic2026text,
  author = {Renato Vukovic and Carel van Niekerk and Michael Heck and Benjamin Matthias Ruppik and Hsien-Chin Lin and Shutong Feng and Nurul Lubis and Milica Gasic},
  title = {{Text-to-SQL Task-oriented Dialogue Ontology Construction}},
  journal = {Trans. Assoc. Comput. Linguistics},
  year = {2026},
  doi = {10.1162/tacl.a.689},
}
Figure