G RAPPA : G RAMMAR -A UGMENTED P RE -T RAINING FOR T ABLE S EMANTIC P ARSING
A BSTRACT
We present G RAPPA , an effective pre-training approach for table semantic parsing that learns a compositional inductive bias in the joint representations of textual and tabular data.
We construct synthetic question-SQL pairs over high-quality tables via a synchronous context-free grammar (SCFG).
We pre-train G RAPPA on the synthetic data to inject important structural properties commonly found in table semantic parsing into the pre-training language model.
To maintain the model’s ability to represent real-world data, we also include masked language modeling (MLM) on several existing table-and-language datasets to regularize our pre-training process.
Our proposed pre-training strategy is much data-efﬁcient.
When incorporated with strong base semantic parsers, G RAPPA achieves new state-of-the-art results on four popular fully supervised and weakly supervised table semantic parsing tasks.
The pre-trained embeddings can be downloaded at https://huggingface.co/Salesforce/grappa_large_jnt .
I NTRODUCTION
Tabular data serve as important information source for human decision makers in many domains, such as ﬁnance, health care, retail and so on.
While tabular data can be efﬁciently accessed via the structured query language (SQL), a natural language interface allows such data to be more accessible for a wider range of non-technical users.
As a result, table semantic parsing that maps natural language queries over tabular data to formal programs has drawn signiﬁcant attention in recent years.
Recent pre-trained language models (LMs) such as BERT (Devlin et al., 2019) and RoBERTa (Liu et al., 2019) achieve tremendous success on a spectrum of natural language processing tasks, including semantic parsing (Zettlemoyer & Collins, 2005; Zhong et al., 2017; Yu et al., 2018b).
These advances have shifted the focus from building domain-speciﬁc semantic parsers (Zettlemoyer & Collins, 2005;
Artzi & Zettlemoyer, 2013; Berant & Liang, 2014; Li & Jagadish, 2014) to cross-domain semantic parsing (Zhong et al., 2017; Yu et al., 2018b; Herzig & Berant, 2018; Dong & Lapata, 2018; Wang et al., 2020; Lin et al., 2020).
Despite such signiﬁcant gains, the overall performance on complex benchmarks such S PIDER (Yu et al., 2018b) and W IKI T ABLE Q UESTIONS benchmarks are still limited, even when integrating representations of current pre-trained language models.
As such tasks requires generalization to new databases/tables and more complex programs (e.g., SQL), we hypothesize that current pretrained language models are not sufﬁcient for such tasks.
First, language models pre-trained using unstructured text data such as Wikipedia and Book Corpus are exposed to a signiﬁcant domain shift when directly applied to table semantic parsing, where jointly modeling the relation between utterances and structural tables is crucial.
Second, conventional pre-training objectives does not consider the underlying compositionality of data (e.g., questions and SQLs) from table semantic parsing.
To close this gap, we seek to learn contextual representations jointly from structured tabular data and unstructured natural language sentences, with objectives oriented towards table semantic parsing.
[Figure]
In this paper
[Figure]
we propose a novel grammar-augmented pre-training framework for table semantic parsing (G RAPPA ).
Inspired by previous work on data synthesis for semantic parsing (Berant & Liang, 2014; Wang et al., 2015b; Jia & Liang, 2016; Herzig & Berant, 2018; Andreas, 2020), we induce a synchronous context-free grammar (SCFG) speciﬁc to mapping natural language to SQL queries from existing text-to-SQL datasets, which covers most commonly used question-SQL patterns.
As shown in Figure 1, from a text-to-SQL example we can create a question-SQL template by abstracting over mentions of schema components (tables and ﬁelds), values, and SQL operations.
By executing this template on randomly selected tables we can create a large number of synthetic question-SQL pairs.
We train G RAPPA on these synthetic question-SQL pairs and their corresponding tables using a novel text-schema linking objective that predicts the syntactic role of a table column in the SQL for each pair.
This way we encourage the model to identify table schema components that can be grounded to logical form constituents, which is critical for most table semantic parsing tasks.
To prevent overﬁtting to the synthetic data, we include the masked-language modelling (MLM) loss on several large-scale, high-quality table-and-language datasets and carefully balance between preserving the original natural language representations and injecting the compositional inductive bias through our synthetic data.
We pre-train G RAPPA using 475k synthetic examples and 391.5k examples from existing table-and-language datasets.
Our approach dramatically reduces the training time and
GPU cost.
We evaluate on four popular semantic parsing benchmarks in both fully supervised and weakly supervised settings.
G RAPPA consistently achieves new state-of-the-art results on all of them, signiﬁcantly outperforming all previously reported results.
M ETHODOLOGY 2. M OTIVATION
Semantic parsing data is compositional because utterances are usually related to some formal representations such as logic forms and SQL queries.
Numerous prior works (Berant & Liang, 2014;
Wang et al., 2015a; Jia & Liang, 2016; Iyer et al., 2017; Andreas, 2020) have demonstrated the beneﬁts of augmenting data using context-free grammar.
The augmented examples can be used to teach the model to generalize beyond the given training examples.
However, data augmentation becomes more complex and less beneﬁcial if we want to apply it to generate data for a random domain.
More and more work (Zhang et al., 2019b; Herzig et al., 2020b;
Campagna et al., 2020; Zhong et al., 2020) shows utilizing augmented data doesn’t always result in a signiﬁcant performance gain in cross-domain semantic parsing end tasks.
The most likely reason for this is that models tend to overﬁt to the canonical input distribution especially the generated utterances are very different compared with the original ones.
Moreover, instead of directly training semantic parsers on the augmented data, our paper is the ﬁrst to use the synthetic examples in pre-training in order to inject a compositional inductive bias to LMs and show it actually works if the overﬁtting problem is carefully addressed.
To address the overﬁtting problem, in Section 2.3, we also include a small set of table related utterances in our pre-training data.
We add an MLM loss on them as a regularization factor, which requires the model to balance between real and synthetic examples during the pre-training.
We note that this consistently improves the performance on all downstream semantic parsing tasks (see Section 4).
Finally, our pre-training method is much more data-efﬁcient and save much more computational power than other prior work (Section 5).
2. D ATA S YNTHESIS WITH S YNCHRONOUS C ONTEXT -F REE G RAMMAR
We follow Jia & Liang (2016) to design our SCFG and apply it on a large amount of tables to populate new examples.
For example, as shown in Figure 1, by replacing substitutable column mentions (“locations”), table mentions (“performance”), values (“two”), and SQL logic phrases (“at least”) with the other possible candidates in the same group, our grammar generates new synthetic text-to-SQL examples with the same underlying SQL logic template.
We then pre-train BERT on the augmented examples to force it to discover substitutable fragments and learn the underlying logic template so that it is able to generalize to other similar questions.
Meanwhile, BERT also beneﬁts from pre-training on a large number of different columns, table names, and values in the generated data, which could potentially improve schema linking in semantic parsing tasks.
[Table]
[Figure]
[Table]
[Figure]
[Table]
[Figure]
[Table]
Grammar induction To induce a cross-domain SCFG, we study examples in S PIDER since it is a publicly available dataset that includes the largest number of examples with complex compositionalities in different domains.
To further show the generality of our approach, we do not develop different
SCFG for each downstream task.
Given a set of ( x, y ) pairs in S PIDER , where x and y are the utterance and SQL query respectively.
We ﬁrst deﬁne a set of non-terminal symbols for table names, column names, cell values, operations, etc.
For example, in Table 1, we group aggregation operations such as MAX as a non-terminal AGG .
We can also replace the entities/phrases with their non-terminal types in SQL query to generate a SQL production rule β .
Then, we group ( x, y ) pairs by similar
SQL production rule β .
We automatically group and count Spider training examples by program templates, and select about 90 most frequent program templates β .
For each program template in the grammar, we randomly select roughly 4 corresponding natural language questions, manually replace entities/phrases with their corresponding non-terminal types to create natural language templates α , and ﬁnally align them to generate each production rule ROOT → (cid:104) α, β (cid:105) .
The manual alignment approximately takes a few hours.
About 500 S PIDER examples are studied to induce the SCFG.
Data augmentation With (cid:104) α, β (cid:105) pairs, we can simultaneously generate pseudo natural questions and corresponding SQL queries given a new table or database.
We ﬁrst sample a production rule, and replace its non-terminals with one of corresponding terminals.
For example, we can map the non-terminal AGG to MAX and “maximum” for the SQL query and the natural language sentence, respectively.
Also, table content is used in synthesizing our pre-training data.
For example, if the sampled production rule contains a value (e.g., VALUE 0), we sample a value for the selected column from the table content and add it to the SQL and question templates.
This way during pre-training,
G RAPPA can access the table content and learn the linking between values and columns.
We use W IKI T ABLES (Bhagavatula et al., 2015), which contains 1.6 million high-quality relational
Wikipedia tables.
We remove tables with exactly the same column names and get about 340k tables and generate 413k question-SQL pairs given these tables.
Also, we generate another 62k questionSQL pairs using tables and databases in the training sets of S PIDER and W IKI SQL.
In total, our ﬁnal pre-training dataset includes 475k question-SQL examples.
We note that SCFG is usually crude (Andreas, 2020) especially when it is applied to augment data for different domains.
In this work we don’t focus on how to develop a better SCFG that generates more natural utterances.
We see this as a very interesting future work to explore.
Despite the fact that the SCFG is crude, our downstream task experiments show that it could be quite effective if some pre-training strategies are applied.
2. T ABLE R ELATED U TTERANCES
As discussed in Section 2.1, G RAPPA is also pre-trained on human annotated questions over tables with a MLM objective.
We collected seven high quality datasets for textual-tabular data understanding (Table 8 in the Appendix), all of them contain Wikipedia tables or databases and the corresponding natural language utterances written by humans.
We only use tables and contexts as a pre-training resource and discard all the other human labels such as answers and SQL queries.
2. P RE -T RAINING G RAPPA
Unlike all the previous work where augmented data is used in the end task training, we apply the framework to language model pre-training.
Training semantic parsers is usually slow, and augmenting a large amount of syntactic pairs directly to the end task training data can be prohibitively slow or expensive.
In our work, we formulate text-to-SQL as a multi-class classiﬁcation task for each column, which can be naturally combined with the MLM objective to pre-train BERT for semantic parsing.
Moreover, in this way, the learned knowledge can be easily and efﬁciently transferred to downstream semantic parsing tasks in the exact same way as BERT (shown in Section 4).
G RAPPA is initialized by RoBERTa LARGE (Liu et al., 2019) and further pre-trained on the synthetic data with SQL semantic loss and table-related data with MLM loss.
As shown in Figure 1, we follow Hwang et al.
(2019) to concatenate a user utterance and the column headers into a single ﬂat sequence separated by the 
 token.
The user utterance can be either one of the original human utterances collected from the aggregated datasets or the canonical sentences sampled from the SCFG.
We add the table name at the beginning of each column if there are some complex schema inputs involving multiple tables.
We employ two objective functions for language model pre-training: 1) masked-language modelling (MLM), and 2) SQL semantic prediction (SSP).
MLM objective Intuitively, we would like to have a self-attention mechanism between natural language and table headers.
We conduct masking for both natural language sentence and table headers.
A small part of the input sequence is ﬁrst replaced with the special token <mask> .
The
MLM loss is then computed by the cross-entropy function on predicting the masked tokens.
We follow the default hyperparameters from Devlin et al.
with a 15% masking probability.
SSP objective With our synthetic natural language sentence and SQL query pairs, we can add an auxiliary task to train our column representations.
The proposed task is, given a natural language sentence and table headers, to predict whether a column appears in the SQL query and what operation is triggered.
We then convert all SQL sequence labels into operation classiﬁcation labels for each column.
For example in the Figure 1, the operation classiﬁcation label of the column “locations” is SELECT AND GROUP BY HAVING .
In total, there are 254 potential classes for operations in our experiments.
For a column or table indexed by i , we use the encoding of the special token
right before it as its representation, denoted as x i to predict its corresponding operations.
On top of such representations, we apply a two-layer feed-forward network followed by a GELU activation layer (Hendrycks &
Gimpel, 2016) and a normalization layer (Ba et al., 2016) to the output representations.
Formally, we compute the ﬁnal vector representation of each column y
i by:
[Equation]
Finally, y i is employed to compute the cross-entropy loss through a classiﬁcation layer.
We sum losses from all columns in each training example for back-propagation.
For samples from the aggregated datasets, we only compute the MLM loss to update our model.
For samples from the synthetic data we generated, we compute only SSP loss to update our model.
More speciﬁcally, we mix 391k natural language utterances and 475k synthetic examples together as the ﬁnal pre-training data.
The examples in these two groups are randomly sampled during the pre-training, and MLM loss is computed if the selected example is a natural language question, otherwise SSP for a synthetic example.
E XPERIMENTS
We conduct experiments on four cross-domain table semantic parsing tasks, where generalizing to unseen tables/databases at test time is required.
We experiment with two different settings of table semantic parsing, fully supervised and weakly supervised setting.
The data statistics and examples on each task are shown in Table 2 and Table 7 in the Appendix respectively.
[Table]
3. S UPERVISED S EMANTIC P ARSING
We ﬁrst evaluate G RAPPA on two supervised semantic parsing tasks.
In a supervised semantic parsing scenario, given a question and a table or database schema, a model is expected to generate the corresponding program.
S PIDER
S PIDER Yu et al.
(2018b) is a large text-to-SQL dataset.
It consists of 10k complex question-query pairs where many of the SQL queries contain multiple SQL keywords.
It also includes 200 databases where multiple tables are joined via foreign keys.
For the baseline model, we use
RAT-SQL + BERT Wang et al.
(2020) which is the state-of-the-art model according to the ofﬁcial leaderboard.
We followed the ofﬁcial Spider evaluation to report set match accuracy.
Fully-sup.
W IKI SQL
W IKI SQL Zhong et al.
(2017) is a collection of over 80k questions and
SQL query pairs over 30k Wikipedia tables.
We use Guo & Gao (2019), a competitive model on
W IKI SQL built on SQLova Hwang et al.
(2019), as our base model.
We adapt the same set of hyperparameters including batch size and maximum input length as in Guo & Gao (2019).
For a fair comparison, we only consider single models without execution-guided decoding and report execution accuracy.
3. W EAKLY - SUPERVISED S EMANTIC P ARSING
We also consider weakly-supervised semantic parsing tasks, which are very different from SQLguided learning in pre-training.
In this setting, a question and its corresponding answer are given, but the underlying meaning representation (e.g., SQL queries) are unknown.
W IKI T ABLE Q UESTIONS
This dataset contains question-denotation pairs over single Wikipedia tables Pasupat & Liang (2015).
The questions involve a variety of operations such as comparisons, superlatives, and aggregations, where some of them are hard to answered by SQL queries.
[Table] [Table]
All results are on execution accuracy without execution-guided decoding.
We used the model proposed by Wang et al.
(2019) which is the state-of-the-art parser on this task.
This model is a two-stage approach that ﬁrst predicts a partial “abstract program” and then reﬁnes that program while modeling structured alignments with differential dynamic programming.
The original model uses GloVe Pennington et al.
(2014) as word embeddings.
We modiﬁed their implementation to encode question and column names in the same way as we do in our ﬁne-tuning method that uses
RoBERTa and G RAPPA .
Weakly-sup.
W IKI SQL
In the weakly-supervised setting of W IKI SQL, only the answers (i.e., execution results of SQL queries) are available.
We also employed the model proposed by Wang et al.
(2019) as our baseline for this task.
We made the same changes and use the same experiment settings as described in the previous section for W IKI T ABLE Q UESTIONS .
3. I MPLEMENTATION OF G RAPPA
For ﬁne-tuning RoBERTa, we modify the code of RoBERTa implemented by Wolf et al.
and follow the hyperparameters for ﬁne-tuning RoBERTa on RACE tasks and use batch size 24, learning rate 1 e -5, and the Adam optimizer Kingma & Ba (2014).
We ﬁne-tune G RAPPA for 300k steps on eight 16GB Nvidia V100 GPUs.
The pre-training procedure can be done in less than 10 hours.
For all downstream experiments using G RAPPA or RoBERTa, we always use a BERT speciﬁc optimizer to ﬁne-tune them with a learning rate of 1 e -5, while using a model-speciﬁc optimizer with the respective learning rate for the rest of the base models.
E XPERIMENTAL R ESULTS
We conducted experiments to answer the following two questions: 1) Can G RAPPA provide better representations for table semantic parsing tasks?
What is the beneﬁt of two pre-training objectives, namely MLM and SSP?
Since G RAPPA is initialized by RoBERTa, we answer the ﬁrst question by directly comparing the performance of base parser augmented with G RAPPA and RoBERTa on table semantic parsing tasks.
For the second question, we report the performance of G RAPPA trained with
MLM, SSP and also a variant with both of them (MLM+SSP).
Overall results We report results on the four aforementioned tasks in Tables 3, 4, 5, andrespectively.
Overall, base models augmented with G RAPPA signiﬁcantly outperforms the ones with RoBERTa by 3.7% on S PIDER , 1.8% on W IKI T ABLE Q UESTIONS , and 2.4% on weaklysup.
W IKI SQL, and achieve new state-of-the-art results across all four tasks.
In most cases, the combined objective of MLM+SSP helps G RAPPA achieve better performance when compared with independently using MLM and SSP.
Moreover, on the low-resource setting, G RAPPA outperforms
RoBERTa by 3.0% in fully-sup.
W IKI SQL and 3.9% in W IKI T ABLE Q UESTIONS .
Detailed results for each task are discussed as follows.
S PIDER
Results on S PIDER are shown in Table 3.
When augmented with G RAPPA , the model achieves signiﬁcantly better performance compared with the baselines using BERT and RoBERTa.
[Table] [Table]
Our best model, G RAPPA with MLM+SSP achieves the new state-of-the-art performance, surpassing previous one (RAT-SQL+BERT-large) by a margin of 4%.
Notably, most previous top systems use pre-trained contextual representations (e.g., BERT, TaBERT), indicating the importance of such representations for the cross-domain parsing task.
Fully sup. W IKI SQL
Results on W IKI SQL are shown in Table 4.
All G RAPPA models achieve nearly the same performance as RoBERTa.
We suspect it is the relatively large training size and easy
SQL pattern of W IKI SQL make the improvement hard, comparing to S PIDER .
Hence, we set up a low-resource setting where we only use 10k examples from the training data.
As shown in the bottom two lines of Table 4, G RAPPA improves the performance of the SQLova model by 3.0% compared to
RoBERTa, indicating that G RAPPA can make the base parser more sample-efﬁcient.
W IKI T ABLE Q UESTIONS
Results on W IKI T ABLE Q UESTIONS are shown in Table 5.
By using
RoBERTa and G RAPPA to encode question and column inputs, the performance of Wang et al.
(2019) can be boosted signiﬁcantly ( > 6%).
Compared with RoBERTa, our best model with
G RAPPA (MLM+SSP) can further improve the performance by 1.8%, leading to a new state-of-the-art performance on this task.
Similar to the low-resource experiments for W IKI SQL, we also show the performance of the model when trained with only 10% of the training data.
As shown at the bottom two lines Table 5, G RAPPA (MLM + SSP) obtains much better performance than RoBERTa, again showing its superiority of providing better representations.
Weakly sup. W IKI SQL
Results on weakly supervised W IKI SQL are shown in Table 6.
G RAPPA with MLM+SSP again achieves the best performance when compared with other baselines, obtain the new state-of-the-art results of 84.7% on this task.
It is worth noting that our best model here is also better than many models trained in the fully-supervised setting in Table 4.
This suggests that inductive biases injected in pre-trained representation of G RAPPA can signiﬁcantly help combat the issue of spurious programs introduced by learning from denotations Pasupat & Liang (2015);
Wang et al.
(2019) when gold programs are not available.
A NALYSIS Pre-training objectives
G RAPPA trained with both MLM and SSP loss consistently outperforms the one trained with one of them (MLM+SSP vs. MLM only or SSP only).
G RAPPA (MLM) usually improves the performance by around 1% such as 1.4% gain on S PIDER (dev), 0.8% on
W IKI T ABLE Q UESTIONS , and 1.2% on weakly-sup.
W IKI SQL.
By pre-training on the synthetic text-to-SQL examples, G RAPPA (SSP), we can see a similar performance gain on these tasks too except 3.9% improvement on S PIDER dev, which is what we expected (grammar is overﬁtted to
S PIDER ).
By pre-training with both MLM and SSP on the combined data, G RAPPA (MLM+SSP) consistently and signiﬁcantly outperforms the one pre-trained with MLM or SSP separately (e.g., about +2% on Spider, +1.5% on WikiTableQuestions, and +1.2% on weakly-sup WikiSQL.).
This contributes to our key argument in the paper: in order to effectively inject compositional inductive bias to LM, pre-training on synthetic data should be regularized properly (using SSP+MLM together instead of SSP or MLM only) in order to balance between preserving the original BERT encoding ability and injecting compositional inductive bias, otherwise, the improvements are not robust and limited (using SSP or MLM only).
Generalization As mentioned in Section 2.2, we design our SCFG solely based on S PIDER , and then sample from it to generate synthetic examples.
Despite the fact that G RAPPA pre-trained on such corpus is optimized to the S PIDER data distribution, which is very different from W IKI SQL and W IKI T ABLE Q UESTIONS , G RAPPA is still able to improve performance on the two datasets.
In particular, for W IKI T ABLE Q UESTIONS where the underlying distribution of programs (not necessarily in the form of SQL) are latent, G RAPPA can still help a parser generalize better, indicating G RAPPA can be beneﬁcial for general table understanding even though it is pre-trained on SQL speciﬁc semantics.
We believe that incorporating rules from a broader range of datasets (e.g. W IKI T ABLE Q UESTIONS ) would further improve the performance.
However, in this paper, we study rules from only the S PIDER dataset and test the effectiveness on other unseen datasets with different different underlying rules on purpose in order to show the generality of our method.
Even though G RAPPA is pre-trained on synthetic text-to-SQL data, the proposed pre-training method can also be applied to many other semantic parsing tasks with different formal programs (e.g., logic forms); and we also demonstrated the effectness of G RAPPA on non text-to-SQL tasks (weaklysupervised W IKI SQL and W IKI T ABLE Q UESTIONS where no programs are used, training is supervised by only answers/cell values) the underlying distribution of programs (not necessarily in the form of SQL) are latent.
Furthermore, to design the SCFG and synthesize data with the corresponding programs labeled, we can use any formal programs such as the logic form or SParQL, and then employ the data to pre-train GraPPa.
In this paper we choose SQL as the formal program to represent the formal representation of the questions simply because more semantic parsing datasets are labeled in SQL.
Pre-training time and data Our experiments on the S PIDER and W IKI T ABLE Q UESTIONS tasks show that longer pre-training doesn’t improve and can even hurt the performance of the pre-trained model.
This also indicates that synthetic data should be carefully used in order to balance between preserving the original BERT encoding ability and injecting compositional inductive bias.
The best result on S PIDER is achieved by using G RAPPA pre-trained for only 5 epochs on our relatively small pre-training dataset.
Compared to other recent pre-training methods for semantic parsing such as
TaBERT (Yin et al., 2020a) and TAPAS (Herzig et al., 2020a), G RAPPA achieves the state-of-the-art performance (incorporated with strong base systems) on the four representative table semantic parsing tasks in less 10 hours on only 8 16GB Nvidia V100 GPUs (6 days on more than 100 V100 GPUs and 3 days on 32 TPUs for TaBERT and TAPAS respectively)
Moreover, we encourage future work on studying how the size and quality of synthetic data would affect the end task performance.
Also,
G RAPPA (MLM+SSP) consistently outperforms other settings, which indicates that using MLM on the human annotated data is important.
Pre-training vs. training data augmentation Many recent work (Zhang et al., 2019b; Herzig et al., 2020b;
Campagna et al., 2020; Zhong et al., 2020) in semantic parsing and dialog state tracking show that training models on a combination of the extra synthetic data and original training data does not improve or even hurt the performance.
For example, (Zhong et al., 2020) synthesize data on training databases in several semantic parsing tasks including S PIDER , and ﬁnd that training with this data augmentation leads to overﬁtting on the synthetic data and decreases the performance.
In contrast, our pre-training approach could effectively utilize a large amount of synthesized data and improve downstream task performance.
Also, the base parser with a G RAPPA encoder could usually converge to a higher performance in shorter time (see Section A.1).
R ELATED W ORK
Textual-tabular data understanding Real-world data exist in both structured and unstructured forms.
Recently the ﬁeld has witnessed a surge of interest in joint textual-tabular data understanding problems, such as table semantic parsing (Zhong et al., 2017; Yu et al., 2018b), question answering (Pasupat & Liang, 2015; Chen et al., 2020), retrieval (Zhang et al., 2019a), fact-checking (Chen et al., 2019) and summarization (Parikh et al., 2020; Radev et al., 2020).
While most work focus on single tables, often obtained from the Web, some have extended modeling to more complex structures such as relational databases (Finegan-Dollak et al., 2018; Yu et al., 2018b; Wang et al., 2020).
All of these tasks can beneﬁt from better representation of the input text and different components of the table, and most importantly, an effective contextualization across the two modalities.
Our work aims at obtaining high-quality cross-modal representation via pre-training to potentially beneﬁt all downstream tasks.
Pre-training for NLP tasks
G RAPPA is inspired by recent advances in pre-training for text such as (Devlin et al., 2019; Liu et al., 2019; Lewis et al., 2020b;a; Guu et al., 2020).
Seminal work in this area shows that textual representation trained using conditional language modeling objectives signiﬁcantly improves performance on various downstream NLP tasks.
This triggered an exciting line of research work under the themes of (1) cross-modal pre-training that involves text (Lu et al., 2019; Peters et al., 2019; Yin et al., 2020a; Herzig et al., 2020a) and (2) pre-training architectures and objectives catering subsets of NLP tasks (Lewis et al., 2020b;a; Guu et al., 2020).
G RAPPA extends these two directions further.
The closest work to ours are TaBERT (Yin et al., 2020a) and
T A P AS (Herzig et al., 2020a).
Both are trained over millions of web tables and relevant but noisy textual context.
In comparison, G RAPPA is pre-trained with a novel training objective, over synthetic data plus a much smaller but cleaner collection of text-table datasets.
Data augmentation for semantic parsing Our work was inspired by existing work on data augmentation for semantic parsing (Berant & Liang, 2014;
Wang et al., 2015a; Jia & Liang, 2016; Iyer et al., 2017; Yu et al., 2018a).
Berant & Liang (2014) employed a rule-based approach to generate canonical natural language utterances given a logical form.
A paraphrasing model was then used to choose the canonical utterance that best paraphrases the input and to output the corresponding logical form.
In contrast, Jia & Liang (2016) used prior knowledge in structural regularities to induce an SCFG and then directly use the grammar to generate more training data, which resulted in a signiﬁcant improvement on the tasks.
Unlike these works which augment a relatively small number of data and use them directly in end task training, we synthesize a large number of texts with SQL logic grounding to each table cheaply and use them for pre-training.
C ONCLUSION AND F UTURE W ORK
In this paper, we proposed a novel and effective pre-training approach for table semantic parsing.
We developed a context-free grammar to automatically generate a large amount of question-SQL pairs.
Then, we introduced G RAPPA , which is an LM that is pre-trained on the synthetic examples with
SQL semantic loss.
We discovered that, in order to better leverage augmented data, it is important to add MLM loss on a small amount of table related utterances.
Results on four semantic parsing tasks demonstrated that G RAPPA signiﬁcantly outperforms RoBERTa.
While the pre-training method is surprisingly effective in its current form, we view these results primarily as an invitation for more future work in this direction.
For example, this work relies on a hand-crafted grammar which often generates unnatural questions; Further improvements are likely to be made by applying more sophisticated data augmentation techniques.
Also, it would be interesting to study the relative impact of the two objectives (MLM and SSP) by varying the respective number of pre-training examples.
Furthermore, pre-training might beneﬁt from synthesizing data from a more compositional grammar with a larger logical form coverage, and also from supervising by a more compositional semantic signals.
A A PPENDICES
[Table] [Table]
A. A DDITIONAL A NALYSIS
Training coverage As shown in Figure 2, on the challenging end text-to-SQL S PIDER task, RATSQL initialized with G RAPPA outperforms RAT-SQL using RoBERTa by about 14% in the early training stage.
This shows that G RAPPA already captures some semantic knowledge in pre-training.
Finally, G RAPPA is able to keep the competitive edge by 4%.
What if the task-speciﬁc training data is also used with the MLM or SSP objective in pretraining?
Although we did not do the same experiments, we would like to point to the RAT-SQL paper (Wang et al., 2020) for some suggestions.
They add a similar alignment loss (similar to SSP) on the S PIDER training data and found that it doesn’t make a statistically signiﬁcant difference (in
Appendix B).
[Figure] [Figure]