VIEW THIS AS

Auto mode follows the Route Engine until you choose a viewpoint.

YOU ARE HERE

ROUTE CHECK

CONNECTED TO

WHAT NEXT

Use the canonical route for this room, or HELP if you are unsure.

What Is Vocabulary | Can AI Ask a Database the Wrong Question and Still Get the Right Answer? Text-to-SQL, Semantic Parsing, Denotation and Test-Suite Accuracy

Text-to-SQL systems translate natural-language questions into database queries. Semantic parsing maps language into a representation with a defined interpretation; schema linking connects expressions to database structures; execution produces a result; and denotation describes the result or value of an expression under a specified interpretation. A query can be grammatically valid, execute successfully and return the expected number while still representing the wrong question. This matters wherever artificial intelligence turns ordinary vocabulary into reports, calculations and decisions.

Vocabulary Coding and Engineering (VCE) can investigate the gap between a human information need and the database operation that represents it. Zhong, Yu and Klein’s 2020 research on semantic evaluation for text-to-SQL proposes executing candidate queries on a suite of database instances to approximate semantic accuracy more effectively than checking a single result. eduKate proposes a complementary meaning-to-query regression audit, connecting definitions, denominators, relationships, effective dates and source authority to independently reviewed test cases. This is a research proposal, not a validated universal translation mechanism.

  • Semantic parsing: mapping an expression into a representation with specified semantics.
  • Schema linking: identifying the relevant tables, columns, identifiers and relationships.
  • Query validity: conformity to the applicable language and database requirements.
  • Execution: running the query and obtaining a result or error.
  • Denotation: the result or value of the expression in a specified interpretation.
  • Execution accuracy: agreement with a reference result under an evaluation procedure.
  • Test-suite accuracy: agreement across multiple defined database instances.
  • Frontier question: can a system demonstrate that it translated the intended question rather than accidentally matching one answer?

Chapter index

1. The fictional library that counted the wrong members

A library keeps an invented table with membership status and room bookings. A reader asks how many distinct members completed a booking in November. One possible query counts completed booking rows. Another counts distinct members associated with those rows. In a small example where each member completed exactly one booking, both queries return the same number.

The agreement does not establish equivalence. If one member completes three bookings next month, the two queries produce different answers. The initial dataset concealed the difference between an event and a person. This is a vocabulary problem with computational consequences. Before translating the request, identify the entity being counted, the event, the time period and the treatment of repeated records.

2. Semantic parsing is more than recognising a word

A semantic parser maps an expression into a representation whose interpretation can be specified. SQL supplies a formal language for expressing operations over relational data. A natural-language question can contain implicit assumptions, ambiguous references or terms whose meaning is local to the organisation. SQL does not supply those missing meanings by itself.

For example, active could describe a currently valid membership, a member who logged in recently or a person with an outstanding booking. A language model that chooses a plausible column without checking the applicable definition may produce a valid query for the wrong task. An honest interpretation should identify the operational definition and disclose unresolved ambiguity.

3. Schema linking and the limits of field names

A database schema describes tables, columns, types and relationships. Schema linking identifies which structures correspond to terms in the question. Column names provide clues, but their spelling is not a complete description of their intended use. An identifier for the person submitting an application may differ from an identifier for the person receiving the service.

A trustworthy workflow can consult appropriate documentation and authorised sample data, then state its assumptions about keys, relationships and units. Avoid accessing personal data or executing arbitrary generated queries against live systems to demonstrate the lesson. The examples in this article use fictional records only. Real database access must be separately authorised and appropriately restricted.

4. Syntax, execution and denotation

Syntactic validation asks whether a query follows the language’s grammar. A database may also check whether referenced objects exist and whether types and operations are acceptable. Successful execution establishes that the database carried out the operation under the relevant conditions. The resulting rows or scalar values are the query’s result for that database instance.

Denotational equivalence is a stronger question when comparing expressions: do they yield the same relevant result across the specified interpretations? Different SQL expressions can legitimately represent the same query meaning. Conversely, different meanings can produce the same result on one instance. A single successful execution cannot settle the broader question.

5. Worked example: count rows versus count people

Consider synthetic completed-booking records containing member IDs A, A, B and C. There are four rows and three distinct IDs. If the question asks for unique members completing a booking, the answer under the assumed data model is three. If it asks how many bookings were completed, the answer is four. Neither number is inherently more accurate; each answers a different question.

Now use a second fictional dataset with A, B and C each appearing once. Both counts equal three. A test that includes only the second dataset cannot distinguish the two query interpretations. This is an example of observational agreement on a particular dataset, not evidence of semantic equivalence. Include cases where alternative interpretations produce different observable results.

6. Time, scope and the missing condition

A question about bookings completed in November might mean the completion timestamp falls in November, not the creation timestamp or scheduled visit date. The relevant time zone, interval boundaries and event definition may matter. A question about all members may include former members or only currently eligible members depending on its purpose.

The query must preserve these distinctions. Date filters, join conditions and inclusion rules should be reviewed against the original information need. The presence of a familiar date column does not establish that it represents the required event. When the source does not establish the intended choice, ask an appropriate clarification or present a clearly conditional interpretation.

7. Nulls, joins and duplicated relationships

A missing value is not automatically zero, false or a confirmed negative fact. SQL operations handle nulls according to their semantics. Joins can also change the number of rows associated with a person or event, particularly when one record is related to multiple other records. Aggregating after a join can unintentionally count a person several times.

A fictional report may join members with their bookings and notices. If one booking has three related notices, the joined table may contain three rows for that booking. An aggregate over rows can now answer an unintended question. Vocabulary engineering begins by stating what each row represents and which counting unit the requested statistic uses.

8. Test suites rather than a single convenient result

Zhong, Yu and Klein studied semantic evaluation by testing candidate queries on multiple constructed database instances. Their method is designed to approximate semantic correctness more closely than evaluation restricted to a single instance. Such test-suite evaluation is still bounded: a finite collection of tests may fail to expose a difference.

For VCE, a useful test fixture is deliberately designed around a declared distinction. Add repeated people, boundary dates, absent values and different role relationships in synthetic data. Where two queries are supposed to mean different things, create cases that separate them. Where two queries are intended to be equivalent, check the relevant expected results without assuming textual identity is required.

9. Text zoom TX0–TX6: a query carries a proposition

At TX0, a token can identify a column name; at TX1, a phrase specifies a possible local meaning; at TX2, a proposition establishes a requested relation; at TX3 and TX4, conditions and surrounding instructions qualify it; at TX5, the complete information request establishes its purpose; at TX6, institutional definitions and authoritative documentation may determine what the fields represent.

The eduKate TX framework is an organising proposal for locating meaning loss. A text-to-SQL system might preserve the word completed while losing the relevant time or counting unit. A query might correctly calculate its denotation while failing the human request. Testing must therefore examine more than the generated query’s appearance.

10. Civilisation zoom Z0–Z2: learn to count what the question asks

At Z0, a learner distinguishes counting objects from counting events. At Z1, people agree on definitions before comparing results. At Z2, a learning community develops examples that expose different interpretations of a familiar question. The Fencing Method turns each distinction into positive cases, counterexamples and transfer exercises.

A student who obtains a correct number by coincidence should still learn why the calculation answers the question. Similarly, an AI tutor should explain the relevant denominator and not confuse calculation with interpretation. Human learning is not the same as SQL execution, but both benefit from independently checking what the result represents.

11. Civilisation zoom Z3–Z6: databases become institutional memory

At Z3, organisations use structured data to coordinate services and evaluate outcomes. At Z4, public institutions need transparent and appropriate definitions of indicators. At Z5, data crosses different languages, systems and governance arrangements. At Z6, future generations must be able to interpret historical datasets and the questions used to produce their reports.

The Second Intelligence Pool and eduKate’s crosswalk framework motivate a portable meaning-to-query record. Store the intended information need, field definitions, scope, query version, reference outcomes and limitations as appropriate. This supports the proposed portable-civilisation architecture but does not guarantee correct interpretation or authorise access to restricted information.

12. Ztime: a query can stay unchanged while its meaning changes

At T0, a database schema and vocabulary are defined. At T1, a query is created and tested. At T2, the data changes. At T3, a field definition or schema version may change. At T4 and beyond, historical reports may need to be reproduced using the original conditions. These are illustrative stages, not a prescribed database lifecycle.

A query that ran successfully last year may be inappropriate after a change in what a status means. Preserve the schema and definition versions, effective periods and test references. The Ztime framework separates reproduction of a historical computation from a claim about current data or current institutional requirements.

13. Frontier experiment: meaning-to-query regression audit

Construct a wholly synthetic library database and independently annotate natural-language questions with the intended counted entity, relationships, time conditions and expected answers. Compare ordinary text-to-SQL generation, generation with schema documentation and a proposed VCE-assisted procedure using explicit meaning boundaries. Hold out entire question families and vary the synthetic database instances.

Measure syntax success, execution success, agreement with the independent reference across instances, boundary-specific failures, useful clarifications and reviewer effort. Include semantically wrong queries that coincidentally match the reference on one instance. Test legitimate alternative queries as well as errors. Report negative results and uncertainty; a finite suite cannot prove all possible query equivalences. No experiment has been conducted for this article.

14. Four-week progression and EnDist

Week one: distinguish entities, rows and events in invented tables. Week two: calculate distinct counts and compare them with event totals. Week three: design synthetic tests that separate dates, nulls and roles. Week four: evaluate candidate interpretations against independent expected results and document the limits of the tests.

EnDist is eduKate’s proposed organising concept for useful capability after rework, misunderstanding and coordination losses. A specific study could compare correctly answered questions per measured review and computational budget. It is not a validated physical quantity. The frontier is to reduce the distance between the question a person intends and the result an institution actually receives.

Comparison table

TermMeaningDoes not establish
Schema linkingMap expressions to data structuresCorrect institutional interpretation
Query validityMeet applicable language requirementsCorrect question
ExecutionPerform a database operationCorrect intended meaning
DenotationResult under an interpretationEquivalence across all instances
Test suiteDefined collection of reference casesExhaustive proof of equivalence
Meaning-to-query auditProposed independent task-boundary testsEstablished universal accuracy

Conclusion

When AI converts vocabulary into database operations, the crucial risk is not always an execution error. It is a successful operation that answers the wrong question. A meaning-aware evaluation should test the intended relation, conditions and counting unit across cases designed to reveal the difference.

Frontier technology: companion articles

Research sources and further reading