﻿# CoSQL: keep conversational SQL turns together

Keep CoSQL user and expert dialogue history intact, distinguish SQL tracking from response and act prediction, and evaluate only information available at each turn.

Author: Retrivium editorial team
Updated: 2026-11-03
Canonical URL: https://retrivium.ai/journal/data-guide-cosql-conversation-database-state/
Language: en

## Preserve the user-expert interaction

The [CoSQL owner page](https://yale-lily.github.io/cosql) describes a Wizard-of-Oz collection in which a user explores a database and an expert writes SQL, explains results, or requests clarification. The observation unit is a dialogue with ordered turns, not an unordered set of question/query pairs. Keep speaker roles, turn order, and database identity when creating a derivative. Removing expert messages can discard clarification that determines the meaning of a later user request; including future messages supplies information unavailable at prediction time.

## Keep ambiguous and unanswerable turns visible

The [original paper](https://arxiv.org/html/1909.05378) explicitly includes ambiguous and unanswerable questions. A missing SQL target should not automatically be treated as a corrupted example or replaced with a guessed query. The appropriate behavior can be clarification or a different dialogue act. An editorial review should preserve these categories and distinguish failures to identify answerability from failures to generate valid SQL. Otherwise a SQL-only filtered subset can appear easier while concealing the very interaction challenges for which CoSQL was collected.

## Separate the three target tasks

CoSQL defines SQL-grounded dialogue state tracking, natural-language response generation from executed query/results, and user dialogue-act prediction. These targets consume different evidence. A response generator supplied with a reference query and result has a different task from an end-to-end system whose own query may be wrong. Record which preceding SQL states and result tables are gold or predicted in [provenance metadata](/journal/document-markdown-json-provenance/). Fluent response text does not establish that an underlying database answer is correct.

## Retain interaction boundaries in SQL scoring

The [official test-suite evaluator](https://github.com/taoyds/test-suite-sql-eval) specifies SQL prediction order and blank-line interaction separators for CoSQL. Flattening all lines without boundaries can retain individual queries while destroying the sequence-level grouping. Preserve database/schema alignment and record whether reference values are plugged into predictions. Report the selected SQL metric separately from response quality and act classification. The SQL scorer cannot evaluate whether a clarification question was helpful or whether a natural-language summary faithfully describes the returned rows.

## Evaluate history and domain transfer independently

The collection tests unfamiliar databases, while later turns also depend on conversational context. A new experimental slice can vary history length or inspect clarification-dependent turns, clearly labeling these as editorial analyses. Keep entire dialogues and their database grouping within the intended partitions, applying [leakage checks](/journal/document-level-data-split-leakage/) to derived training prompts. CoSQL is useful for research on multi-turn database interaction. Its curated expert assistance and finite dialogue paths do not establish unrestricted conversational competence or correctness on every ambiguous request a new database user might make.
