CSCI-SHU 376: Natural Language Processing
Hua Shen
Course Agenda: 2026 Spring-NLP-[CSCI-SHU-376]-Class Schedule
2026-03-12
Spring 2026
Lecture 11: LLM Decoding / Semantic Parsing
Today’s Plan
What is inside LLM?
LMs are locally normalized
Probability distribution -> Hallucination
Our goal: Get “Good” Outputs
Today’s Plan
Recap: Greedy Decoding
Recap: Beam Search
Highest probability always best?
Highest probability always best?
Ancestral Sampling
Ancestral Sampling
Top-K Sampling
Top-p Sampling
Epsilon Sampling
Contrastive Decoding
Today’s Plan
Different types of Constraints
19
Different types of Constraints
20
Prompting is not enough!
21
Constrained decoding: Manipulate logits
22
Constrained decoding: Rejection Sampling
23
Today’s Plan
Semantic Parsing
25
Semantic Parsing: QA
26
Semantic Parsing: Instructions
27
Language to Meaning
28
Neural Semantic Parsing
29
Text-to-SQL Semantic Parsing
30
How many cities have at least 25,000 people?
Natural Language Question
Database Schema
City | Population | Area | … |
Execution Result
4
SELECT count(c1) FROM w WHERE c2 >= 25000
SQL Query
Input
Output
Text-to-SQL Semantic Parsing: Evaluation Metrics
31
How many cities have at least 25,000 people?
Natural Language Question
Database Schema
City | Population | Area | … |
Execution Result
4
SELECT count(c1) FROM w WHERE c2 >= 25000
SQL Query
Input
Output
Logical Form Accuracy
Execution Accuracy
Text-to-SQL Semantic Parsing: Supervision
32
How many cities have at least 25,000 people?
SELECT count(c1) FROM w WHERE c2 >= 25000
Execution Result
4
Natural Language Question
SQL Query
Database Schema
City | Population | Area | … |
33
On the Potential of Lexico-logical Alignments for Semantic Parsing to SQL Queries
{ }, Jordan Boyd-Graber, Hal Daumé III, Lillian Lee
34
Tianze Shi
Chen Zhao
In EMNLP-Findings (2020)
Text-to-SQL Semantic Parsing: Supervision
35
Execution Result
4
How many cities have at least 25,000 people?
Natural Language Question
SELECT count(c1) FROM w WHERE c2 >= 25000
SQL Query
+Alignments
Database Schema
City | Population | Area | … |
Dataset: SQUALL =“SQL+QUestion pairs ALigned Lexically”
36
Annotation Interface
37
Annotation Interface
38
Alignment Annotations
39
Model
40
Model: Encoder
41
Natural Language Question
Table Schema
City | Population | Area | Region | … |
Word embedding lookup
Bi-LSTM final states
Bi-directional LSTM
Self-Attention
Attention
Bi-directional LSTM
Bi-directional LSTM
How many cities have …
Model: Encoder w/ BERT
42
Natural Language Question
Table Schema
BERT
Attention
Bi-directional LSTM
Bi-directional LSTM
[CLS]
[SEP] City [SEP] Population [SEP] Area [SEP] … [SEP]
How many cities have …
Model: Decoder
43
Natural Language Question
Encoder
Decoder LSTM
SELECT
count
…
…
Attention
Table Schema
<START>
Model: Decoder
44
Decoder LSTM
SELECT
…
…
<START>
MLP
Keyword
STR
COL
Copy
Mechanism
Over
Question Tokens
Copy
Mechanism
Over
Columns
MLP
to
Predict
Keyword
count
Model
45
Model: Supervised Attention
46
Model: Supervised Attention
47
How many cities have at least 25,000 people ?
SELECT count ( c1 ) FROM w WHERE c2 >= 25000
About to predict this token
Model: Supervised Attention
48
How many cities have at least 25,000 people ?
SELECT count ( c1 ) FROM w WHERE c2 >= 25000
About to predict this token
Attention weights
0.3 0.25 0.05 0.1 0.05 0.05 0.05 0.1 0.05
Model: Supervised Attention
49
How many cities have at least 25,000 people ?
SELECT count ( c1 ) FROM w WHERE c2 >= 25000
About to predict this token
Attention weights
0.3 0.25 0.05 0.1 0.05 0.05 0.05 0.1 0.05
Alignment vector
0.5 0.5 0.0 0.0 0.0 0.0 0.0 0.0 0.0
Model: Supervised Attention
50
How many cities have at least 25,000 people ?
SELECT count ( c1 ) FROM w WHERE c2 >= 25000
About to predict this token
Attention weights
0.3 0.25 0.05 0.1 0.05 0.05 0.05 0.1 0.05
Alignment vector
0.5 0.5 0.0 0.0 0.0 0.0 0.0 0.0 0.0
Loss:
Final loss: linear combination of and seq2seq
Results on WikiTableQuestions
51
EXE accuracy
w/ BERT
w/o BERT
+6.2
+8.4
Previous
Best
ALIGN
(single)
ALIGN
(ensemble)
Previous
Best
ALIGN
(single)
ALIGN
(ensemble)
Alignment Annotations Provide Further Improvements
52
+4.4
LF accuracy
SEQ2SEQ+
ALIGN
Automatic
alignment
Sup.
decoder
attention
Sup.
encoder
attention
Analysis
53
Logical form accuracy | + 4.4 |
Template accuracy | + 2.0 |
Column accuracy | + 4.9 |
Logical form accuracy | +10.6 |
Execution accuracy | +12.5 |
On unseen templates
Absolute improvements
Unrealized Potential
54
+4.4
LF accuracy
SEQ2SEQ+
ALIGN
Oracle
attention
+23.9
Interim Summary
55