Skip to main content

General Program Synthesis Using Guided Corpus Generation and Automatic Refactoring

  • Conference paper
  • First Online:
Search-Based Software Engineering (SSBSE 2019)

Part of the book series: Lecture Notes in Computer Science ((LNPSE,volume 11664))

Included in the following conference series:


Program synthesis aims to produce source code based on a user specification, raising the abstraction level of building systems and opening the potential for non-programmers to synthesise their own bespoke services. Both genetic programming (GP) and neural code synthesis have proposed a wide range of approaches to solving this problem, but both have limitations in generality and scope. We propose a hybrid search-based approach which combines (i) a genetic algorithm to autonomously generate a training corpus of programs centred around a set of highly abstracted hints describing interesting features; and (ii) a neural network which trains on this data and automatically refactors it towards a form which makes a more ideal use of the neural network’s representational capacity. When given an unseen program represented as a small set of input and output examples, our neural network is used to generate a rank-ordered search space of what it sees as the most promising programs; we then iterate through this list up to a given maximum search depth. Our results show that this approach is able to find up to 60% of a human-useful target set of programs that it has never seen before, including applying a clip function to the values in an array to restrict them to a given maximum, and offsetting all values in an array.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
USD 39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions


  1. 1.


  1. Balog, M., et al.: Deepcoder: Learning To Write Programs. ICLR (2017)

    Google Scholar 

  2. Chen, X., et al.: Towards synthesizing complex programs from input-output examples. ICLR, pp. 1–31 (2017)

    Google Scholar 

  3. Dabhi, V.K., Chaudhary, S.: Empirical modeling using genetic programming: a survey of issues and approaches. Nat. Comput. 14(2), 303–330 (2015)

    Article  MathSciNet  Google Scholar 

  4. Feng, Y., et al.: Program synthesis using conflict-driven learning, pp. 420–435 (2017)

    Article  Google Scholar 

  5. Feser, J.K., Chaudhuri, S., Dillig, I.: Synthesizing data structure transformations from input-output examples. In: Proceedings of the 36th ACM SIGPLAN Conference on Programming Language Design and Implementation. PLDI 2015, pp. 229–239 (2015)

    Google Scholar 

  6. Graves, A., et al.: Neural turing machines. CoRR, pp. 1–26 (2014)

    Google Scholar 

  7. Graves, A., et al.: Hybrid computing using a neural network with dynamic external memory. Nature 538(7626), 471–476 (2016)

    Article  Google Scholar 

  8. Gulwani, S.: Automating string processing in spreadsheets using input-output examples. In: ACM SIGPLAN Notices, vol. 46, no. (1), p. 317 (2011)

    Article  Google Scholar 

  9. Hinton, G., Vinyals, O., Dean, J.: Distilling the knowledge in a neural network, pp. 1–9 (2015).

  10. Kaiser, Ł., Sutskever, I.: Neural GPUs Learn Algorithms. ICLR, pp. 1–9 (2015)

    Google Scholar 

  11. Kawaguchi, K., Bengio, Y.: Depth with nonlinearity creates no bad local minima in ResNets, pp. 1–14 (2018)

    Google Scholar 

  12. Petke, J., et al.: Genetic improvement of software: a comprehensive survey. IEEE Trans. Evol. Comput. 22(3), 415–432 (2018)

    Article  Google Scholar 

  13. Renzullo, J., et al.: Neutrality and epistasis in program space, Gi, pp. 1–8 (2018)

    Google Scholar 

  14. Vijayakumar, A., et al.: Neural-guided deductive search for real-time program synthesis from examples. ICLR (2018)

    Google Scholar 

  15. Wu, S., Zhong, S., Liu, Y.: Deep residual learning for image steganalysis. Multimedia Tools Appl. 77(9), 10437–10453 (2017)

    Article  Google Scholar 

  16. Yampolskiy, R.V.: Why we do not evolve software? Analysis of evolutionary algorithms. Evol. Bioinform. Online 14(1), 1176934318815906 (2018)

    Google Scholar 

Download references


This work was supported by the Leverhulme Trust Research Project Grant The Emergent Data Centre, RPG-2017-166.

Author information

Authors and Affiliations


Corresponding author

Correspondence to Alexander Wild .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2019 Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Wild, A., Porter, B. (2019). General Program Synthesis Using Guided Corpus Generation and Automatic Refactoring. In: Nejati, S., Gay, G. (eds) Search-Based Software Engineering. SSBSE 2019. Lecture Notes in Computer Science(), vol 11664. Springer, Cham.

Download citation

  • DOI:

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-030-27454-2

  • Online ISBN: 978-3-030-27455-9

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics