Program Synthesis for Complex QA on Charts via Probabilistic Grammar Based Filtered Iterative Back-Translation
Paper · 2023 · Shabbirhussain Bhaisaheb, Shubham Paliwal, Rajaswa Patil et al.
Summary
A chart can show the values used in a calculation without showing the result of that calculation. A reader who wants to compare changes across series, count observations above an average, or decide whether a line ever decreases has to recover the relevant values and work out what to do with them. This paper studies how to automate that process for chart images. The authors turn each image into a table, translate the question into SQL, and run the resulting program to compute the answer. The program records which rows and operations produced the result, making the calculation available for inspection.
The difficulty is teaching the system to write those programs. PlotQA V2 provides charts, questions, and answers, but no reference SQL for its chart questions. The authors start with paired questions and SQL from Spider, supplement it with examples of operations needed for PlotQA, and adapt the parser through filtered iterative back-translation. In one direction, the system writes programs for actual chart questions and retains pairs whose programs reproduce the known answers. In the other direction, it samples chart programs from a probabilistic grammar, generates questions for them, and retains pairs whose wording resembles target questions and agrees with the operators in the program. The grammar favors less common rule choices so that the system can encounter compositions missing from its current training set.
On the PlotQA V2 reasoning test split, the system achieves 60.44% answer accuracy using tables recovered from images. The paper reports 14.82% for the previous PlotQA system and 58.70% for its human comparison. The result is strongest on questions whose answers are numerical. On the open-vocabulary subset, the proposed system reaches 60.42%, while a direct-answer T5 comparison trained on the same representative chart questions reaches 0.003%. The proposed system performs worse than that T5 comparison on yes/no questions. A binary answer can still require a difficult calculation, and the SQL generator can produce a result of the wrong type.
Replacing the recovered tables with tables built from the benchmark’s reference chart data raises reasoning test accuracy to 84.49%. The difference shows how much the measured performance depends on recovering accurate data from the image. Program synthesis has its own limits. The grammar can produce nested SQL, but the reverse direction often struggles to turn these programs into meaningful questions. Some of the forms the grammar can express therefore remain scarce in the examples that reach the parser.
Deep dive: Program Synthesis for Complex QA on Charts via Probabilistic Grammar Based Filtered Iterative Back-Translation
A chart question answering system reads plots into tables and learns to write SQL for numerical reasoning without annotated chart programs. · about 35 minutes to read
The problem and its context
What a chart question asks the system to do
In chart question answering, the inputs are an image and a natural-language question about it. The answer might be a piece of text visible in the image, a description of the chart’s structure, or a value that requires working with the underlying observations. The task in this paper concentrates on that last kind of work. A question about how much a series changed requires identifying the series, looking up its values at the relevant categories, and subtracting in the intended order. A comparison of changes repeats that calculation for another series and adds a final comparison. Each part can go wrong even when the others are correct.
The examples in the paper make the distinction concrete. A reader can find a line chart’s title by recognizing where the title sits and reading its text. Deciding whether the series for firms offering quality certification increases monotonically requires following the appropriate line, associating its points with years, and checking that a later value never falls below an earlier one. The legend may be needed in both kinds of chart question, but in the trend question it supplies a means of identifying the data to inspect. The final answer comes from a condition applied across those data.
The form of the answer gives limited information about the difficulty of obtaining it. The monotonicity question ends with yes or no, even though it concerns a whole time series. The horizontal-bar example about the gap between the highest and next-highest values ends with a number, but finding the runner-up accounts for much of the work. An answer vocabulary can accommodate common numbers and binary labels. Its coverage says little about whether the system can recover a new numerical result or carry out the procedure a question implies.
The problem becomes easier to describe once the chart is represented as data. A row can identify a category and series and give their numerical value. A question can then specify rows, express calculations over those rows, and combine the results. That translation from wording to an executable meaning is a form of semantic parsing. The paper separates it from image interpretation so that each stage exposes an intermediate result. A chart table identifies what the system read. A SQL program identifies what calculation it chose to run.
The balance of questions in existing benchmarks
The authors describe early chart benchmarks such as DVQA and FigureQA as using synthetic data with limited variation and many questions whose answers were binary or came from a fixed vocabulary. They describe Leaf-QA and PlotQA as drawing chart data from open sources, including public statistical collections. The questions are written in English from templates with paraphrasing intended to reduce reliance on memorized wordings. This gives the benchmarks varied subjects and labels while leaving families of recurring question structures.
The authors select PlotQA because of the prevalence of questions that require calculations. They report that 81.95% of PlotQA questions are complex value-based queries and that 80.84% have open-vocabulary answers. In their comparison of benchmark composition, they describe reasoning questions as ∼82% of PlotQA and compositional reasoning questions as 43% of ChartQA. Those figures characterize the benchmarks as the authors describe them. Their actual evaluation targets the reasoning questions in PlotQA V2, where elaborate calculations and open-vocabulary answers are central to the task.
This choice matters for interpreting the work. A benchmark with many questions about titles, labels, and visual properties would place a higher premium on locating and reading those elements. PlotQA’s reasoning subset places a higher premium on recovering usable numbers, combining them, and generating an answer that might never have appeared during training. The paper’s table representation and its SQL grammar are both shaped by that emphasis.
Earlier ways to connect images, questions, and answers
The paper describes chart systems that learn to combine features from the image with features from the question and then predict an answer. One line of work locates chart elements and applies attention to combine them with the relevant language. Another incorporates the positions of visual elements into a transformer so that their location informs the prediction. The authors associate much of this work with benchmarks dominated by simpler chart queries. They also discuss benchmark comparisons that include systems for visual and textual inputs, systems for tabular inputs, and the text-to-text approach introduced by T5.
The paper also traces a line of work that extracts chart content before answering a question. Earlier PlotQA and chart explanation systems stored recovered information in a semi-structured representation and used pre-defined rules to turn questions into logical forms. The authors relate this approach to work on compositional semantic parsing for semi-structured tables. When the rules cover a question, an explicit calculation can run over the extracted data. Coverage becomes the difficulty when chart questions require compositions that the earlier grammar was never designed to represent.
Table question answering offers another set of approaches. The paper describes systems that predict answers from tables, including TaPas, and systems that generate an intermediate program, including the line of work it discusses under TaBERT. It also cites pretraining on synthetic queries and executions, as in TAPEX, and pretraining with synthetic pairs produced by a grammar, as in GraPPa. In the authors’ account, much of this work addresses retrieval or relatively simple aggregation. The chart questions of interest can require arithmetic across rows of the same table, aggregation inside comparisons, or a query inside another query’s filtering condition.
Work on translating language into SQL had already confronted nested expressions. The authors discuss RYANSQL as an approach whose decoder is designed around complex nested SQL. They also note that GraPPa was adapted to the complex Spider benchmark with its program annotations. Spider supplies pairs of questions and SQL over a variety of database schemas. Those annotations provide a starting point for the chart study, while the corresponding programs for PlotQA itself are unavailable. Spider
The paper places this situation under weak supervision. Here, the supervision for an actual chart question is its answer, also called its denotation. Earlier work used such outputs as rewards, used them to assign training credit across candidate logical forms, or used them to discard candidate programs that failed an execution check. The authors identify a difficulty common to those approaches. Many candidate programs may be available, and a program can return a correct answer by coincidence. Their adaptation procedure uses the known chart answer as a check on a proposed program, together with synthetic pairs designed to expose the parser to a wider set of calculations.
Iterative back-translation gives the authors a way to put the two sources of examples to work together. The paper draws on iterative back-translation in machine translation and on earlier work that used repeated translation between questions and logical forms to improve compositional generalization. In the chart setting, the forward direction begins with a real question, and the reverse direction begins with a program sampled on a chart table. The authors’ contribution is to direct program sampling towards underrepresented compositions and check the resulting examples before adding them to training.
The method, step by step
From a question to something the database can execute
At test time, the workflow begins with a chart image and a question. For a question about the difference between the strongest and next-strongest observations in a horizontal bar chart, the image stage recovers the values of the relevant bars and their labels. The language stage writes a query specifying the ordering and calculation. The database executes the query over the recovered chart table. The answer comes from that execution. The ability to describe the procedure in words makes clear why two distinct skills are needed. The chart reader has to find the right values, and the parser has to express a procedure that uses them correctly.
Training runs in both directions between questions and SQL. The forward direction supplies a program for a representative PlotQA question. The known answer determines whether the example is eligible to join the paired training set. The backward direction takes a new program as given and attempts to write a question for it. The question’s origin requires a different approach to assessing its suitability. The paper uses similarity to real chart questions and a comparison of the operations indicated by the language and SQL. The accepted examples become material for the next round.
From chart images and seed pairs to executable answers
The steps in order.
The task and the information available during training
The task is to produce an answer a from a chart c and a question q about that chart. During chart training, the available examples have the following form.
D chart = {(q chart, c chart, a chart)}₁ᴺ
D chart is the collection of chart training examples. Each tuple contains q chart, a natural-language question, c chart, its chart image, and a chart, the reference answer. The braces denote the collection, and the indices from 1 through N denote its examples, with N the size of the collection. The test charts and their questions are held out from this training set. After chart extraction, the training procedure works with the representation s chart in place of the image, while retaining its question and answer.
The initialization data have a different form.
D tr = {(s tr, q tr, p tr)}₁ᴹ
D tr is the paired training collection at initialization. Each tuple contains s tr, a database schema, q tr, a question about that schema, and p tr, the corresponding SQL program. M is the number of examples in this collection, indexed from 1 through M. The paper continues to use D tr for the working collection as the procedure adds pairs. The symbol p tr then refers to programs in that current collection. The initial database domains can differ from the domains represented in the charts.
The bridge between the collections is a shared set of primitive operations. A primitive can be an aggregation such as an average or a maximum, arithmetic such as subtraction or division, or a comparison such as greater than. The assumption concerns the availability of those building blocks. Their frequency and their arrangement can change between the seed data and the chart questions. A parser familiar with averages and comparisons still has to learn how a counting question can use a comparison against an average computed in a subquery.
The introductory trend example gives a mathematical description of the distinction between a primitive comparison and the full condition. In the paper’s formulation, monotonic increase allows equal values across years.
∀ yᵢ, yⱼ with i ≠ j, yᵢ > yⱼ ⇒ V(yᵢ) ≥ V(yⱼ)
yᵢ and yⱼ are years, indexed by i and j. i ≠ j restricts the comparison to distinct indices. V maps each year to the value for the relevant series, and the parentheses indicate function application. ∀ applies the condition to every such pair of years. > orders the years, ⇒ means that the ordering implies the stated comparison, and ≥ allows the later value to be either greater or equal. Recognizing a phrase about increase is only part of the task. The required calculation must implement a condition over the series as a whole.
Reading the chart as a table
The image pipeline first identifies the chart type. The paper uses a ResNet-34 initialized on ImageNet and trained further with PlotQA chart-type labels. Horizontal bars, vertical bars, lines, and dots differ in which visual marks carry data and which coordinate encodes their value. Horizontal bars put the numerical coordinate on the horizontal axis and categories on the vertical axis. The other chart types considered use the reverse assignment. The paper calls them the numerical axis and categorical axis so that the final representation can use the same roles for either orientation.
Text detection starts with CRAFT. The authors observe that its regions can omit isolated characters or cover only part of a text item. They add a stage that repairs the regions and predicts their roles. A text fragment can belong to a title, a legend, an axis label, or a set of tick labels. The role tells the downstream pipeline how to use the recognized string. A number associated with a numerical-axis tick calibrates the pixel scale, while a string associated with a legend identifies a series. The system runs Tesseract 4.0.0 for optical character recognition on the resulting regions and attaches the recognized text to the predicted roles.
The text-role component uses image features produced by an encoder and decoder based on U-Net. A candidate patch from CRAFT acts as a trigger, with its contours highlighted. The system combines features from that patch with information from the larger image. A controller produces filters conditioned on those features. These filters help produce a segmentation map indicating the pixels associated with the text role, and the component also predicts the role itself. The training objective uses cross-entropy for the role and the corresponding segmentation. During inference, detected regions remove overlapping patches from further consideration. When several maps are produced for a role, the system takes their union.
The remaining stages relate the text to chart geometry. Rules use detected lines to infer the axes, their intersection, and the chart region. Legend labels help locate the nearby marks that display how each series is drawn. The color or pattern of those marks is then matched to bars, dots, or lines inside the plot. This is how a visual description such as a particular colored line becomes a series label attached to data. The style supports the extraction process, while the label and its numerical observations are what the parser receives.
The authors also correct some irregularities in the ticks used for numerical calibration. They look at the most common spacing between consecutive detected ticks. Gaps that deviate from the spacing can trigger the addition or removal of a tick. To repair the progression of tick values, they try different observed values as anchors and compare the implied sequences with the extracted values. The anchor whose sequence agrees with the most extracted values determines the corrected set. Labels in scientific notation are converted to floating-point values. The correction relies on regularity across ticks to resolve uncertainty about individual detections.
With the numerical ticks in place, interpolation and extrapolation associate numerical values with pixel positions. A bar contributes its endpoint, while dots and lines contribute data points associated with their positions. The categorical coordinate identifies the category, the legend match identifies the series, and the numerical coordinate supplies the value. The procedure assigns zero when it has no detected mark for a category and series because of a visual detection error. This is a concrete way for an error in image interpretation to turn into a valid-looking number that subsequent SQL will use.
The resulting rows are tuples of category label, series label, and numerical value. The category column takes its name from the corresponding axis label. The numerical column’s name combines the chart title with the numerical-axis label, so the name describes the measure as well as the axis. The series column represents legend entries and is omitted where the chart contains a single series. Spaces in column names are replaced with underscores. The authors store the tables in SQLite3 and implement a median procedure to make that aggregation available to generated programs.
This representation does more than provide coordinates in a convenient form. It defines what a question can refer to at execution time. A named measure can become a column reference, a year or other category can become a row constraint, and a named series can restrict the selected observations. SQL can compare rows, calculate a summary over them, and combine results. Information about such properties as the color of a mark is useful during chart reading but lies outside the table exposed to the parser.
Giving both directions a starting vocabulary of operations
The authors initialize the forward and reverse systems with Spider and add 359 question–SQL pairs. The additions supply difference, ratio, less-than comparisons, and median, which the authors identify as required by PlotQA and missing from the Spider SQL used for initialization. Templates create these pairs using Spider tables whose structures resemble the extracted chart tables. This introduces the needed operations in a setting with paired questions and programs while leaving chart-specific compositions for the adaptation stage.
The ratio example illustrates what goes into a seed pair. Its question names a numerical measure at one categorical value and asks for its ratio to the same measure at another categorical value. Its SQL uses two aliases for the same table, selects a row for each category, and divides one numerical value by the other. The template fills in real column names and category values from a compatible Spider table. A parser trained on the pair can encounter the relation between the wording and the arithmetic, as well as how to retrieve both operands from one table.
For both directions, the authors use CodeT5. The forward direction is configured for translating questions into code, and the backward direction draws on the code summarization setup. In the forward direction, the encoder receives the schema and table contents in a flattened sequence along with the question, using a separator to distinguish parts of the input. The decoder produces SQL tokens in order, with each prediction conditioned on preceding output. The paired training objective is cross-entropy, which penalizes low probability assigned to the reference output tokens. In the reverse direction, the encoded input contains the schema, contents, and SQL, and the decoder produces natural-language question tokens.
The two directions therefore have different tasks over the same pairs. One learns how a phrase is expressed in a program, and the other learns how to turn a program into a question grounded in the table. An accepted pair can be used for both tasks. The quality of the question–program correspondence matters in either direction, even when the program executes successfully.
Choosing representative chart questions
The authors start from a random sample of 200K PlotQA training questions and generalize their wording before clustering. Generalization here means replacing pieces associated with the schema, such as column names and cell values, with typed placeholders. The procedure uses substring matching to identify these pieces. The types preserve useful differences among a measure name, a series value, and a category value. The original wording is retained separately for later training.
Consider the paper’s example about comparing how tax amounts changed for goods and exports. The generalized form preserves the request to compare one difference with another. It replaces the tax measure with a numerical-entity tag, the names of the tax series with series-value tags, and the years with category-value tags. Another chart can use entirely different labels and still ask for the same pattern of reasoning. The generalized representation gives those two questions a better chance of being grouped together.
The authors use Sentence-BERT to map the generalized questions to numerical representations. They compare representations with cosine similarity, which measures how closely the vectors point in the same direction. They then cluster them using DBSCAN, a method that finds dense groups without having to set the number of groups beforehand. With minpoints = 15 and ϵ = 0.25, the authors obtain 345 clusters from the generalized training sample. The first setting is the minimum-neighborhood-count parameter, and the second sets the neighborhood scale used for clustering.
They randomly select 200 questions from each cluster and obtain 69K representative training questions. The selection can be written in the compact form used in the algorithm.
q rep = sample(cluster(generalize(q chart)))
q chart denotes the chart questions supplied to these operations, with the procedure applied to the sampled training questions. generalize replaces schema-specific spans, cluster groups the generalized representations, and sample selects questions from those groups. The nested parentheses give the order of operations from inside out. q rep denotes the selected representative questions. The system retrieves the original wording and associated chart schemas and answers for the forward pass. The authors apply a similar selection procedure to the validation split.
The representative questions play two roles. Their original wording and answers give the forward system chart-specific cases on which it can propose SQL. Their generalized wording also gives the backward filter a reference for judging whether a synthetic question resembles the kinds of question PlotQA asks. A question can be useful in that second role even when its individual series labels or years would be irrelevant to another chart.
The forward pass checks programs against known answers
The forward system trains on the current question–SQL pairs, then generates programs for the representative PlotQA questions still awaiting accepted programs in the algorithm. It executes each candidate on the corresponding extracted schema. The acceptance condition uses the computed value and the recorded answer.
a c = a rep
a c is the answer computed by executing the proposed program, a rep is the reference answer for the representative question, and = denotes the equality check shown for the forward filter. The algorithm adds the schema, original question, and generated SQL to the paired data when the condition holds. It removes the accepted item from the pool awaiting a program. The paper specifies a tolerance for floating-point answers in test evaluation. The forward algorithm presents its own check as equality.
This pass turns successful execution into a source of training pairs on the target charts. The procedure learns from a naturally occurring question even though its SQL was never annotated. The evidence supplied by execution is specific to the current chart. For instance, two different row selections could happen to return the same numerical value on a given chart. Acceptance therefore establishes agreement with the answer on that example, and the generated program becomes a working training label on the strength of that agreement.
The grammar proposes programs with unfamiliar compositions
To propose programs independently of the forward parser, the authors write a context-free grammar for a subset of SQL and assign probabilities to its productions. A production expands a category in the grammar into keywords, table or column references, operators, or other expandable categories. Sampling these choices constructs a query. The grammar is designed for the extracted chart schema, so it includes alternatives for selecting numerical results, selecting categorical or series values, performing arithmetic, and placing queries inside conditions.
The grammar’s use of table aliases illustrates the variety within this common schema. A program can refer to separate rows of the same chart table through separate aliases, then calculate differences or ratios between their values. Another form orders observations by their numerical values to select categories or series. Conditions can compare a value to a number or to the result of a nested selection. Such forms give the generator possible structures for questions that go beyond retrieving a cell or calculating an average on an already isolated series.
At the start of the backward pass, the authors estimate how often rules are triggered by programs in the current paired data and by previously rejected synthetic programs. They then use inverse weighting. In the paper’s notation, the weight for a production is written as follows.
Wt(R) = (maxᵣ: RHS(r) = RHS(R) P(r))^(1−α) / P(R)
Wt(R) is the weight assigned to production R. r ranges over the rules compared with R, and the condition after max restricts that range to rules with the same RHS as R. RHS is the paper’s notation for the right-hand side, which its explanation treats as the shared source node used to group the alternatives. P(r) and P(R) are the observed triggering probabilities of the corresponding rules. max selects the largest probability within the group. The caret indicates exponentiation, with 1−α the exponent and / denoting division. The authors set α = 0.8 and describe it as controlling the skew of the sampling distribution.
The rule probability used for sampling is obtained by normalizing the weights.
P inv(R) = Wt(R) / ∑ᵣ: RHS(r) = RHS(R) Wt(r)
P inv(R) is the induced sampling probability for R. Wt(R) is the weight just defined. ∑ adds the weights Wt(r) of the rules satisfying the stated RHS condition. The denominator is thus the total weight of the comparison group. The inverse factor makes a rule with lower positive observed probability receive more weight than a rule with higher observed probability in the same group.
There is a detail worth distinguishing in the printed formulas. The maximum in the numerator is common to the rules sharing the stated grouping condition. Read literally, that group-wide factor cancels when the weights are normalized within the same group, so the displayed equations leave the relative probabilities governed by the reciprocals. The paper describes the intended effect of α, but the displayed normalization alone does not establish that effect. The equations also leave unspecified how the implementation handles a rule whose observed probability is zero. The documented principle is to turn away from heavily represented rule choices and use the grammar to explore other compositions.
Rejected programs affect this exploration even though they never enter the paired data as accepted examples. The paper includes them when estimating rule use in subsequent rounds. Their appearance can therefore influence the weights of the productions that yielded them. This feedback is different from teaching the parser with the rejected question. It changes what the generator is inclined to propose next while withholding an unreliable question–program pair from both translation directions.
The backward pass checks the generated questions
The backward system trains on the current paired collection, including pairs just accepted on the forward pass. It then receives SQL sampled from the reweighted grammar on chart schemas and generates a question for each program. The sampled programs provide chart-specific table and column names as well as new arrangements of operators. This is the point at which a composition that the forward parser has rarely seen can acquire a possible question in natural language.
The first filter checks resemblance to the target question distribution. The procedure generalizes each synthetic question with the same placeholder substitution used for the representative set, embeds the generalized question with Sentence-BERT, and finds its highest cosine similarity to a generalized representative question. The algorithm proceeds to the next filter when that maximum exceeds its threshold. A synthetic question about unfamiliar data can pass if its generalized structure resembles one of the real target questions. Shared chart names alone carry less weight once they have been replaced by placeholders.
Similarity to a real question does not ensure that the wording describes the sampled SQL. A fluent question about an average can look typical of PlotQA while being paired with a program that calculates a maximum. To address such mismatches, the second filter uses a manually specified phrase–operator dictionary. Phrases about a ratio, the highest value, an average, or a count correspond to division, MAX, AVG, or COUNT. A pair fails when the phrases recognized by the lookup are inconsistent with the SQL operators that the mapping expects. The filter checks clues about the requested operations and complements the broader resemblance test.
The similarity threshold is chosen each iteration using the distribution of operators in target questions and in the synthetic questions that would survive the filters. The criterion is minimum Kullback–Leibler divergence, a measure of the discrepancy between probability distributions. The authors use it to choose a threshold whose accepted pool has an operator distribution close to the one inferred for PlotQA. This criterion acts on the pool as a whole. The similarity search and phrase lookup determine which examples make up that pool.
If a pair survives both tests, its chart schema, generated wording, and sampled SQL join the paired training set. Rejected SQL is tracked separately for grammar induction. The forward direction has now contributed real chart wording paired with inferred programs, and the backward direction has contributed proposed chart programs paired with synthetic wording. The authors repeat the process, retraining both directions as the paired data grow. The algorithm describes convergence as its stopping condition. The reported experiment traces performance over successive rounds, and the trained forward parser is the component that produces programs for the held-out questions.
Experiments and results
What the test measures
PlotQA V2 contains 224,377 images across its splits and 28,952,641 questions in total. The training split comprises 157,070 images and 20,249,479 questions, including 16,593,656 reasoning questions. The validation split comprises 33,650 images and has 3,574,081 reasoning questions. Within those splits, the representative sets used for adaptation contain 69,000 training questions and 13,740 validation questions. The associated image counts are 12,934 for training and 3,110 for validation. The held-out test split contains 33,657 images and 4,342,514 questions of all types, of which 3,559,392 are reasoning questions.
The primary metric is answer accuracy on those 3,559,392 reasoning test questions. Answers come from executing generated programs on the chart tables. A floating-point prediction is counted as correct if it lies within the 5% range of the reference answer, following the PlotQA evaluation used by the authors. Consequently, the score measures how frequently the question answering pipeline supplies an acceptable result. PlotQA has no reference SQL for these questions, so the program itself has no exact-match target in this evaluation.
The paper reports scores separately for yes/no, fixed-vocabulary, and open-vocabulary answers. In this test subset, both vocabulary categories refer to numerical answers. The fixed vocabulary is based on the top 1000 often occurring answers under the benchmark definition. The relevant test counts are 72,968 yes/no questions, 566,655 fixed-vocabulary questions, and 2,919,769 open-vocabulary questions. The large open-vocabulary group has the greatest influence on the total accuracy. The breakdown is important because performance across the groups follows sharply different patterns.
The paper uses the CodeT5 base configuration with 220M trainable parameters. For adapting the forward and backward directions it reports a batch size of 48, a learning rate of 0.0001, gradient accumulation of 4 steps, the Adam optimizer, and an NVIDIA Tesla V100 32GB GPU. Sampling uses the random seed of 7 for both representative questions and grammar-generated SQL. The authors describe training time as changing between rounds because each round adds examples. Using the configuration they describe, they report an inference time of approximately 360 hours on the PlotQA V2 test split.
Comparisons on the reasoning questions
The comparison includes the earlier PlotQA system, a human result reported with the benchmark, and a direct-answer T5 system trained by the authors. They train that T5 comparison on the 69K representative chart questions, using the input format reported in ChartQA. Matching the representative question set makes the comparison informative about performance with the same target questions. The proposed parser also receives external Spider supervision and synthetic pairs, both of which are part of its method and give it a different overall training history.
Overall test accuracy on PlotQA V2 reasoning questions
The extracted-schema system exceeds the reported baselines, and the same approach scores higher with oracle chart data.
The numbers
| System or setting | accuracy % |
|---|---|
| T5 trained on representative questions | 1.17 |
| Previous PlotQA system | 14.82 |
| Human comparison | 58.70 |
| Proposed system with extracted schema (this paper) | 60.44 |
| Proposed system with oracle schema | 84.49 |
The extracted-schema score of 60.44% is the end-to-end reasoning result, with the data recovered from the input images. The 84.49% result uses an oracle schema built from the benchmark’s reference chart extractions. Both results use the proposed approach, but the latter changes the source of the chart data and therefore measures how it fares when the image-reading stage supplies reference information. The human figure of 58.70% and the previous PlotQA figure of 14.82% are the comparisons reported for the reasoning task.
A separate result in the paper is the published ChartQA evaluation of T5 on the full PlotQA V2 test split. That evaluation used the full PlotQA training set and obtained 56.22% test accuracy across structural, retrieval, and reasoning questions together. The T5 score of 1.17% in the chart above belongs to the authors’ smaller-training-set comparison on reasoning questions alone. It answers a different experimental question. The full-data figure speaks to performance on a mixed set of questions, while the representative-data figure tests how direct answer prediction fares in the authors’ reasoning-focused setup.
Numerical questions and binary questions
Open-vocabulary answers are the clearest setting for the difference between calculation and direct answer prediction in the reported comparison. A numerical result can be computed even when it has no established place in a list of likely answers. The generated program has to identify the correct inputs and operations, but the final value can follow from those choices without having appeared as an answer in a training pair.
Open-vocabulary test accuracy on PlotQA V2 reasoning questions
Program execution gives much higher open-vocabulary accuracy than the previous automated baselines, with the best result using oracle data.
The numbers
| System or setting | accuracy % |
|---|---|
| T5 trained on representative questions | 0.003 |
| Previous PlotQA system | 14.95 |
| Human comparison | 58.01 |
| Proposed system with extracted schema (this paper) | 60.42 |
| Proposed system with oracle schema | 85.35 |
The fixed-vocabulary numerical group also favors program execution. On that reasoning test subset, the extracted-schema system achieves 63.91% accuracy, and its oracle-schema counterpart reaches 67.70%. The reported human result is 59.97%, the earlier PlotQA system reaches 7.95%, and the representative-data T5 comparison reaches 2.41%. Having common answers in the benchmark vocabulary does not remove the challenge of learning which answer follows from the chart. The numbers show that the program-based approach is effective in this subset as well as in the larger open-vocabulary subset.
Yes/no questions show the opposite ranking. On that part of the reasoning test split, the human comparison reaches 76.51%, the previous PlotQA approach reaches 62.75%, and T5 reaches 62.38%. The proposed system achieves 43.21% with extracted data and 44.13% with oracle data. A system that recognizes a question as binary and guesses uniformly within that answer space can expect 50% accuracy. The authors point out that their parser can output SQL whose result is outside the binary answer space, so that baseline assumption differs from the behavior of their system.
The authors also give a semantic explanation for the yes/no results. A question can ask whether a majority of years pass a threshold, whether one series remains below another throughout the chart, or whether a series is monotonic. Translating those questions can involve counting, comparisons, and a condition that holds across categories. The phrase–operator dictionary directly covers some simpler cues. A phrase about a majority or a trend can call for a whole composition of primitives. As a result, the binary subset is a demanding test of the question-to-program mapping despite its limited output space.
Accuracy across adaptation rounds
The paper reports a rising sequence of reasoning test results after successive rounds of filtered iterative back-translation. Each round can add programs inferred for real chart questions and synthetic pairs selected by the backward filters. Later rounds therefore train on a larger collection with different coverage from the seed collection.
Reasoning test accuracy across FIBT iterations on PlotQA V2
Accuracy rises across the reported rounds of augmentation and retraining.
The numbers
| System or setting | accuracy % |
|---|---|
| First iteration | 39.69 |
| Second iteration | 57.45 |
| Third iteration (this paper) | 60.44 |
The first reported round reaches 39.69% on the reasoning test, the second reaches 57.45%, and the third reaches 60.44%. The trajectory is evidence about the combined iterative procedure. Each round changes several things together, including the pool of accepted programs, the synthetic examples available for training, and the sampling weights used to propose further programs. The reported sequence shows how the complete procedure improves across the run.
The image modules have their own evaluation. The chart-type classifier reaches 99.91% test accuracy in the authors’ reported setup. For chart-element extraction, they emphasize 94.92% mean average precision at 0.90 intersection over union when training on all 157K PlotQA images. Intersection over union measures agreement between predicted and reference regions by comparing their overlap with their combined extent. The strict criterion matters because small localization errors can change the values inferred from chart marks. High region-level scores can coexist with substantial errors in answers that depend on exact combinations of recovered values.
What the ablations show
Providing reference data isolates the cost of reading the image
The paper’s main controlled comparison replaces the chart data recovered by the vision pipeline with a schema built from oracle extractions. The task remains the PlotQA V2 reasoning test, and answers are still computed by running generated SQL. Accuracy rises from 60.44% on the extracted schema to 84.49% on the oracle schema. This is the paper’s clearest evidence that data recovery is a major constraint on end-to-end chart reasoning. A program may express the intended calculation and still return the wrong result if the rows hold inaccurate values or labels.
The difference is concentrated in the numerical answer groups. Open-vocabulary test accuracy goes from 60.42% with extracted data to 85.35% with oracle data. Fixed-vocabulary accuracy goes from 63.91% to 67.70%, and yes/no accuracy goes from 43.21% to 44.13%. The yes/no comparison leaves much of the difficulty in place after replacing the extracted values. That pattern is consistent with the paper’s account that some binary questions remain hard because of their logical structure, even with reliable chart data. The experiment changes the schema available to the parser and executor. It does not count how often each individual recognition or parsing error caused a wrong answer.
The image evaluation supplies context for this comparison. For legend-label text, the OCR accuracy reported for the proposed extractor is 98.13%, compared with 91.11% for PlotQA. For vertical-axis tick text, the corresponding scores are 95.94% and 88.07%. The paper defines OCR accuracy as follows.
OCR accuracy = 1 − WER
OCR accuracy is the text-recognition score before percentage reporting, WER is word error rate, and 1 − takes the complement of that error rate. This metric concerns the recognized words. It cannot capture mistakes in converting pixels into chart values or matching a series’ style to its individual points. The chart-element evaluation also finds dots and lines difficult to localize because they may be small, sparse, or obscured where series intersect. Those difficulties help explain why a strong intermediate score for the vision components can still leave a substantial gap in downstream execution accuracy.
Where the SQL improves after another round
The authors trace an individual question across iterations to show a change hidden by aggregate accuracy. The question asks how many years had social-contribution spending above the average across all years. After the first round, the program compares the value for a selected year with the same value retrieved under another alias. It therefore contains a comparison but fails to represent the requested average, the qualifying condition over the years, and the count.
After the second round, the SQL first obtains the average over the table and uses it as the boundary in a row filter. It then counts the qualifying rows. The revised form maps the parts of the question to operations that work together. The example demonstrates an improvement in the generated procedure itself, as opposed to an isolated match in the numerical answer. The authors attribute the change to synthetic training data that introduced a composition absent from the bootstrap pairs.
Their operator analysis identifies other families that the system handles well. A question may compare the sum of values for one series in selected years with the maximum value of another series across the chart. Its program needs distinct row scopes for the two sides of the comparison. A question may also compare separate differences, each defined by the values of a series at selected categories. These cases involve multiple operations while allowing the wording to provide comparatively clear cues about what to compute.
The same analysis distinguishes nested programs that remain difficult. Finding the gap between a maximum and a second maximum requires a way to identify the runner-up before using it in subtraction. A question about whether a comparison of sums holds for every category requires a query that enforces the condition across all distinct values of that category. The authors observe poor performance on such questions even though the grammar permits nested SQL. The useful distinction is between a composition the grammar can generate and one the training loop can turn into a reliable paired example.
Where synthetic coverage breaks down
The authors observe that inverse weighting can lead to nested programs appearing in later sampling rounds. The subsequent difficulty is writing questions that faithfully express those programs. In a deeply composed query, the wording has to preserve details such as which rows a subquery summarizes or whether a condition applies to every category. A question can sound plausible and still lose the relation that the nesting encodes. The backward direction often fails to generate meaningful wording for such cases, and the filters remove many of the resulting pairs.
This analysis locates a limit in the interaction between generation and filtering. The grammar can broaden the menu of candidate programs, and the backward generator determines how much usable supervision that menu yields. Filtering protects the training data from bad correspondences while also limiting coverage where faithful question generation is weak. The reported results for difficult nested questions are consistent with a shortage of accepted examples in those families. Some nesting is learned, as the count-above-average example shows. The weakness concerns particular constructions, especially where the syntax expresses conditions or dependencies that the backward system struggles to verbalize.
The iteration results measure the complete adaptation procedure, and the program examples show individual forms that improve or remain difficult. The paper gives no separate accuracy comparison for proportional versus inverse rule sampling, execution filtering alone, or either backward filter in isolation. The controlled evidence is strongest for the change in chart data supplied to the reasoning system. The analysis of why augmentation works rests on the combined iteration results and the traced examples.
Limitations
Limits the authors identify
The authors scope the approach to reasoning over underlying chart data. Its execution schema contains categories, series, and measured values. Questions about a mark’s color, size, or location need a representation in which those attributes remain available to query. The pipeline uses some of them to recover data, but the SQL executor receives the resulting table. This also limits what the end-to-end reasoning result says about structural and visual questions in a mixed chart benchmark.
The adaptation procedure assumes an adequate starting set of SQL primitives and some overlap in compositions between the seed and target data. The additions to Spider illustrate the practical importance of that assumption. Where a required operation is missing, the authors add paired examples before starting the loop. The chart-side grammar also embodies prior knowledge of the intended queries and schema. Adaptation can introduce unfamiliar combinations and cover new chart domains within that setup. Transfer to a target with substantially different primitives or chart structures remains outside the experiment.
The phrase–operator dictionary has limited coverage. It captures a set of manually chosen expressions for such operations as division, counting, and aggregation. The authors identify paraphrases and semantically similar phrases as ways they would like to extend this mapping. Their conclusion also proposes hierarchical or grammar-based program search as future work for questions that require nesting. Those are directions the authors identify after observing weak performance on some composed questions.
The authors report that they did not benchmark on ChartQA after finding examples with erroneous answer labels, questions that referred to information absent from the chart, and problems in some reference data tables. Their analysis gives examples of each kind of issue. A question about a ratio has a recorded answer that the authors say disagrees with the values in the chart. Other questions supply subjects or dates absent from the corresponding image. Even a valid question with a valid answer can yield an apparent execution error when the reference table itself has incorrect values. The decision leaves the program-synthesis results grounded in PlotQA V2.
The authors also qualify the implications for high-stakes use. They identify calibration or human intervention as necessary considerations in domains such as finance and medicine, where a wrong answer might propagate to a downstream decision. The paper evaluates benchmark accuracy and does not report a calibration experiment or deployment in any of those settings.
Limits of the evidence
The evaluation confirms denotation agreement, which is weaker than confirming the intended reasoning on every question. With no reference SQL for PlotQA, the forward filter can accept a query whose answer is right because of a coincidental relationship among values. The same issue affects the interpretation of test accuracy. A correct result establishes successful execution under the scoring rule. The visible SQL makes it possible to inspect the procedure, while the reported metric leaves its faithfulness unresolved. The paper illustrates inspectability through examples of generated programs and does not measure how faithfully those programs explain correct answers across the test set.
The backward filters likewise supply partial checks. A synthetic question can be similar in structure to a real one and mention the right operators while binding the wrong series, reversing the order of a subtraction, or placing a comparison in the wrong scope. The paper offers examples of filters removing noise and of difficult pairs failing to survive. It gives no independent estimate of how frequently accepted pairs preserve the full meaning of their programs. The method’s success thus establishes that the accepted data are helpful in aggregate on the reported benchmark.
The representative set is selected to cover recurring wording patterns in PlotQA. It comes from generalized questions clustered after a random sample, and the synthetic examples are judged partly by their resemblance to that set. Held-out charts and questions provide evidence of generalization within the benchmark. Performance on substantially different figure styles or questions written without the benchmark’s templating conventions remains unmeasured. The reported scores also reflect a pipeline tuned to the series, axes, and chart types considered in PlotQA.
The image pipeline makes assumptions that affect the numerical evidence available to SQL. Tick correction uses regular progressions, legend style helps identify series, and absent detections can become zeros. These choices give the reader a way to trace some failures. A missing mark can affect an average or a maximum, and a numerical-axis error can alter every recovered value in a series. The oracle comparison captures the aggregate impact of supplying better chart data. It leaves open how much each extraction assumption contributes to the outcome for particular question families.
The human result is a benchmark comparison. The authors cite difficulty in reading precise values from an image as an important source of human errors, even with a 5% margin. The proposed system exceeds the reported human total on the reasoning split while trailing the human comparison on yes/no questions. That combination supports a claim about the reported scoring conditions and question mix. It leaves broader human competence on chart interpretation outside the scope of the experiment.
Finally, the direct-answer comparison characterizes performance under the representative-question regime. The proposed approach uses external paired data, templates, explicit execution, and added synthetic pairs. Its results show what this combination achieves and why it is particularly well suited to computing unfamiliar numerical values. The experiment leaves open how the comparison would change with a common overall training budget or with a direct-answer system trained on the full chart training set and evaluated on the same reasoning subset. The paper’s full-data T5 result covers a different mixture of question types.
What came after
The paper’s account ends with a proposed extension for questions that require nested programs. The authors suggest searching hierarchically or using the grammar directly in program search. The experiments give a concrete reason for that direction. The existing grammar can express some difficult nested forms, yet many of those forms fail to become training pairs because the reverse translation loses their meaning. The extension is a proposal in the paper, with no reported follow-up result. There is no documented later-work example establishing how another study took up that proposal or built on the chart reasoning system.
Cite
Cite as Shabbirhussain Bhaisaheb, Shubham Paliwal, Rajaswa Patil, Manasi Patwardhan, Lovekesh Vig and Gautam Shroff. 2023. Program Synthesis for Complex QA on Charts via Probabilistic Grammar Based Filtered Iterative Back-Translation. Findings of the Association for Computational Linguistics: EACL 2023.
@inproceedings{bhaisaheb2023program,
title = {{Program Synthesis for Complex QA on Charts via Probabilistic Grammar Based Filtered Iterative Back-Translation}},
author = {Shabbirhussain Bhaisaheb, Shubham Paliwal, Rajaswa Patil, Manasi Patwardhan, Lovekesh Vig and Gautam Shroff},
booktitle = {Findings of the Association for Computational Linguistics: EACL 2023},
year = {2023},
doi = {10.18653/v1/2023.findings-eacl.189},
url = {https://doi.org/10.18653/v1/2023.findings-eacl.189}
}This page in Markdown https://md.research.elamur.ai/free/en/papers/bhaisaheb-2023-program-synthesis-complex-qa-charts/