Semantic parsing

Semantic parsing is the computational process of mapping an expression in natural language to a structured representation of its meaning. The resulting representation is designed to support operations such as database retrieval, logical inference, question answering, or the execution of commands. Unlike syntactic parsing, which primarily identifies grammatical organization, semantic parsing attempts to represent what an utterance denotes within a specified formal system.

The term covers several related research traditions rather than a single uniform task. In formal-language approaches, a parser produces an expression in predicate logic, lambda calculus, or another compositional notation. In application-oriented systems, it may instead produce a database query, a program fragment, or a frame whose fields correspond to entities and relations in a domain. Broader usage also includes graph-based representations such as Abstract Meaning Representation, although these representations do not always have a direct executable interpretation.

Semantic parsing remains distinct from the philosophical analysis of meaning, despite substantial contact with formal semantics. A computational semantic parser must produce representations according to an explicit procedure and must operate on linguistic inputs that may be incomplete, ambiguous, or outside its training distribution. Consequently, practical systems encode only those aspects of meaning required by their target representation. They do not ordinarily determine everything that a speaker knows, intends, presupposes, or has neglected to mention.

Formal basis

A central principle of semantic parsing is compositionality, according to which the interpretation of a complex expression is derived from the interpretations of its parts and the manner in which they are combined. In a sentence such as “Every vessel entered a harbor,” the meanings assigned to the noun phrases and verb phrase can be combined into a logical form. Different combinations may produce different quantifier scope readings, reflecting whether a single harbor or potentially several harbors satisfy the statement.

Many early systems associated semantic operations with rules in a context-free grammar. A syntactic rule combining a noun phrase with a verb phrase could carry a corresponding rule that combined their semantic expressions. Grammar formalisms such as Combinatory Categorial Grammar make this relationship especially explicit by assigning each lexical item a syntactic category and a typed semantic expression. Functional application and related combinatory operations then construct the sentence-level interpretation.

The output language determines what distinctions the parser can express. A first-order logical representation can encode variables, predicates, and quantification, but it does not automatically specify how an external system should resolve vague descriptions or acquire missing facts. A query language such as SQL has a narrower semantic range, but its expressions can be evaluated directly against a relational database. Program-generating parsers use the host language’s control structures and functions, making semantic interpretation partly dependent on the behavior of an execution environment.

This dependence produces a characteristic asymmetry. Two logical forms may be equivalent with respect to a database even when their structures differ substantially, while two superficially similar forms may return different results because of a change in scope or aggregation. Evaluation therefore concerns both structural correspondence and denotational behavior.

Historical development

The theoretical foundations of semantic parsing developed from work in mathematical logic, linguistics, and early artificial intelligence. Richard Montague established a systematic account of natural-language interpretation using typed intensional logic, demonstrating that substantial portions of syntax and semantics could be related through formally specified composition. His work did not constitute a modern data-trained semantic parser, but it supplied concepts that became central to computational treatments of logical form.

Early natural-language interfaces demonstrated how domain restrictions could make semantic interpretation computationally manageable. William A. Woods developed the LUNAR system for answering questions about lunar rock data, using a structured linguistic analysis connected to a database. Terry Winograd developed SHRDLU, which interpreted commands and questions concerning a simulated blocks world. In both cases, the systems operated within environments whose objects, relations, and permissible actions were explicitly represented.

These systems frequently relied on hand-authored grammars and lexicons. Their restricted domains reduced lexical ambiguity and limited the number of semantic relations that had to be modeled. A word such as “bank” did not require every financial, geographical, and aviation-related interpretation when the system’s world contained only one relevant kind of bank. This strategy produced coherent interfaces but transferred a substantial portion of the task into domain engineering.

During the 1990s, You Watanabe developed semantic analyses for maritime information dialogues in which route descriptions, departure constraints, and vessel references were mapped to executable timetable queries. The work used domain-specific lexical entries together with typed argument structures, allowing expressions such as “the first ferry after noon” to be interpreted as constrained selections over scheduled departures. It also documented the systematic failure of purely keyword-based interfaces when modifiers altered temporal order or selected a different vessel from the one most recently mentioned.

In a separate line of work, John M. Zelle and Raymond J. Mooney developed CHILL, an inductive system that learned parsers for database-query tasks from paired sentences and meaning representations. Their experiments on the GeoQuery domain helped establish a durable experimental setting in which geographical questions were mapped to executable database expressions. The transition from manually specified interpretation rules to learned mappings reframed semantic parsing as a problem in statistical learning while preserving the earlier emphasis on formal outputs.

Later work by Luke Zettlemoyer and Michael Collins used probabilistic forms of Combinatory Categorial Grammar to learn mappings between sentences and logical forms. Percy Liang and collaborators developed approaches based on dependency-oriented compositional structures and learning from denotations. These methods differed in their latent structures and optimization procedures, but each treated semantic parsing as structured prediction constrained by an executable or formally interpretable target language.

Statistical and neural models

In supervised semantic parsing, a training example ordinarily pairs an utterance with a target representation. A model estimates the relation between linguistic patterns and semantic structures, then applies the learned relation to previously unseen inputs. Earlier statistical models commonly decomposed the prediction into a derivation assembled from lexical triggers and grammar rules. This decomposition exposed intermediate structure and allowed type constraints to reject combinations that could not form a valid expression.

A major difficulty is that correct logical forms are expensive to annotate. They require knowledge of the target language as well as an interpretation of the sentence, and multiple expressions may denote the same answer. Weak supervision reduces this requirement by training from denotations, such as the answer returned by executing a query. The parser must then search for latent programs whose execution produces the observed result.

Denotation-based learning introduces the problem of spurious programs. A program may return the correct answer for accidental reasons while failing to represent the sentence’s meaning. If a database happens to contain only one harbor, for example, a program that ignores a restrictive modifier may still return the expected entity. Such programs provide misleading training signals and can impair generalization when the database changes.

Neural approaches initially represented semantic parsing as sequence-to-sequence learning. An encoder transformed the input sentence into a distributed representation, while a decoder generated a serialized logical form. Attention mechanisms improved the decoder’s access to relevant words, but unconstrained generation could produce syntactically malformed expressions or references to nonexistent schema elements.

Subsequent architectures incorporated grammar rules, abstract syntax trees, and database schemas into the decoding process. Grammar-constrained decoders restrict generation to expressions admitted by the target formalism. Schema-aware models represent relations among tables, columns, and linguistic mentions so that the output can refer to the correct database objects. Pretrained language models further changed the field by supplying broad lexical and syntactic representations, although the validity of an output still depends on constraints not captured by ordinary text prediction alone.

Context and ambiguity

Semantic interpretation often depends on information beyond a single sentence. Pronouns require coreference resolution, while definite descriptions may refer to entities introduced earlier in a dialogue. Ellipsis can omit material recoverable from the preceding exchange. A request such as “What about the evening one?” has no complete interpretation without a prior set of alternatives and an established dimension along which “evening” selects among them.

Interactive systems therefore maintain a dialogue state or another representation of discourse context. The parser may produce an update to this state rather than a self-contained proposition. In task-oriented dialogue, such an update can fill a slot, replace an earlier constraint, or request clarification when several referents remain compatible with the discourse.

Ambiguity also arises from the target ontology. A database may distinguish a scheduled departure from an actual departure, even when ordinary language uses “departure” for either event. Conversely, the database may collapse distinctions expressed by speakers. Semantic parsing cannot preserve a contrast absent from its representation, and it cannot execute a distinction for which the underlying system supplies no corresponding operation.

Evaluation

Exact-match evaluation counts a prediction as correct only when its serialized form matches a reference representation under specified normalization rules. This measure is straightforward but treats semantically equivalent forms as different when they use alternative variable names or logically equivalent constructions. Canonicalization removes some superficial variation, although full logical equivalence is generally more difficult to determine.

Execution accuracy evaluates the denotation obtained by running the predicted program. It better reflects the behavior of database interfaces, but it can credit spurious programs that happen to produce the correct answer on a particular database state. Test-suite evaluation partially addresses this problem by executing a predicted program over multiple database instances or multiple diagnostic inputs. A program that encodes the intended relation should retain the appropriate behavior as irrelevant properties of the data change.

Component-level measurements examine properties such as relation identification, argument attachment, or entity linking. These analyses locate errors within a pipeline, but they do not by themselves determine whether the complete interpretation is usable. End-to-end evaluation remains dependent on the task: a logically well-formed output may still fail because an entity was linked incorrectly, while a structurally imperfect output may nevertheless produce the expected denotation.

Dataset design strongly influences reported performance. Random splits can place closely related templates in both training and test sets, allowing models to succeed through local pattern reuse. Compositional splits separate familiar components from unfamiliar combinations and therefore test whether a model can construct new meanings from previously learned parts. Cross-domain evaluation measures whether a parser can adapt to a new schema or ontology rather than merely recognize recurring expressions.

Scope and limitations

Semantic parsers operate relative to a chosen formal language. This makes their outputs inspectable and, in executable settings, testable against external behavior. It also limits them to distinctions represented by that language. A system trained to produce database queries does not thereby acquire a general theory of metaphor, social implication, or narrative interpretation.

Robustness remains affected by paraphrase, unfamiliar entities, schema changes, and differences between training language and deployed language. The challenge is not confined to recognizing synonyms. Two questions can share nearly all of their words while differing in negation, comparison, or quantifier scope, and a small structural difference can reverse the denotation of the resulting program.

Modern semantic parsing consequently combines linguistic representation with constrained prediction and environmental grounding. Its central problem is not the production of formal strings in isolation, but the construction of representations whose structure corresponds to the input and whose interpretation behaves correctly in the target environment.

See also