mRAT-SQL+GAP:A Portuguese Text-to-SQL Transformer
Paper · 2021 · Marcelo Archanjo José and Fabio Gagliardi Cozman
Summary
A database may contain the information someone needs even when that person has no way to write the SQL query that retrieves it. Text-to-SQL systems take a question in ordinary language and generate that query. Most of the systems and benchmarks discussed in this paper were developed for English. The authors ask what it takes to make a strong existing system, RAT-SQL+GAP, work with questions in Portuguese. They translate the questions in the Spider benchmark, keep the reference SQL and database schemas in place, and adapt the system to read and process Portuguese text.
The resulting system, mRAT-SQL+GAP, uses the multilingual transformer mBART-50 in place of the original English BART-large. The authors compare training on English questions, Portuguese questions, and both versions together. In the bilingual training set, an original question and its Portuguese translation lead to the same answer query. This gives the system more ways to encounter each request while preserving the database operation it has to learn. The authors evaluate the resulting checkpoints on the original English and translated Portuguese versions of Spider’s development split.
On Portuguese questions, mBART-50 reaches 0.588 with Portuguese-only training and 0.595 with bilingual training. These are overall scores for Exact Set Match without values, which checks whether the predicted SQL matches the reference structure while leaving out literal values such as a particular name. The Portuguese gain is concentrated in the easy category. On English questions, the same bilingual checkpoint reaches 0.664, up from 0.651 for mBART-50 trained only on English. The original English RAT-SQL+GAP baseline scores 0.718. The authors report that the bilingual checkpoint’s Portuguese score is 83% of that English baseline.
The paper’s examples show why the input language matters even when the target query stays fixed. A Portuguese word such as média has to be connected to the SQL operation AVG, and a title written in English may have to stay in English inside an otherwise Portuguese question. The experiments show that English training examples can help a multilingual system answer Portuguese questions under these conditions. They leave open how much of the gain comes from mixing languages and how much comes from increasing the amount of training data. The authors release mRAT-SQL+GAP, the translated data, a trained checkpoint, and their results.
Deep dive: mRAT-SQL+GAP:A Portuguese Text-to-SQL Transformer
mRAT-SQL+GAP adapts Spider and a multilingual transformer for Portuguese text-to-SQL and tests how bilingual training affects accuracy. · about 31 minutes to read
The problem and its context
Turning a question into a database operation
An ordinary question describes what someone wants to know. A SQL query specifies what a relational database has to do to find out. Moving between the two involves more than replacing words with keywords. The system must identify the tables that hold the relevant information, choose the columns that represent what the user asks for, and determine which operations to apply. If the information is distributed across tables, it also has to choose how to connect the records. Keys, which identify or relate records, can determine whether those connections give the intended result.
Consider a question about an average. The word average indicates an operation, but it leaves work to do. The query needs to specify which quantity to average, which records enter the calculation, and whether the result should be grouped by anything. The names of the relevant tables and columns come from the particular database. A schema describes that organization. It gives the system a set of candidate identifiers and relationships against which to interpret the question. A word in the input can point to a column in one database and a table in another, or it can describe a calculation with no direct counterpart among the names.
The paper treats this translation as a problem in semantic parsing, the conversion of language into a structured representation of its meaning. Here the structured output is SQL. The authors show a full route from the question through SQL to returned data, but their experiments evaluate the step that generates the query. That step is already substantial. For a question spanning several tables, a plausible query can contain the right vocabulary and still select the wrong records or compute a different quantity.
There is also a difference between the language used to ask the question and the conventions of the environment that answers it. In the paper’s setup, the SQL syntax and the schema identifiers stay the same when the user question moves from English to Portuguese. A person can ask naturally in Portuguese while the appropriate query still refers to English table and column names. This produces a task in which understanding a Portuguese phrase and finding its counterpart in the database are closely related but distinguishable requirements.
How the paper situates earlier systems
The authors describe an established field with rule-based, supervised, and hybrid approaches. In the rule-based family, the system interprets entities or expressions in the question using rules, often passing through an intermediate form on the way to SQL. An intermediate form gives the system a place to represent what it has recognized before committing to database syntax. The paper identifies SODA and NaLIR as examples of this broad approach. It also describes hybrid systems that combine entity-based interpretation with learned components.
In the supervised approach, the training data provide a natural-language question paired with the SQL query that should answer it. The pair demonstrates how the system is expected to express the request in a particular database. With enough examples, a learner can use recurring patterns in the questions and SQL to make predictions for other requests. The paper traces the use of this approach across several generations of systems and describes deep learning as the dominant branch of the learned approaches it surveys. Its own study takes an existing supervised system and changes the language resources with which that system works.
RAT-SQL is the starting point. The paper describes it as a parser built around relation-aware encoding and schema linking. In practical terms, schema linking is the part of understanding a question that associates its phrases with items such as table or column names. Relation-aware processing is relevant because database items occur in a structure. Columns belong to tables, and information requested across tables needs to be combined through meaningful relationships. The authors retain RAT-SQL as the basis for generating SQL during the language adaptation.
RAT-SQL+GAP adds Generation-Augmented Pre-training, or GAP, to that system. GAP uses generated examples to enlarge the material available during pretraining, and the paper identifies BART-large as the English starting point for the combined system. This history matters because the new paper uses another kind of augmentation as well. The original GAP stage supplies synthetic material for pretraining. The bilingual experiment expands the supervised fine-tuning data by bringing corresponding English and Portuguese questions together. The two changes operate at different stages and produce different kinds of additional input.
Why Spider and Portuguese go together in this study
The authors describe Spider as a widely used benchmark with 200 databases spanning 138 domains. Its databases contain multiple tables, and its questions allow evaluation of more involved SQL, including queries with nested operations. A collection with many schemas makes it possible to study how a parser connects wording to different database structures. It also gives the researchers a common point of comparison with systems already evaluated on the benchmark. The paper chooses RAT-SQL+GAP as a competitive implementation for which the authors could consult a paper and obtain code.
A benchmark constructed around English can reward some useful coincidences between question wording and database naming. When a request mentions a singer and the schema uses an English identifier for singers, the input may give a visible clue to the corresponding schema item. That clue can weaken when the request uses cantor or cantores and the schema retains its English names. The underlying request can remain entirely clear to a Portuguese speaker. The change is in how the system has to connect the phrase to the target representation.
The authors cite earlier Portuguese work by Silva and colleagues that places machine translation in front of an English text-to-SQL system. Under that design, the incoming Portuguese question is translated into English before the parser sees it. The present paper uses translation at a different point. It translates benchmark questions to create training and evaluation data, then adapts a parser to accept Portuguese questions directly. That choice makes the training language itself an experimental variable.
Keeping Spider’s SQL in place makes the adaptation easier to interpret. A Portuguese question and its English counterpart are intended to request the same database operation. Both can therefore be assessed against the same target query over the same schema. The design puts the language change on the input side and preserves the established benchmark task on the output side. It also defines the scope of the investigation. The paper studies Portuguese questions derived from Spider in an existing database environment, a setting that allows controlled comparisons between question languages.
The method, step by step
Start with a complete question and its reference query
The easiest way to understand the data procedure is to follow a single Spider entry. The entry contains a question, an associated database, and a reference SQL query. The question expresses the user’s request. The database determines what table and column names mean in context. The SQL query records what the system is expected to generate. The authors change the language of the question while preserving its connection to the database and reference query.
This arrangement gives the translated question a ready-made target. If the Portuguese version still asks for the same operation, the existing SQL remains a valid training example and an appropriate reference at evaluation time. A translation that changes a qualification, an entity, or an aggregation can break that relationship. Translation quality therefore matters in a specific sense. The Portuguese sentence needs to preserve the request precisely enough that the retained SQL still answers it.
The authors extract the questions from train_spider.json, train_others.json, and dev.json. They send the question text to the Google Cloud Translation API and keep track of the correspondence between the original and translated entries. The first two files supply training material. The last file provides the questions used for local evaluation. Throughout, the SQL stays associated with the question it was originally written to answer.
Preparing and evaluating mRAT-SQL+GAP
The steps in order.
Review the translation against the intended operation
The authors use different file formats for different parts of the data work. A text file holds the translated questions for review. A CSV file brings together the original wording, the Portuguese wording, and the SQL, so that a reviewer can consult the corresponding request and reference. After revision, a JSON file returns the translated questions to the structured format required by the benchmark pipeline.
The SQL provides a useful check during revision because a natural sentence can be fluent while asking a subtly different question. For instance, a change in what is being counted would alter what ought to appear in the query even if the translated sentence was grammatical. The reviewer can use the source question to check what was asked and the SQL to see how the benchmark resolved that request. The paper describes this review process and illustrates the translated entries with examples.
A database value can legitimately remain in English. The paper uses the team name Boston Red Stockings to illustrate the point. A Portuguese speaker can ask for the average salary of players on that team while using the team’s original name. The surrounding words carry the request for an average and identify the relevant people. The name identifies the team. Translating the name as ordinary descriptive text could change the entity to which the question refers.
This is a different issue from keeping the SQL vocabulary fixed. English words can occur in the input because they belong to the name of something in the database. They can occur in the output because they are part of SQL or are used as schema identifiers. The Portuguese data need to preserve the English text where it has that referential role. The decoder also has to produce the fixed output vocabulary when it is required. The two requirements explain why a Portuguese question set can contain meaningful cross-language connections even when every instruction in the question has been translated.
Preserve the characters and prepare the words
The data have to survive the path from translation to training. The authors use UTF-8 when reading and writing the translated files so that Portuguese characters are preserved. They also modify the original Python implementation’s file handling, including operations that open files and write JSON. A check of the adapted system verifies that the characters used in Portuguese reach the processed data intact.
The character check comes before any interpretation of training results. If an accented word changes during file handling, later components receive a different input from the one the reviewers approved. In this experiment, where the question language is one of the main variables, such changes would introduce an avoidable difference between the English and Portuguese conditions. The encoding work lets the authors attribute what happens downstream to the text they intended to use.
The authors also encounter problems with lemmatization in the processed files. Lemmatization assigns an inflected form to a base form, as when a plural noun is grouped with its singular counterpart. The original pipeline used Stanford CoreNLP for that step. The paper reports that the relevant tool lacked Portuguese support, so the authors replace it with Simplemma, which supports both Portuguese and English.
Lemmatization and multilingual pretraining address different aspects of the task. Lemmatization can bring inflected forms of the same word into alignment within a language. Connecting a Portuguese word to an English schema name requires an additional correspondence. For instance, recognition of a Portuguese plural helps establish which Portuguese word is involved, while the link from that word to an English database identifier still has to be made elsewhere in the system. The preprocessing change makes Portuguese input usable without, by itself, supplying those cross-language links.
Adapt the pretrained component while retaining the SQL task
RAT-SQL+GAP originally uses BART-large, which the authors describe as pretrained for English. Pretraining supplies a starting checkpoint before the system is specialized for the benchmark. In fine-tuning, that starting point is further trained using the task examples. Here those examples pair questions with SQL queries. The task supplies a narrower objective than general language pretraining because a question has to be mapped to a query that uses the database’s vocabulary and structure.
The authors choose mBART-50 as the main replacement because it covers English and Portuguese. They describe it as a multilingual sequence-to-sequence system. At this level of the method, sequence-to-sequence means that an input sequence is used to produce an output sequence. Within the adapted RAT-SQL+GAP system, the supervised input is a question associated with a database, and the required output remains SQL. The choice of a multilingual starting point makes it possible to use the same pretrained component for the different training-language conditions.
The paper also evaluates BERTimbau-base, which is pretrained for Portuguese. The authors have a reason to consider a BERT variant because the earlier RAT-SQL system had been used with BERT. This experiment asks whether a Portuguese-specific starting point provides a useful route into Portuguese text-to-SQL. The comparison with BART-based settings changes the pretrained family as well as language coverage. It consequently answers a question about the tested configurations rather than isolating a single property of pretraining.
The paper gives the adaptation at the level of the retained system, the replacement checkpoints, the preprocessing changes, and the language choices for training and inference. Its method has no mathematical formula to reproduce. The experimental variables are concrete choices about which questions the system sees, what starting point it uses, and which held-out questions it is asked to answer.
Build the training conditions from corresponding examples
The original training set has 8,659 questions. Of these, 7,000 are in train_spider.json and 1,659 are in train_others.json. The authors can use those questions as written, use their Portuguese counterparts, or include both versions. In all cases the questions remain paired with their assigned SQL. The bilingual set is described as double-size because it brings together the original and translated versions of the training questions.
The English-only and Portuguese-only sets therefore differ in question wording while following the same underlying pool of tasks. A Portuguese-only entry provides Portuguese evidence about how to express a request and the same SQL supervision as the corresponding English entry. The bilingual set exposes the system to both expressions. A training example for a particular average, count, or filter can appear in either language, with the same target query showing how to carry out that operation.
This is an increase in the amount of language data and a change in its composition. The combined set contains extra question formulations for the same benchmark items. The method preserves the underlying database operations rather than extending the pool with more independently written SQL tasks. Seeing different words paired with the same answer query can help explain why a shared checkpoint might handle both kinds of input, although the procedure alone does not reveal how the checkpoint represents that relationship.
The authors fine-tune mBART-50 in each of the three conditions. For the English-only checkpoint, the reported evaluation uses English questions. For the Portuguese-only checkpoint, it uses Portuguese questions. The bilingual checkpoint is used for English inference, Portuguese inference, and inference over both editions of the development set together. Here inference means applying a trained checkpoint to questions to produce predictions. The same bilingual checkpoint provides the predictions in all of those evaluation conditions.
Generate and score SQL with the reference kept in place
At evaluation time the adapted system predicts a query for a question about its assigned database. The authors use Spider’s evaluation software to compare predicted SQL and reference SQL, supplied in separate files. Since the reference was preserved through translation, a language change in the question does not require a corresponding Portuguese version of the target query. The parser has to express the requested operation in the same SQL and schema vocabulary in either case.
For the primary evaluation, Exact Set Match without values, the comparison concerns query structure with literal values removed from consideration. A query can specify a filter on a city column while the particular city name is represented by the placeholder terminal. What counts toward the reported result is whether the query includes the correct parts and expresses the intended structure under the scorer’s treatment of values. The placeholder does not turn the question into a different task for the reader. It marks a part of the task that the reported score sets aside.
The separation is important for understanding what the method demonstrates. A title can remain in the Portuguese input and still be useful evidence for choosing a filter, even when the system gets no credit for producing the title itself in the query. The score can therefore reflect whether the system interprets a phrase as a value associated with a particular condition, while leaving the faithful transfer of that value unmeasured. The paper’s qualitative examples return to this distinction.
Experiments and results
The development split and the meaning of a match
The local evaluation uses the 1,034 questions in dev.json. The paper calls them test questions because the authors use them to test their trained checkpoints. In Spider terminology, the file belongs to the development split, which the paper labels Dev. The official Spider leaderboard Test result has a separate meaning. All of the local language comparisons concern Dev, whether the questions are written in the original English, translated into Portuguese, or drawn from both versions.
The training and evaluation choices serve different purposes. Joining the training sets gives a checkpoint access to a larger collection with both languages. Joining the evaluation sets changes the collection over which its score is measured. Bilingual training can be assessed on the original English questions alone or on the matching Portuguese questions alone. These separate evaluations let the paper ask whether a combined training set helps when the intended users ask questions in only one of those languages.
The paper reports overall Exact Set Match without values and discusses results across Spider’s easy, medium, hard, and extra hard categories. These categories characterize the SQL queries. They make it possible to ask, for example, whether a higher overall score accompanies better performance on more elaborate query structures. They provide no separate rating of how natural, difficult, or clear the Portuguese wording is. A translated sentence and its source can differ considerably in how directly their words point to the schema, even though their shared reference SQL places them in the same difficulty category.
Overall Exact Set Match gives a strict structural comparison for each prediction. A query whose main operation is right can still lose the match if another part disagrees with the reference. This is why a change in the score has to be read in light of the scoring rule. The result indicates how frequently the full assessed structure matches. It gives less information about near misses, and literal values lie outside this particular version of the metric.
The original English system as a baseline
The authors first run RAT-SQL+GAP with the original English questions and BART-large. This local setup achieves 0.718 overall on Spider Dev for Exact Set Match without values. It reproduces the Dev value reported for the original system. Reproduction matters because the adaptation changes both the data and parts of the software. The English result gives the authors a check that their evaluation can reproduce a published score before they interpret the effects of those changes.
In its leaderboard discussion, the paper gives RAT-SQL+GAP an official Test score of 0.697 on the same metric. It also describes a higher leaderboard entry, LGESQL, with Dev at 0.751 and Test at 0.720. These are the standings the authors describe for August 2021. They provide context for the choice of a well-performing, accessible baseline. The 0.718 Dev reproduction supplies the actual reference value for the article’s local comparisons.
There are two roles for comparison within the experimental design. The original BART-large system establishes how the source system performs in the English environment it was built for. The monolingual mBART-50 settings establish how the multilingual replacement performs under matched training and evaluation languages. The latter settings are the direct comparisons for asking whether to use both training editions. A comparison to the original baseline places the adapted system in context, while a comparison within mBART-50 better holds the pretrained component fixed.
Portuguese training and Portuguese evaluation
The Portuguese-specific BERTimbau-base configuration reaches 0,417 overall on Portuguese Spider Dev for Exact Set Match without values. The authors view the result in light of several differences, including the change from the BART family to BERT and the presence of English vocabulary in examples intended for Portuguese training. The configuration establishes a point of comparison for an adaptation built around a Portuguese-pretrained starting point.
mBART-50 reaches 0.588 overall when fine-tuned on Portuguese questions and tested on the translated Dev set. With English and Portuguese questions together in fine-tuning, it reaches 0.595 overall on that same Portuguese evaluation set. This is the principal result for the task that motivated the paper. It shows a higher reported overall score after the addition of the corresponding English material, with the pretrained component and the evaluation questions held fixed.
Portuguese Spider Dev overall Exact Set Match without values
Bilingual fine-tuning gives mBART-50 the highest overall score on Portuguese questions among the tested settings.
The numbers
| System or setting | Exact Set Match |
|---|---|
| BERTimbau-base, Portuguese training | 0,417 |
| mBART-50, Portuguese training | 0.588 |
| mRAT-SQL+GAP with mBART-50, bilingual training (this paper) | 0.595 |
The overall increase on the Portuguese split has a particular distribution. In the authors’ comparison between Portuguese-only and bilingual mBART-50 training, improvement is confined to the easy category. The reported evidence therefore supports an overall benefit on the translated Dev set with a narrower benefit across SQL difficulty categories. A reader mainly interested in complex queries should give that distinction as much weight as the overall score.
The authors express 0.595 as 83% of the English baseline score of 0.718. The percentage describes the Portuguese configuration’s score relative to the original English configuration’s score. The Portuguese Exact Set Match value itself is 0.595. The distinction matters because the relative figure uses a reference from another question language and another pretrained starting point.
English evaluation of the multilingual checkpoint
mBART-50 fine-tuned only on English reaches 0.651 overall for Exact Set Match without values on the original English Dev set. Adding the Portuguese counterparts during fine-tuning brings that result to 0.664 on the same evaluation questions. The paper reports that the bilingual setting improves the English results across all the SQL difficulty categories. This gives the English comparison a different profile from the one on Portuguese.
English Spider Dev overall Exact Set Match without values
Bilingual training improves mBART-50 on English questions, with the original English system retaining the highest score.
The numbers
| System or setting | Exact Set Match |
|---|---|
| Original RAT-SQL+GAP with BART-large, English training | 0.718 |
| mBART-50, English training | 0.651 |
| mRAT-SQL+GAP with mBART-50, bilingual training (this paper) | 0.664 |
The authors describe 0.664 as 92% of the original English score of 0.718. Here both evaluations use the original English Dev questions, but the pretrained components and fine-tuning arrangements differ. The bilingual checkpoint serves both languages and improves on English-only fine-tuning of mBART-50. The original BART-large setup supplies the stronger reported English reference. That reference helps quantify how much English performance the adapted system retains in the paper’s experiments.
Because the Portuguese and English results from bilingual training come from the same checkpoint, they also give a view of how a single trained system handles corresponding forms of the request. The overall English score is 0.664, and the overall Portuguese score is 0.595. Different underlying databases across the two evaluations cannot explain this comparison because the translated set retains the benchmark entries and their queries. The wording and its interaction with the shared system remain central to interpreting the gap.
Evaluating both editions together
The authors also run the bilingual checkpoint over a combined English and Portuguese Dev set. In this evaluation, an original question and its translation occur as separate inputs with corresponding reference queries. The setup tests the checkpoint on a collection containing both input languages. The paper describes it as an uncommon evaluation set and characterizes the result favorably.
The authors caution against comparing this result directly with scores on either language alone. An overall mixed-set score concerns performance on a different collection. The language-specific evaluations make it easier to see which language contributes which successes and where differences in query complexity appear. The original English baseline gives a benchmark for the English set. The Portuguese set establishes a baseline for the translated benchmark. The mixed set addresses use of a shared checkpoint across both types of input.
Taken together, the experiments show why the training and evaluation languages have to accompany every score. The best locally reproduced source-system score, the best Portuguese result, and the best English result from bilingual fine-tuning refer to different configurations. A headline value without that context would leave out the principal experimental finding. The authors are examining how the composition of the training data changes performance within a multilingual adaptation, while also measuring how the adaptation compares with the English system that motivated it.
What the ablations show
What changes when a language is added
The paper offers comparisons across training sets and pretrained components, together with a closer look at successful and unsuccessful predictions. It does not report an ablation that removes each preprocessing or architectural change in turn. The closest controlled comparison is between mBART-50 fine-tuned on one language and mBART-50 fine-tuned on both, measured separately on a fixed evaluation language.
On English Dev, the English-only and bilingual checkpoints share the same pretrained starting point and answer the same English questions. The difference under study is the addition of Portuguese counterparts during fine-tuning. The higher overall score and improvement across all difficulty categories show that the extra Portuguese material is compatible with better English performance in this setting. That extends the result beyond the immediate goal of making Portuguese input possible. Fine-tuning with both languages helps the adapted system even when its evaluation inputs are all English.
On Portuguese Dev, the comparison puts the Portuguese-only checkpoint against the bilingual one. The additional inputs are English versions of the questions, and the evaluation stays in Portuguese. The overall result goes up, with the improvement concentrated in the easy category. This helps separate the question “Does the overall score increase?” from “Does the system improve throughout the benchmark?” The former receives a positive result in both languages. The evidence for the latter is broader in English.
The comparisons combine two changes. They increase the amount of training material and add a language. Accordingly, the experiments establish the effect of the combined training recipe as implemented. They cannot apportion its benefit between more examples and cross-language variation. A controlled comparison at the same training size would address a narrower claim. For example, a size-matched collection of same-language reformulations would make it easier to examine whether the advantage depends on the second language specifically. The paper’s bilingual condition gives the practical comparison available from the two parallel versions of Spider.
What the successful examples reveal about schema linking
The authors inspect a question that the bilingual checkpoint handles successfully in English and Portuguese. In the English question, song, names, singers, and average are close to the terms used in the generated SQL. In the Portuguese version, músicas, nomes, cantores, and média have to be associated with song, name, singer, and avg. The words point to different kinds of SQL material. Some indicate items defined by the schema, while média indicates a calculation.
This example shows the importance of distinguishing meaning from surface overlap. An English word in the question can provide a direct clue through its resemblance to a column, a table, or an operator. A Portuguese expression can specify the same intent while offering a weaker spelling clue to the fixed SQL vocabulary. The successful prediction shows that the adapted system can bridge these differences for the illustrated request. A single success cannot establish how frequently it resolves each kind of correspondence or whether one kind accounts for a larger share of errors.
The authors suggest that greater surface similarity between English questions and their SQL helps explain why the bilingual checkpoint performs better in English. That explanation is consistent with the illustrated predictions. The experiment measures the aggregate effect of presenting the same benchmark requests in another language. It does not quantify the contribution of lexical overlap separately from wording changes introduced during translation. The example makes the proposed mechanism visible without measuring its prevalence.
What a retained title requires of the system
A second example concerns the show title The Rise of the Blue Beetle. The Portuguese question retains the title in English because it refers to a particular show. The rest of the question can be interpreted as Portuguese while the title serves as a database value. A successful system has to use the wording around the title to work out how that value figures in the request. Merely recognizing that a stretch of text is in English gives little guidance about the column or condition involved.
The paper reports a successful structural match for this request from both the Portuguese-only and bilingual mBART-50 checkpoints. The title is replaced by terminal in the predicted SQL under the treatment used for this evaluation. The input still includes the English title. The success shows that both configurations recovered the assessed query structure from the mixed-language question. The example cannot distinguish their ability to produce the actual title as a SQL literal because the metric does not test that ability.
The case also refines what Portuguese-only training means in this paper. It describes the language of the question set. The set can include names in English, and the questions still lead to SQL expressed using the original vocabulary and schema. The monolingual and bilingual training labels are useful for identifying the source of the question formulations. They should be read alongside these continuing cross-language demands on the parser.
What the failed queries can tell a reader
The authors show a sample of predictions from the bilingual checkpoint on Portuguese Dev that fail Exact Set Match. They observe that these predictions still resemble meaningful SQL. Diagnosing the specific mistake may require knowing the schema. A query can plausibly select a column or connect tables while making a different choice from the one required by the question. Its vocabulary can look appropriate even when the resulting structure is wrong.
This qualitative observation helps explain the severity of the metric’s all-or-nothing judgment. A failed match can accompany behavior that is much closer to the intended query than an arbitrary sequence of words would be. At the same time, grammatical or plausible SQL is weak evidence that the intended operation has been recovered. The same schema that makes a prediction look plausible can reveal why it is incorrect. Inspecting the question, schema, prediction, and reference together gives more information about the error than reading the predicted SQL alone.
The authors say their manual inspection found similarly plausible failures in other tested configurations. They present examples rather than counts by error type. The inspection shows why close analysis of individual queries can matter and why the headline score cannot serve as a taxonomy of failures. It leaves questions about the prevalence of incorrect joins, selections, or operations unanswered.
The comparisons across pretrained components have a similar limit. The stronger Portuguese results from mBART-50 establish that the particular multilingual BART-based settings perform better than the BERTimbau-base setting tested here. BERTimbau differs from those settings in more than language coverage. The comparison is therefore evidence about configurations a researcher might try in this pipeline, while the cause of the performance ordering remains open. This distinction motivates the authors’ interest in trying BERTimbau-large and other multilingual starting points.
Limitations
Limits and open questions identified by the authors
The authors acknowledge that the bilingual improvement on Portuguese Dev is concentrated in easy queries. This qualification matters for the paper’s aim because Spider is valued in part for its elaborate queries. The overall Portuguese result establishes a baseline on a broad translated collection. The difficulty breakdown gives a more specific account of where adding English examples improved the measured result.
They also identify an asymmetry between the two input languages. English questions often resemble the words used in SQL or in database identifiers. Portuguese questions can require a mapping across languages where the English edition offers a more direct lexical clue. Additionally, names left in the source language can occur within Portuguese requests. The authors point out that English identifiers can also occur in databases with Portuguese content in Brazil. This is part of their rationale for a multilingual approach in practice, though the experiment itself evaluates the Spider environment.
The paper treats the combined-language evaluation as a distinct setting and cautions against comparing it directly with a single-language score. The authors therefore give different roles to their English, Portuguese, and mixed evaluations. The English and Portuguese splits support matched language-specific comparisons of training recipes. The combined evaluation shows the behavior of the same checkpoint on a collection containing both editions.
The authors propose trying other multilingual transformers and possibly other sequence-to-sequence approaches. They also single out BERTimbau-large as a way to investigate the role of the pretrained component’s size, and they suggest translating Spider into further languages. These are questions left for future work. The conclusions about bilingual training are supported by the English and Portuguese experiments included in the paper.
Limits that follow from the benchmark design
The Portuguese questions originate in a translation and revision process. That gives the study valuable alignment: the questions in both languages can be traced to the same database task. It also means that the evaluated Portuguese wording is shaped by the original Spider questions, the translation system, and the review process. The experiment does not include a separate benchmark in which users formulate their requests in Portuguese independently. How well the checkpoint handles patterns of phrasing that arise in such a collection remains open.
A reader should distinguish the language of the question from the language of the rest of the database environment. The paper keeps SQL, schema identifiers, and the original reference structure fixed. This is well suited to measuring the effect of changing the question language. A deployment with different naming practices, independently designed databases, or values recorded differently would pose additional questions about how the trained system transfers. The authors’ observation about English identifiers in Brazil makes the evaluated setup relevant to a plausible case, without specifying how common each deployment condition is.
The bilingual training set expands an existing collection through corresponding translations. It increases language variety and the amount of supervision in the same experimental step. An advantage over single-language fine-tuning can therefore arise from additional exposures to the same SQL targets, from seeing those targets expressed in another language, or from both. The paper measures the combined change. It supplies no size-matched monolingual treatment to identify the effect of language composition independently.
Likewise, the English-to-Portuguese comparison with the bilingual checkpoint is aligned at the level of benchmark items, but differences between the language versions can have several immediate causes. Word choice, the closeness of expressions to schema names, and the phrasing produced by translation can all affect predictions. The qualitative examples show particular correspondences. The experiment does not assign separate parts of the aggregate gap to these causes. This limits how directly the score can be generalized into a claim about an intrinsic difficulty of either language.
Limits of the reported outcome
The central result is a structural match score with literal values omitted. A system intended to return database results generally has to recover those values as well. If a user asks about a particular show or city, the query must use the correct value to retrieve the relevant records. A structurally correct query with a placeholder demonstrates progress towards that goal. Accuracy on value recovery and correctness of the resulting answers remain unmeasured in the reported scores.
The use of a reference structure also sets the scope of the error analysis. The evidence shows whether predictions satisfy Spider’s comparison under the selected metric. It does not classify every structural mismatch by how much it changes the result a user would receive. A manual example can illustrate why a prediction failed or why it was plausible. Establishing which failures are most common would require a counted analysis across cases.
The local results concern the Spider development split. The official Test figures discussed in the paper belong to the leaderboard context for earlier systems. The paper’s translated Dev result can be used as a comparison point for the same Portuguese benchmark and evaluation procedure. Generalization to a separate Portuguese test collection would require another evaluation. Keeping those scopes clear also prevents the reported 83% of the English baseline from being read as a score on an official Portuguese test set.
Finally, the paper reports checkpoint results rather than a distribution across repeated training runs. The observed overall increases are comparisons between the reported settings. Their stability across repeated runs is unquantified. The reproducing run for the original English setup supports the credibility of the evaluation procedure, while leaving variation in the bilingual fine-tuning comparisons as an open question.
What came after
The later papers that cite mRAT-SQL+GAP revisit the problem of moving text-to-SQL beyond its English center of gravity. Their titles establish work on Arabic text-to-SQL, Arabic prompting in context-dependent settings, Brazilian Portuguese, and direct comparisons between English and Portuguese. Citations connect those topics to the earlier adaptation. The specific data, training procedures, and results of the later papers require evidence beyond their titles and citing relationship.
Arabic text-to-SQL
Ar-Spider: Text-to-SQL in Arabic takes up the explicitly Spider-linked question of Arabic text-to-SQL. Its subject is closest to the earlier paper’s choice to approach a new question language through an established benchmark. In the Portuguese study, adapting Spider meant translating question wording while preserving the associated SQL tasks. Ar-Spider’s title places Arabic and Spider together in the same research problem. The citation gives a connection between the projects without establishing which of the earlier translation or review procedures the Arabic work used. Ar-Spider: Text-to-SQL in Arabic
AraSpider: Democratizing Arabic-to-SQL addresses Arabic-to-SQL with an explicit emphasis on access. That emphasis connects to the practical reason for the Portuguese adaptation. Users benefit from being able to ask questions in a language they use, while the system still has to produce SQL for the database. The earlier paper demonstrates a way to investigate this issue by holding the answer query in place while changing the question language. AraSpider is another citing work addressing access to SQL through Arabic. Its title gives the direction of the effort, with the method and findings left to the paper itself. AraSpider: Democratizing Arabic-to-SQL
Prompt Engineering Techniques for Context-dependent Text-to-SQL in Arabic puts different variables in the foreground. It names prompting as its approach and identifies context-dependent requests as its task. This brings together a question language and the question of what context is needed to interpret a request. The Portuguese study principally varies the language composition of supervised fine-tuning and evaluates the resulting checkpoints on Spider questions. The later title documents a related line of inquiry in which the prompted input and its context receive attention. Whether the Arabic study imports a bilingual training recipe or relies on the Portuguese work for comparison cannot be determined from the citation alone. Prompt Engineering Techniques for Context-dependent Text-to-SQL in Arabic
Returning to Portuguese and comparing languages
The Castañeda paper is identified with Brazilian Portuguese. Its citation gives a continuation on the Portuguese side alongside work that took the access problem into Arabic. In mRAT-SQL+GAP, Portuguese was the motivating input language, and the authors discussed the practical coexistence of Portuguese questions with English database identifiers. The connection to the Castañeda paper is at the level of that language focus. The citation leaves open which text-to-SQL data or procedures, if any, it carried over from the earlier work. Castañeda’s paper on Brazilian Portuguese
Language Effects in Text-to-SQL Across English and Portuguese makes the pair studied by mRAT-SQL+GAP the explicit subject of comparison. The earlier work used parallel questions to evaluate both languages with a shared checkpoint and identified different results overall and by query difficulty. The later title turns that relation into a larger research question about language effects. The citation establishes the connection, while the title gives no basis for attributing particular datasets, measurements, or conclusions to the later study. Language Effects in Text-to-SQL Across English and Portuguese
The continuation visible across these works is a set of related questions about benchmark language, input context, and evaluation across languages. mRAT-SQL+GAP contributes a concrete comparison in which translated wording and shared SQL make performance differences observable. The Arabic works extend the subject to another question language, and the English–Portuguese comparison keeps attention on the fact that the language chosen for an evaluation can change the measured outcome.
Cite
Cite as Marcelo Archanjo José and Fabio Gagliardi Cozman. 2021. mRAT-SQL+GAP:A Portuguese Text-to-SQL Transformer. arXiv:2110.03546.
@misc{jose2021mrat,
title = {{mRAT-SQL+GAP:A Portuguese Text-to-SQL Transformer}},
author = {Marcelo Archanjo Jos'e and Fabio Gagliardi Cozman},
year = {2021},
doi = {10.1007/978-3-030-91699-2\_35},
eprint = {2110.03546},
archivePrefix = {arXiv},
url = {https://doi.org/10.1007/978-3-030-91699-2_35}
}This page in Markdown https://md.research.elamur.ai/free/en/papers/e-2021-mrat-sql-gap-portuguese-text/
References
- Kim, H., So, B.H., Han, W.S., Lee, H.: Natural language to SQL: Where are we today? Proc. VLDB Endow. 13, 1737–1750 (2020). OpenAlex ↗ · Scholar ↗
- Affolter, K., Stockinger, K., Bernstein, A.: A comparative survey of recent natural language interfaces for databases. VLDB J. 28, 793–819 (2019). OpenAlex ↗ · Scholar ↗
- Ozcan, F., Quamar, A., Sen, J., Lei, C., Efthymiou, V.: State of the Art and Open Challenges in Natural Language Interfaces to Data. Proc. ACM SIGMOD Int. Conf. Manag. Data. 2629–2636 (2020). OpenAlex ↗ · Scholar ↗
- Walter, S., Unger, C., Cimiano, P., Bär, D.: Evaluation of a layered approach to question answering over linked data. Lect. Notes Comput. Sci. (including Subser. Lect. Notes Artif. Intell. Lect. Notes Bioinformatics). 7650 LNCS, 362–374 (2012). OpenAlex ↗ · Scholar ↗
- Blunschi, L., Jossen, C., Kossmann, D., Mori, M., Stockinger, K.: SODA: Generating SQL for business users. Proc. VLDB Endow. 5, 932–943 (2012). OpenAlex ↗ · Scholar ↗
- Li, F., Jagadish, H. V: Constructing an interactive natural language interface for relational databases. Proc. VLDB Endow. 8, 73–84 (2014). OpenAlex ↗ · Scholar ↗
- Li, F., Jagadish, H. V.: NaLIR: An Interactive Natural Language Interface for Querying Relational Databases. In: Proceedings of the 2014 ACM SIGMOD International Conference on Management of Data. pp. 709–712. ACM, New York, NY, USA (2014). OpenAlex ↗ · Scholar ↗
- Li, F., Jagadish, H. V.: Understanding Natural Language Queries over Relational Databases. ACM SIGMOD Rec. 45, 6–13 (2016). OpenAlex ↗ · Scholar ↗
- Song, D., Schilder, F., Smiley, C., Brew, C., Zielund, T., Bretz, H., Martin, R., Dale, C., Duprey, J., Miller, T., Harrison, J.: TR discover: A natural language interface for querying and analyzing interlinked datasets. Lect. Notes Comput. Sci. (including Subser. Lect. Notes Artif. Intell. Lect. Notes Bioinformatics). 9367, 21–37 (2015). OpenAlex ↗ · Scholar ↗
- Saha, D., Floratou, A., Sankaranarayanan, K., Minhas, U.F., Mittal, A.R., Özcan, F.: ATHENA: An Ontology-Driven System for Natural Language Querying over Relational Data Stores. Proc. VLDB Endow. 9, 1209–1220 (2016). OpenAlex ↗ · Scholar ↗
- Lei, C., Özcan, F., Quamar, A., Mittal, A.R., Sen, J., Saha, D., Sankaranarayanan, K.: Ontology-Based Natural Language Query Interfaces for Data Exploration. IEEE Data Eng. Bull. 41, 52–63 (2018). OpenAlex ↗ · Scholar ↗
- Sen, J., Lei, C., Quamar, A., Özcan, F., Efthymiou, V., Dalmia, A., Stager, G., Mittal, A., Saha, D., Sankaranarayanan, K.: ATHENA++: natural language querying for complex nested SQL queries. Proc. VLDB Endow. 13, 2747–2759 (2020). OpenAlex ↗ · Scholar ↗
- Baik, C., Arbor, A., Arbor, A., Arbor, A., Jagadish, H. V: Constructing Expressive Relational Queries with Dual-Specification Synthesis. 10th Annu. Conf. Innov. Data Syst. Res. (CIDR ‘20). (2020). OpenAlex ↗ · Scholar ↗
- Baik, C., Jin, Z., Cafarella, M., Jagadish, H. V.: Duoquest: A Dual-Specification System for Expressive SQL Queries. Proc. ACM SIGMOD Int. Conf. Manag. Data. 2319–2329 (2020). OpenAlex ↗ · Scholar ↗
- Lyons, G., Tran, V., Binnig, C., Cetintemel, U., Kraska, T.: Making the case for query-by-voice with echoquery. Proc. ACM SIGMOD Int. Conf. Manag. Data. 26-June-20, 2129–2132 (2016). OpenAlex ↗ · Scholar ↗
- Xu, X., Liu, C., Song, D.: SQLNet: Generating structured queries from natural language without reinforcement learning. https://arxiv.org/abs/1711.04436. 1–13 (2017). our card
- Gur, I., Yavuz, S., Su, Y., Yan, X.: DialSQL: Dialogue based structured query generation. ACL 2018 - 56th Annu. Meet. Assoc. Comput. Linguist. Proc. Conf. (Long Pap. 1, 1339–1349 (2018). OpenAlex ↗ · Scholar ↗
- Yu, T., Li, Z., Zhang, Z., Zhang, R., Radev, D.: TypeSQL: Knowledge-based type-aware neural text-to-SQL generation. NAACL HLT 2018 - 2018 Conf. North Am. Chapter Assoc. Comput. Linguist. Hum. Lang. Technol. - Proc. Conf. 2, 588–594 (2018). our card
- Yu, T., Yasunaga, M., Yang, K., Zhang, R., Wang, D., Li, Z., Radev, D.R.: SyntaxSQLNet: Syntax tree networks for complex and cross-domain text-to-SQL task. In: Proceedings ofthe 2018 Conference on Empirical Methods in Natural Language Processing. pp. 1653–1663. Association for Computational Linguistics, Brussels, Belgium (2018). OpenAlex ↗ · Scholar ↗
- Yu, T., Zhang, R., Yang, K., Yasunaga, M., Wang, D., Li, Z., Ma, J., Li, I., Yao, Q., Roman, S., Zhang, Z., Radev, D.: Spider: A Large-Scale Human-Labeled Dataset for Complex and Cross-Domain Semantic Parsing and Text-to-SQL Task. https://arxiv.org/abs/1809.08887v5. (2018). our card
- Francia, M., Golfarelli, M., Rizzi, S.: Augmented business intelligence. CEUR Workshop Proc. 2324, (2019). OpenAlex ↗ · Scholar ↗
- Guo, J., Zhan, Z., Gao, Y., Xiao, Y., Lou, J.-G., Liu, T., Zhang, D.: Towards Complex Text-to-SQL in Cross-Domain Database with Intermediate Representation. (2019). our card
- Wang, B., Shin, R., Liu, X., Polozov, O., Richardson, M.: RAT-SQL: Relation-aware schema encoding and linking for text-to-SQL parsers. (2019). our card
- Shi, P., Ng, P., Wang, Z., Zhu, H., Li, A.H., Wang, J., Santos, C.N. dos, Xiang, B.: Learning Contextual Representations for Semantic Parsing with Generation-Augmented Pre-Training. (2020). OpenAlex ↗ · Scholar ↗
- Yu, T., Wu, C., Lin, X.V., Wang, B., Tan, Y.C., Yang, X., Radev, D., Socher, R., Xiong, C.: GraPPa: Grammar-Augmented Pre-Training for Table Semantic Parsing. (2020). OpenAlex ↗ · Scholar ↗
- Lin, X.V., Socher, R., Xiong, C.: Bridging Textual and Tabular Data for Cross-Domain Text-to-SQL Semantic Parsing. 4870–4888 (2020). our card
- Utama, P., Weir, N., Basik, F., Binnig, C., Cetintemel, U., Hättasch, B., Ilkhechi, A., Ramaswamy, S., Usta, A.: DBPal: An End-to-end Neural Natural Language Interface for Databases. (2018). OpenAlex ↗ · Scholar ↗
- Basik, F., Hättasch, B., Ilkhechi, A., Usta, A., Ramaswamy, S., Utama, P., Weir, N., Binnig, C., Cetintemel, U.: DBPal: A learned NL-interface for databases. Proc. ACM SIGMOD Int. Conf. Manag. Data. 1765–1768 (2018). OpenAlex ↗ · Scholar ↗
- Weir, N., Utama, P., Galakatos, A., Crotty, A., Ilkhechi, A., Ramaswamy, S., Bhushan, R., Geisler, N., Hättasch, B., Eger, S., Cetintemel, U., Binnig, C.: DBPal: A Fully Pluggable NL2SQL Training Pipeline. In: Proceedings of the 2020 ACM SIGMOD International Conference on Management of Data. pp. 2347–2361. ACM, New York, NY, USA (2020). OpenAlex ↗ · Scholar ↗
- Lyu, Q., Chakrabarti, K., Hathi, S., Kundu, S., Zhang, J., Chen, Z.: Hybrid ranking network for text-to-SQL. https://arxiv.org/abs/2008.04759 1–12 (2020). OpenAlex ↗ · Scholar ↗
- Cao, R., Chen, L., Chen, Z., Zhao, Y., Zhu, S., Yu, K.: LGESQL: Line Graph Enhanced Text-to-SQL Model with Mixed Local and Non-Local Relations. 2541–2555 (2021). our card
- Xu, P., Kumar, D., Yang, W., Zi, W., Tang, K., Huang, C., Cheung, J.C.K., Prince, S.J.D., Cao, Y.: Optimizing Deeper Transformers on Small Datasets. 2089–2102 (2021). OpenAlex ↗ · Scholar ↗
- Bergamaschi, S., Guerra, F., Interlandi, M., Trillo-Lado, R., Velegrakis, Y.: Combining user and database perspective for solving keyword queries over relational databases. Inf. Syst. 55, 1–19 (2016). OpenAlex ↗ · Scholar ↗
- Bast, H., Haussmann, E.: More accurate question answering on freebase. Int. Conf. Inf. Knowl. Manag. Proc. 19-23-Oct-2015, 1431–1440 (2015). OpenAlex ↗ · Scholar ↗
- Ben Abacha, A., Zweigenbaum, P.: MEANS: A medical question-answering system combining NLP techniques and semantic Web technologies. Inf. Process. Manag. 51, 570–594 (2015). OpenAlex ↗ · Scholar ↗
- Iyer, S., Konstas, I., Cheung, A., Krishnamurthy, J., Zettlemoyer, L.: Learning a neural semantic parser from user feedback. ACL 2017 - 55th Annu. Meet. Assoc. Comput. Linguist. Proc. Conf. (Long Pap. 1, 963–973 (2017). OpenAlex ↗ · Scholar ↗
- Giordani, A., Moschitti, A.: Translating Questions to SQL Queries with Generative Parsers Discriminatively Reranked. Coling. 401–410 (2012). OpenAlex ↗ · Scholar ↗
- Popescu, A.M., Etzioni, O., Kautz, H.: Towards a theory of natural language interfaces to databases. Int. Conf. Intell. User Interfaces, Proc. IUI. 149–157 (2003). https://doi.org/10.1145/604050.604070. OpenAlex ↗ · Scholar ↗
- Zelle, J.M., Mooney, R.J.: Learning t o P arse Database Queries Using I n ductive Logic Programming. Natl. Conf. Artif. Intell. 1050–1055 (1996). OpenAlex ↗ · Scholar ↗
- Zettlemoyer, L.S., Michael, C.: Learning to map sentences to logical form: Structured classification with probabilistic categorial grammars. Proc. 21st Conf. Uncertain. Artif. Intell. UAI 2005. 658–666 (2005). our card
- Zhong, V., Xiong, C., Socher, R.: Seq2Sql: Generating Structured Queries From Natural Language Using Reinforcement Learning. https://arxiv.org/abs/1709.00103v7. 1–12 (2017). our card
- Zettlemoyer, L.S., Collins, M.: Online learning of relaxed CCG grammars for parsing to logical form. EMNLP-CoNLL 2007 - Proc. 2007 Jt. Conf. Empir. Methods Nat. Lang. Process. Comput. Nat. Lang. Learn. 678–687 (2007). our card
- Price, P.J.: Evaluation of spoken language systems. In: Proceedings of the workshop on Speech and Natural Language - HLT ’90. pp. 91–95. Association for Computational Linguistics, Morristown, NJ, USA (1990). OpenAlex ↗ · Scholar ↗
- Dahl, D.A., Bates, M., Brown, M., Fisher, W., Hunicke-Smith, K., Pallett, D., Pao, C., Rudnicky, A., Shriberg, E.: Expanding the scope of the ATIS task. 43 (1994). OpenAlex ↗ · Scholar ↗
- Hemphill, C.T., Godfrey, J.J., George, R.D.: The ATIS Spoken Language Systems Pilot Corpus. In: Proceedings of the DARPA Speech and Natural Language Workshop. , Hidden Valley, Pennsylvania (1990). OpenAlex ↗ · Scholar ↗
- Zhong, R., Yu, T., Klein, D.: Semantic evaluation for Text-to-SQL with distilled test suites. (2020). OpenAlex ↗ · Scholar ↗
- Devlin, J., Chang, M.W., Lee, K., Toutanova, K.: BERT: Pre-training of deep bidirectional transformers for language understanding. NAACL HLT 2019 - 2019 Conf. North Am. Chapter Assoc. Comput. Linguist. Hum. Lang. Technol. - Proc. Conf. 1, 4171–4186 (2019). our card
- Lewis, M., Liu, Y., Goyal, N., Ghazvininejad, M., Mohamed, A., Levy, O., Stoyanov, V., Zettlemoyer, L., Bart, P.: BART: Denoising Sequence-to-Sequence Pre-training for Natural Language Generation, Translation, and Comprehension. (2019). our card
- Souza, F., Nogueira, R., Lotufo, R.: BERTimbau: Pretrained BERT Models for Brazilian Portuguese.In: BRACIS 2020. Lecture Notes in Computer Science. pp. 403–417. Springer, Cham (2020). https://doi.org/10.1007/978-3-030-61377-8_28 OpenAlex ↗ · Scholar ↗
- Tang, Y., Tran, C., Li, X., Chen, P.J., Goyal, N., Chaudhary, V., Gu, J., Fan, A.: Multilingual Translation with Extensible Multilingual Pretraining and Finetuning. https://arxiv.org/abs/2008.00401. (2020). OpenAlex ↗ · Scholar ↗
- da Silva C.F.M., Jindal R.: SQL Query from Portuguese Language Using Natural Language Processing. In: Garg D., Wong K., Sarangapani J., Gupta S.K. (eds) Advanced Computing. IACC 2020. Communications in Computer and Information Science, vol 1367. Springer, Singapore. (2021) https://doi.org/10.1007/978-981-16-0401-0_25 OpenAlex ↗ · Scholar ↗