COMS 3997 · Neurosymbolic AI · Week 3
Neural Program Learning under Noisy I/O
Devlin, Uesato, Bhupatiraju, Singh, Mohamed, Kohli · ICML 2017
| Input | Output |
|---|---|
| john Smith | Smith, Jhn |
| DOUG Q. Macklin | Macklin, Doug |
| Frank Lee (123) | LEe, Frank |
| Laura Jane Jones | Jones, Laura |
| Steve P. Green (9) | Green, Steve |
Figure 1 of the paper: the user's outputs contain typos (“Jhn”, “LEe”). The last row should still come out right.
The problem
Hand-crafted operator semantics, pruning and ranking. Accurate on clean examples.
But: “difficult to extend and fragile to noise”. Its efficiency rests on exact string matching.
Learned from data, so in principle extensible and tolerant of noise.
But: the best prior model (Parisotto et al., 2017) solved only 34% of real FlashFill tasks.
RobustFill · Devlin et al., ICML 2017
2
Where this comes from
2011
Version spaces over a string DSL (POPL)
2013
Ships in Excel 2013: program synthesis behind a single keystroke
2015
The same idea for any DSL (Polozov and Gulwani, OOPSLA)
2017
A neural model on a FlashFill-style DSL, tolerating noisy examples (ICML). This paper.
RobustFill · Devlin et al., ICML 2017
3
The one idea to remember
A network trained on hundreds of millions of random programs proposes a beam of candidates. Running each one on the examples keeps only the consistent ones. Noise becomes something to train on, not something that empties the search.
Side by side
| FlashFill (2011) | RobustFill (2017) | |
|---|---|---|
| Search | Version-space algebra: every consistent program, as DAGs; intersect | Beam search from a learned model |
| Prior | Hand-written ranking (Occam's razor) | Learned from 256M random programs |
| Consistency | Guaranteed by construction | Checked by executing each candidate |
| Noise | Exact matching; one heuristic flags a single odd example as a likely typo | Trained on noisy examples; pick by edit distance |
| Engineering | Inverse semantics for every operator | A DSL interpreter plus a random program generator |
RobustFill · Devlin et al., ICML 2017
5
The language
p := Concat(e1, e2, e3, …)
e := f | n | n1(n2) | n(f) | ConstStr(c)
f := SubStr(k1, k2)
| GetSpan(r1, i1, y1, r2, i2, y2)
n := GetToken(t, i) | ToCase(s)
| Replace(δ1, δ2) | Trim()
| GetUpto(r) | GetFrom(r)
| GetFirst(t, i) | GetAll(t)
~30M
unique expressions e, concatenated into programs of any length
~20%
of test tasks need GetSpan, which grew the search space 10×
RobustFill · Devlin et al., ICML 2017 · Figure 2, Sections 3.2 and 5.1
6
Synthesis, with induction as the baseline
Synthesis: this is RobustFill (Sections 4, 5 and 7)
4 I/O examples
Neural net
A DSL program P
Interpreter runs P on new rows
For example, P = GetToken(Alpha, −1) | “, ” | ToCase(Proper, GetToken(Alpha, 1)). The net is probabilistic and proposes candidates; P is an ordinary deterministic program: same input, same output, every time. It can be checked against the examples, read and reused.
Induction: a baseline the paper also trains, for comparison only (Section 6)
4 I/O examples + a new input
Neural net
no program in between
The output string, char by char
Everything from here on (architecture, beam search, results, noise) is the synthesis model. Only slide 11 brings induction back, to ask whether writing a program is worth it.
RobustFill · Devlin et al., ICML 2017 · Sections 3.1 and 6
7
Architecture
Output softmax → next program token
FC + MaxPool across examples
P1 · program
P2 · program
Pn · program
O1 · output
O2 · output
On · output
I1 · input
I2 · input
In · input
Weights shared across examples. The P layers' hidden states are max-pooled at every step.
| Variant | What it adds |
|---|---|
| Basic Seq-to-Seq | LSTMs, no attention |
| Attention-A | O attends to I; P attends to O |
| Attention-B | P attends to O and I (double attention) |
| Attention-C | B, with bidirectional I and O encoders |
RobustFill · Devlin et al., ICML 2017 · Section 4
8
Decoding
Beam search: the k best programs
→
Run each on the 4 observed inputs
→
Keep the highest-scoring consistent one
Each time an expression is completed, execute the partial program. If its output isn't a prefix of the target output, drop it from the beam. This works because the DSL is concatenative.
~0.3 s
per task on a Titan X GPU (Attention-C-DP, beam 100: 89%)
RobustFill · Devlin et al., ICML 2017 · Section 5
9
Results on FlashFillTest
| System | Beam 100 | Beam 1000 |
|---|---|---|
| Parisotto et al. (2017) | 23% | 34% |
| Basic Seq-to-Seq | 51% | 56% |
| Attention-C | 83% | 86% |
| Attention-C-DP | 89% | 92% |
205 real tasks from Excel spreadsheets, supplied by the FlashFill and Parisotto authors.
Attention alone adds roughly 25 points over the basic model.
RobustFill · Devlin et al., ICML 2017 · Sections 3.3 and 5.1
10
Synthesis vs. induction
81%
synthesis (Attention-A, beam 100). All or nothing: under 10% of tasks partly right.
53%
induction, same architecture. 33% of tasks partly right, since each output is decoded separately.
Fill a whole column: prefer synthesis. When it answers, every row is right.
Per-cell autocomplete: induction's partial credit counts for more.
RobustFill · Devlin et al., ICML 2017 · Section 6
11
Noisy examples
92%
Excel FlashFill with no noise, matching our best model
80%
RobustFill with noise; about 2 points lost per noisy character
6%
Excel FlashFill with noise: “effectively broken” after 1–2 characters
Noise = random character insertions, deletions and substitutions in the observed examples. RobustFill trains on the same kind of noise and picks the program with the lowest edit distance to the examples.
RobustFill · Devlin et al., ICML 2017 · Section 1 and Section 7
12
Champion · the case for a best paper award
92% on 205 real spreadsheet tasks, up from 34% for the best earlier neural model, and on par with FlashFill on clean data.
To add an operator, add it to the interpreter and the random generator. Typos become something you train on: 80% vs 6% with noise.
The template of a neural proposer with a symbolic checker. Next week, DeepCoder uses a network to guide a symbolic search instead of replacing it.
Both come from generators the authors wrote, and the noise at test time has the same form as in training. That doesn't sink it: the headline accuracy is measured on 205 real tasks, and the core claim, that a learned proposer checked by execution rivals a hand-built synthesizer, is tested there.
RobustFill · Devlin et al., ICML 2017
13
Critic · Reviewer 2, recommends reject
| Concern | An experiment that would test it |
|---|---|
| The noise is synthetic, uniform character edits, matched to training | Evaluate on real user typos, and on noise types the model never trained on. |
| FlashFill's noise defence is one heuristic for a single odd example | Compare against a version-space algebra with approximate matching, or leave-one-example-out voting. |
| Beam 1 is consistent only ~50% of the time, so search does much of the work | Give an enumerative synthesizer with DP pruning the same time budget, and compare. |
| Random programs on random ASCII strings | Test how accuracy changes as inputs drift from the generator's distribution. |
The one experiment that would change my score: Test on real user typos against a FlashFill that also selects programs by edit distance, with an equal compute budget.
RobustFill · Devlin et al., ICML 2017
14
Discussion
1
RobustFill still needs the DSL to generate its training data and to check its answers. Is it neural, or neurosymbolic?
2
Synthesis wins on all-or-nothing accuracy; induction earns partial credit. Which matches what users want?
3
Could one system have FlashFill's guarantees and RobustFill's tolerance for typos? What would it look like?