---
title: "Latent Predictor Networks for Code Generation — Ling 2016"
description: "From this they build two new corpora, Magic the Gathering (MTG, Java) and Hearthstone (HS… 35 references, cited by 104 papers here."
authors: ["Wang Ling", "Phil Blunsom", "Edward Grefenstette", "Karl Moritz Hermann", "Tomáš Kočiský", "Fumin Wang", "Andrew Senior"]
year: 2016
venue: "Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)"
source: "https://aclanthology.org/P16-1057/"
doi: "10.18653/v1/p16-1057"
arxiv: "1603.06744"
licence: "CC BY 4.0 (ACL Anthology)"
licence_url: "https://creativecommons.org/licenses/by/4.0/"
summary_licence: "Elamur Cosmic License"
canonical: "https://research.elamur.ai/free/en/papers/ling-2016-latent-predictor-networks-code-generation/"
---
[Elamur Research](https://md.research.elamur.ai/free/en/) · [this page in HTML](https://research.elamur.ai/free/en/papers/ling-2016-latent-predictor-networks-code-generation/)

[home](https://md.research.elamur.ai/free/en/) / [papers](https://md.research.elamur.ai/free/en/papers/) / [2016](https://md.research.elamur.ai/free/en/papers/2016/page/2/) / Latent Predictor Networks for Code Generation

# Latent Predictor Networks for Code Generation

**Authors:** [Wang Ling](https://md.research.elamur.ai/free/en/authors/wang-ling/), [Phil Blunsom](https://md.research.elamur.ai/free/en/authors/phil-blunsom/), [Edward Grefenstette](https://md.research.elamur.ai/free/en/authors/edward-grefenstette/), [Karl Moritz Hermann](https://md.research.elamur.ai/free/en/authors/karl-moritz-hermann/), [Tomáš Kočiský](https://md.research.elamur.ai/free/en/authors/tomas-kocisky/), [Fumin Wang](https://md.research.elamur.ai/free/en/authors/fumin-wang/) and [Andrew Senior](https://md.research.elamur.ai/free/en/authors/andrew-senior/) · **Year:** 2016 · **Venue:** [Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)](https://md.research.elamur.ai/free/en/venues/acl/) ([ACL 2016](https://md.research.elamur.ai/free/en/venues/acl/2016/)) · **Publisher:** [Association for Computational Linguistics](https://md.research.elamur.ai/free/en/publishers/association-for-computational-linguistics/) · **Licence:** [CC BY 4.0 (ACL Anthology)](https://creativecommons.org/licenses/by/4.0/)

**Links:** [Publisher's page](https://aclanthology.org/P16-1057/) · [PDF](https://aclanthology.org/P16-1057.pdf) · [DOI 10.18653/v1/p16-1057](https://doi.org/10.18653/v1/p16-1057) · [arXiv 1603.06744](https://arxiv.org/abs/1603.06744) · [OpenAlex](https://openalex.org/W2964325845)

**Citations:** 289 citations (OpenAlex, 2026-10-14) · [104](https://md.research.elamur.ai/free/en/papers/ling-2016-latent-predictor-networks-code-generation/cited-by/) in our library, of the 149,439 papers whose bibliographies we read

## Summary
The paper addresses generating program source code from specifications that mix free text with structured attributes. The authors use collectible card games as the testbed: each card's name, stats and effect text serve as the specification, and its implementation in an open-source game engine serves as the target. From this they build two new corpora, Magic the Gathering (MTG, Java) and Hearthstone (HS, Python), and also evaluate on the existing Django dataset.

Their model, Latent Predictor Networks (LPNs), produces code by switching between several predictors. A character-level softmax handles language tokens, and pointer networks copy spans such as card names or numbers directly from input fields. The predictor choice and segment length are treated as latent variables and summed out exactly, so no annotation is needed. The model also attends jointly over multiple input fields (structured attention) and compresses the target code.

The full system beats phrase-based, hierarchical, sequence-to-sequence and attention baselines on all three datasets. The work shows that mixing copying and generation predictors matters for producing long, structured outputs.

## Key points
- **MTG corpus:** 13,297 cards split 11,969/664/664. It has 6 singular and 4 text fields, about 21 description words per card, and about 1,080 code characters per card.
- **HS corpus:** 665 cards split 533/66/66. It has 8 singular and 2 text fields, about 7 description words, and about 352 code characters.
- **Architecture:** LPNs marginalise over which predictor emits each segment and over segments of different granularity (single characters vs. copied multi-token spans). Inputs are encoded with C2W embeddings, a Bi-LSTM and per-field linear projections.
- **Code compression:** In the reported compression experiment, BLEU rose from 59.7 to 67.1 for the LPN and from 44.2 to 52.7 for a plain softmax as compression increased from 0% to 80%. Decoding time per card also fell, from 3.29 s to 1.41 s for the LPN on one CPU.
- **Accuracy and errors:** Only the full system reached non-zero exact-match accuracy on the card datasets. Most remaining errors come from card effects that are unlike anything in training.

*Our summary of the paper, in our own words — not its text. The work belongs to its authors; read it at the links above.*

## Institutions

- [University of Oxford](https://md.research.elamur.ai/free/en/universities/university-of-oxford/) — University, Oxford, United Kingdom · 122 works · 160,277 citations
- [Google DeepMind](https://md.research.elamur.ai/free/en/companies/google-deepmind/) — Company, London, United Kingdom · 72 works · 84,326 citations

📚 Shelves (5): [🖥️ Computer Science](https://md.research.elamur.ai/free/en/shelves/computer-science/) · 18,614 works · [🤖 Artificial Intelligence](https://md.research.elamur.ai/free/en/shelves/computer-science/artificial-intelligence/) · 17,965 works · [🎭 Arts and Humanities](https://md.research.elamur.ai/free/en/shelves/arts-and-humanities/) · 17,450 works · [🗣️ Language and Linguistics](https://md.research.elamur.ai/free/en/shelves/arts-and-humanities/language-and-linguistics/) · 17,296 works · [🗄️ Information Systems](https://md.research.elamur.ai/free/en/shelves/computer-science/information-systems/) · 1,730 works

🧭 Topics (1): [💻 Code & programming languages](https://md.research.elamur.ai/free/en/topics/code-and-programming/) · 168 works

## Cite

Cite as: Wang Ling, Phil Blunsom, Edward Grefenstette, Karl Moritz Hermann, Tomáš Kočiský, Fumin Wang and Andrew Senior. 2016. Latent Predictor Networks for Code Generation. Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers).

The paper itself, not this page. BibTeX from the library's record of the work.

```bibtex
@inproceedings{ling2016latent,
  title = {{Latent Predictor Networks for Code Generation}},
  author = {Wang Ling, Phil Blunsom, Edward Grefenstette, Karl Moritz Hermann, Tomáš Kočiský, Fumin Wang and Andrew Senior},
  booktitle = {Proceedings of the 54th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)},
  year = {2016},
  doi = {10.18653/v1/p16-1057},
  eprint = {1603.06744},
  archivePrefix = {arXiv},
  url = {https://doi.org/10.18653/v1/p16-1057}
}
```

- [← previous Large-scale Analysis of Counseling Conversations: An Application of Natural Language Processing to Mental Health](https://md.research.elamur.ai/free/en/papers/althoff-2016-large-scale-analysis-counseling-conversations/)
- [next → Text Understanding with the Attention Sum Reader Network](https://md.research.elamur.ai/free/en/papers/kadlec-2016-text-understanding-attention-sum-reader/)
- [↑ back to papers of 2016](https://md.research.elamur.ai/free/en/papers/2016/page/2/)

## References

35 references, 16 of them with a card of ours. ↗ leads to the work, «find» searches for one we have no id for yet.

1. M. Allamanis, H. Peng, and C. Sutton. 2016. [A Convolutional Attention Network for Extreme Summarization of Source Code](https://md.research.elamur.ai/free/en/papers/allamanis-2016-convolutional-attention-network-extreme-summarization/). ArXiv e-prints, February.
2. Jacob Andreas, Andreas Vlachos, and Stephen Clark. 2013. Semantic parsing as machine translation. In Proceedings of the 51st Annual Meeting of the Association for Computational Linguistics, pages 47–52, August. [find](https://scholar.google.com/scholar?q=Jacob+Andreas%2C+Andreas+Vlachos%2C+and+Stephen+Clark%2E+2013%2E+Semantic+parsing+as+machine+translation%2E+In+Proceedings+of+the+51st+Annual+Meeting+of+the+Association+for+Computational+Linguistics%2C+pages+47%E2%80%935)
3. Proceedings of the 45th Annual Meeting of the ACL on Interactive Poster and Demonstration Sessions, pages 177–180. [find](https://scholar.google.com/scholar?q=Proceedings+of+the+45th+Annual+Meeting+of+the+ACL+on+Interactive+Poster+and+Demonstration+Sessions%2C+pages+177%E2%80%93180%2E)
4. Yoav Artzi, Kenton Lee, and Luke Zettlemoyer. 2015. [Broad-coverage ccg semantic parsing with amr](https://md.research.elamur.ai/free/en/papers/artzi-2015-broad-coverage-ccg-semantic-parsing/). In Proceedings of the 2015 Conference on Empirical Methods in Natural Language Processing, pages 1699–1710, September.
5. Nate Kushman and Regina Barzilay. 2013. Using semantic unification to generate regular expressions from natural language. In Proceedings of the 2013 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, pages 826–836, Atlanta, Georgia… [find](https://scholar.google.com/scholar?q=Nate+Kushman+and+Regina+Barzilay%2E+2013%2E+Using+semantic+unification+to+generate+regular+expressions+from+natural+language%2E+In+Proceedings+of+the+2013+Conference+of+the+North+American+Chapter+of+the+Ass)
6. Dzmitry Bahdanau, Kyunghyun Cho, and Yoshua Bengio. 2014. [Neural machine translation by jointly learning to align and translate](https://md.research.elamur.ai/free/en/papers/bahdanau-2014-neural-machine-translation-jointly-learning/). CoRR, abs/1409.0473.
7. Jonathan Berant, Andrew Chou, Roy Frostig, and Percy Liang. 2013. [Semantic parsing on freebase from question-answer pairs](https://md.research.elamur.ai/free/en/papers/berant-2013-semantic-parsing-freebase-question-answer/). In Proceedings of the 2013 Conference on Empirical Methods in Natural Language Processing, pages 1533–1544.
8. Tom Kwiatkowski, Luke Zettlemoyer, Sharon Goldwater, and Mark Steedman. 2010. Inducing probabilistic ccg grammars from logical form with higher-order unification. In Proceedings of the 2010 Conference on Empirical Methods in Natural Language Processing, pages 1223–1233. [find](https://scholar.google.com/scholar?q=Tom+Kwiatkowski%2C+Luke+Zettlemoyer%2C+Sharon+Goldwater%2C+and+Mark+Steedman%2E+2010%2E+Inducing+probabilistic+ccg+grammars+from+logical+form+with+higher%2Dorder+unification%2E+In+Proceedings+of+the+2010+Conference)
9. S. R. K. Branavan, Harr Chen, Luke S. Zettlemoyer, and Regina Barzilay. 2009. Reinforcement learning for mapping instructions to actions. In Proceedings of the Joint Conference of the 47th Annual Meeting of the ACL and the 4th International Joint Conference on Natural Language Processing of the AFNL… [find](https://scholar.google.com/scholar?q=S%2E+R%2E+K%2E+Branavan%2C+Harr+Chen%2C+Luke+S%2E+Zettlemoyer%2C+and+Regina+Barzilay%2E+2009%2E+Reinforcement+learning+for+mapping+instructions+to+actions%2E+In+Proceedings+of+the+Joint+Conference+of+the+47th+Annual+Meet)
10. Lample, M. Ballesteros, S. Subramanian, K. Kawakami, and C. Dyer. 2016. [Neural Architectures for Named Entity Recognition](https://md.research.elamur.ai/free/en/papers/lample-2016-neural-architectures-named-entity-recognition/). ArXiv e-prints, March.
11. Vu Le, Sumit Gulwani, and Zhendong Su. 2013. Smartsynth: Synthesizing smartphone automation scripts from natural language. In Proceeding of the 11th Annual International Conference on Mobile Systems, Applications, and Services, pages 193– 206. [find](https://scholar.google.com/scholar?q=Vu+Le%2C+Sumit+Gulwani%2C+and+Zhendong+Su%2E+2013%2E+Smartsynth%3A+Synthesizing+smartphone+automation+scripts+from+natural+language%2E+In+Proceeding+of+the+11th+Annual+International+Conference+on+Mobile+Systems%2C+)
12. David Chiang. 2007. [Hierarchical phrase-based translation](https://md.research.elamur.ai/free/en/papers/chiang-2007-hierarchical-phrase-based-translation/). Comput. Linguist., 33(2):201–228, June.
13. Ronan Collobert, Jason Weston, Léon Bottou, Michael Karlen, Koray Kavukcuoglu, and Pavel Kuksa. 2011. [Natural language processing (almost) from scratch](https://md.research.elamur.ai/free/en/papers/collobert-2011-natural-language-processing-almost-scratch/). J. Mach. Learn. Res., 12:2493–2537, November.
14. Tao Lei, Fan Long, Regina Barzilay, and Martin Rinard. 2013. From natural language specifications to program input parsers. In Proceedings of the 51st Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers), pages 1294–1303, Sofia, Bulgaria, August. [find](https://scholar.google.com/scholar?q=Tao+Lei%2C+Fan+Long%2C+Regina+Barzilay%2C+and+Martin+Rinard%2E+2013%2E+From+natural+language+specifications+to+program+input+parsers%2E+In+Proceedings+of+the+51st+Annual+Meeting+of+the+Association+for+Computation)
15. Kenneth Heafield, Ivan Pouzyrevsky, Jonathan H. Clark, and Philipp Koehn. 2013. [Scalable modified Kneser-Ney language model estimation](https://md.research.elamur.ai/free/en/papers/heafield-2013-scalable-modified-kneser-ney-language/). In Proceedings of the 51th Annual Meeting on Association for Computational Linguistics, pages 690–696.
16. Wang Ling, Tiago Luı́s, Luı́s Marujo, Rámon Fernandez Astudillo, Silvio Amir, Chris Dyer, Alan W Black, and Isabel Trancoso. 2015. [Finding function in form: Compositional character models for open vocabulary word representation](https://md.research.elamur.ai/free/en/papers/ling-2015-finding-function-form-compositional-character/). In Proceedings of the 2015 Conference on Empirical Methods in Natural…
17. Sepp Hochreiter and Jürgen Schmidhuber. 1997. Long short-term memory. Neural Comput., 9(8):1735– 1780, November. [find](https://scholar.google.com/scholar?q=Sepp+Hochreiter+and+Ju%CC%88rgen+Schmidhuber%2E+1997%2E+Long+short%2Dterm+memory%2E+Neural+Comput%2E%2C+9%288%29%3A1735%E2%80%93+1780%2C+November%2E)
18. Bevan Keeley Jones, Mark Johnson, and Sharon Goldwater. 2012. Semantic parsing with bayesian tree transducers. In Proceedings of the 50th Annual Meeting of the Association for Computational Linguistics, pages 488–496. [find](https://scholar.google.com/scholar?q=Bevan+Keeley+Jones%2C+Mark+Johnson%2C+and+Sharon+Goldwater%2E+2012%2E+Semantic+parsing+with+bayesian+tree+transducers%2E+In+Proceedings+of+the+50th+Annual+Meeting+of+the+Association+for+Computational+Linguistic)
19. Wei Lu, Hwee Tou Ng, Wee Sun Lee, and Luke S. Zettlemoyer. 2008. [A generative model for parsing natural language to meaning representations](https://md.research.elamur.ai/free/en/papers/lu-2008-generative-model-parsing-natural-language/). In Proceedings of the 2008 Conference on Empirical Methods in Natural Language Processing, EMNLP ’08, pages 783–792, Stroudsburg, PA, USA. Association for Comp…
20. Rafal Józefowicz, Oriol Vinyals, Mike Schuster, Noam Shazeer, and Yonghui Wu. 2016. Exploring the limits of language modeling. CoRR, abs/1602.02410. [find](https://scholar.google.com/scholar?q=Rafal+Jo%CC%81zefowicz%2C+Oriol+Vinyals%2C+Mike+Schuster%2C+Noam+Shazeer%2C+and+Yonghui+Wu%2E+2016%2E+Exploring+the+limits+of+language+modeling%2E+CoRR%2C+abs%2F1602%2E02410%2E)
21. Rohit J. Kate, Yuk Wah Wong, and Raymond J. Mooney. 2005. Learning to transform natural to formal languages. In Proceedings of the Twentieth National Conference on Artificial Intelligence (AAAI-05), pages 1062–1068, Pittsburgh, PA, July. [find](https://scholar.google.com/scholar?q=Rohit+J%2E+Kate%2C+Yuk+Wah+Wong%2C+and+Raymond+J%2E+Mooney%2E+2005%2E+Learning+to+transform+natural+to+formal+languages%2E+In+Proceedings+of+the+Twentieth+National+Conference+on+Artificial+Intelligence+%28AAAI%2D05%29%2C+p)
22. Mehdi Hafezi Manshadi, Daniel Gildea, and James F. Allen. 2013. Integrating programming by example and natural language programming. In Marie desJardins and Michael L. Littman, editors, AAAI. AAAI Press. [find](https://scholar.google.com/scholar?q=Mehdi+Hafezi+Manshadi%2C+Daniel+Gildea%2C+and+James+F%2E+Allen%2E+2013%2E+Integrating+programming+by+example+and+natural+language+programming%2E+In+Marie+desJardins+and+Michael+L%2E+Littman%2C+editors%2C+AAAI%2E+AAAI+Pre)
23. Philipp Koehn, Hieu Hoang, Alexandra Birch, Chris Callison-Burch, Marcello Federico, Nicola Bertoldi, Brooke Cowan, Wade Shen, Christine Moran, Richard Zens, Chris Dyer, Ondřej Bojar, Alexandra Constantin, and Evan Herbst. 2007. Moses: Open source toolkit for statistical machine translation. In Lil… — [arXiv:1510.07211](https://arxiv.org/abs/1510.07211) [find](https://scholar.google.com/scholar?q=Philipp+Koehn%2C+Hieu+Hoang%2C+Alexandra+Birch%2C+Chris+Callison%2DBurch%2C+Marcello+Federico%2C+Nicola+Bertoldi%2C+Brooke+Cowan%2C+Wade+Shen%2C+Christine+Moran%2C+Richard+Zens%2C+Chris+Dyer%2C+Ondr%CC%8Cej+Bojar%2C+Alexandra+Const)
24. John M. Zelle and Raymond J. Mooney. 1996. [Learning to parse database queries using inductive logic programming](https://md.research.elamur.ai/free/en/papers/zelle-1996-learning-parse-database-queries-using/). In AAAI/IAAI, pages 1050–1055, Portland, OR, August. AAAI Press/MIT Press.
25. Franz Josef Och and Hermann Ney. 2003. A systematic comparison of various statistical alignment models. Comput. Linguist., 29(1):19–51, March. [find](https://scholar.google.com/scholar?q=Franz+Josef+Och+and+Hermann+Ney%2E+2003%2E+A+systematic+comparison+of+various+statistical+alignment+models%2E+Comput%2E+Linguist%2E%2C+29%281%29%3A19%E2%80%9351%2C+March%2E)
26. Yusuke Oda, Hiroyuki Fudaba, Graham Neubig, Hideaki Hata, Sakriani Sakti, Tomoki Toda, and Satoshi Nakamura. 2015. Learning to generate pseudo-code from source code using statistical machine translation. In 30th IEEE/ACM International Conference on Automated Software Engineering (ASE), Lincoln, Nebr… [find](https://scholar.google.com/scholar?q=Yusuke+Oda%2C+Hiroyuki+Fudaba%2C+Graham+Neubig%2C+Hideaki+Hata%2C+Sakriani+Sakti%2C+Tomoki+Toda%2C+and+Satoshi+Nakamura%2E+2015%2E+Learning+to+generate+pseudo%2Dcode+from+source+code+using+statistical+machine+translati)
27. Kishore Papineni, Salim Roukos, Todd Ward, and Wei-Jing Zhu. 2002. [Bleu: A method for automatic evaluation of machine translation](https://md.research.elamur.ai/free/en/papers/papineni-2002-bleu-method-automatic-evaluation-machine/). In Proceedings of the 40th Annual Meeting on Association for Computational Linguistics, pages 311–318.
28. Chris Quirk, Raymond Mooney, and Michel Galley. 2015. [Language to code: Learning semantic parsers for if-this-then-that recipes](https://md.research.elamur.ai/free/en/papers/quirk-2015-language-code-learning-semantic-parsers/). In Proceedings of the 53rd Annual Meeting of the Association for Computational Linguistics, pages 878–888, Beijing, China, July.
29. Sunita Sarawagi and William W. Cohen. 2005. Semi-markov conditional random fields for information extraction. In L. K. Saul, Y. Weiss, and L. Bottou, editors, Advances in Neural Information Processing Systems 17, pages 1185–1192. MIT Press. [find](https://scholar.google.com/scholar?q=Sunita+Sarawagi+and+William+W%2E+Cohen%2E+2005%2E+Semi%2Dmarkov+conditional+random+fields+for+information+extraction%2E+In+L%2E+K%2E+Saul%2C+Y%2E+Weiss%2C+and+L%2E+Bottou%2C+editors%2C+Advances+in+Neural+Information+Processing)
30. Artem Sokolov and François Yvon. 2011. Minimum Error Rate Semi-Ring. In Mikel Forcada and Heidi Depraetere, editors, Proceedings of the European Conference on Machine Translation, pages 241–248, Leuven, Belgium. [find](https://scholar.google.com/scholar?q=Artem+Sokolov+and+Franc%CC%A7ois+Yvon%2E+2011%2E+Minimum+Error+Rate+Semi%2DRing%2E+In+Mikel+Forcada+and+Heidi+Depraetere%2C+editors%2C+Proceedings+of+the+European+Conference+on+Machine+Translation%2C+pages+241%E2%80%93248%2C+Leuv)
31. Ilya Sutskever, Oriol Vinyals, and Quoc V. Le. 2014. [Sequence to sequence learning with neural networks](https://md.research.elamur.ai/free/en/papers/sutskever-2014-sequence-sequence-learning-neural-networks/). CoRR, abs/1409.3215.
32. David Vadas and James R. Curran. 2005. Programming with unrestricted natural language. In Proceedings of the Australasian Language Technology Workshop 2005, pages 191–199, Sydney, Australia, December. [find](https://scholar.google.com/scholar?q=David+Vadas+and+James+R%2E+Curran%2E+2005%2E+Programming+with+unrestricted+natural+language%2E+In+Proceedings+of+the+Australasian+Language+Technology+Workshop+2005%2C+pages+191%E2%80%93199%2C+Sydney%2C+Australia%2C+December%2E)
33. Oriol Vinyals, Meire Fortunato, and Navdeep Jaitly. 2015. Pointer networks. In C. Cortes, N.D. Lawrence, D.D. Lee, M. Sugiyama, and R. Garnett, editors, Advances in Neural Information Processing Systems 28, pages 2674–2682. Curran Associates, Inc. [find](https://scholar.google.com/scholar?q=Oriol+Vinyals%2C+Meire+Fortunato%2C+and+Navdeep+Jaitly%2E+2015%2E+Pointer+networks%2E+In+C%2E+Cortes%2C+N%2ED%2E+Lawrence%2C+D%2ED%2E+Lee%2C+M%2E+Sugiyama%2C+and+R%2E+Garnett%2C+editors%2C+Advances+in+Neural+Information+Processing+Syste)
34. Yuk Wah Wong and Raymond J. Mooney. 2006. [Learning for semantic parsing with statistical machine translation](https://md.research.elamur.ai/free/en/papers/wong-2006-learning-semantic-parsing-statistical-machine/). In Proceedings of the Main Conference on Human Language Technology Conference of the North American Chapter of the Association of Computational Linguistics, pages 439–446.
35. Matthew D. Zeiler. 2012. [ADADELTA: an adaptive learning rate method](https://md.research.elamur.ai/free/en/papers/zeiler-2012-adadelta-adaptive-learning-rate-method/). CoRR, abs/1212.5701.

*Updated 2 November 2026*
