liveBook · Manning

Program synthesis

As explained in Deep Learning with Python, Third Edition

A technique that automatically constructs programs satisfying a specification by searching over candidate code.

Program synthesis automatically constructs a simple program by searching through candidate code until one satisfies a specification, often expressed as input-output pairs. It resembles machine learning because both infer a mapping from examples, but synthesis generates source code through discrete search rather than fitting parameters in a fixed neural network. section 19.4.4

From examples to executable code

Provide a specification as several input-output pairs and a set of available building blocks. A search process assembles those blocks into candidate programs, tests each candidate against the specification, and stops when it finds a valid match. Genetic search is one possible search strategy. Unlike gradient-based learning, the result is a graph of programming-language operators that can express program-centric abstractions. section 19.4.4

Use these distinctions when choosing an approach:

  • Use deep learning for value-centric abstraction such as pattern recognition and intuition; use synthesis for program-centric abstraction such as discrete reasoning, planning, and causal understanding. section 19.4.5 section 20.3
  • Treat synthesis as a complement to deep learning, either by combining learned and algorithmic modules or by using learned intuition to guide the program search. section 19.4.5 section 20.3
  • Expect discrete search to remain the practical bottleneck because the space of possible programs is vast and combinatorial. section 20.3
Figure 19.14 A schematic view of program synthesis: given a program specification and a set of building blocks, a search process assembles the building blocks into candidate programs, which are then tested against the specification. The search continues until a valid program is found.
program synthesis

Trace the synthesis loop from a specification and building blocks through candidate construction and verification. section 19.4.4

How Deep Learning with Python, Third Edition covers it

How deep it goes
Explains specifications, candidate generation, discrete search, and verification, but stops short of implementation details.
Examples
Uses input-output specifications, operator-building-block diagrams, AlphaGo, and self-driving vehicles to illustrate synthesis and hybrid systems.
What it assumes
Assumes familiarity with machine learning and deep learning while defining program synthesis and its discrete-search contrast from basics.
What you can do after
Evaluate/understand when discrete program search complements neural models and why search efficiency matters.
How it connects
Connects program synthesis to machine learning, deep learning, genetic programming, test-time adaptation, and symbolic reasoning.

Also explained in

Compare how 2 books explain program synthesis →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Deep Learning with Python, Third Edition. The section links point to the parts of the book it draws on.