SlideShare a Scribd company logo
Andrey Z
a
kh
a
revich for MLST, 9.03.2022
Program Synthesis,
DreamCoder and ARC
About me
• 2002 —
fi
rst Hello World 🤯


• 2010 — dropped out from the university


• 2012-2021 — various software engineering jobs, mostly backend


• 2013 —
fi
rst neural network, in Ruby (sic)


• 2018 — immigrated to Israel


• March 2020 — started working on an ARC solution


• July 2021 — learned about DreamCoder and switched to using it as a base for an
ARC solution attempt
Outline
• What is program synthesis


• Top-level overview of DreamCoder


• What is ARC and why it is important


• My own insights from working on all this and possible directions
Program Synthesis
• Task de
fi
nition


• ????


• PROGRAM!
Program synthesis
• Input-output pairs (FlashMeta, DreamCoder)


• Text prompt (Codex, Copilot)


• Logical constraints (Coq)


• High-level code (compilers)
Task definition
Program synthesis
• Incremental search over a tree of possible programs


• Tree is exponentially big


• Hard to evaluate incomplete programs


• Full-text generation by language model


• Hard to ensure syntax, type, and memory correctness


• Prompts usually don’t include tests


• Genetic programming


• Needs mutation and crossover operations that preserve code correctness


• Hard to de
fi
ne which intermediate programs are more “
fi
t”
Main approaches
DreamCoder
1. Takes a set of tasks


2. Starts with a library (or grammar) of primitive functions


3. (Enumeration) Tries to solve tasks with the current grammar


4. Generates more possible programs from the current grammar (dreams)


5. (Recognition) Trains a neural network on found solutions and dreams that
predicts probabilities of each function from a string of task description


6. (Enumeration) Tries to solve tasks again, this time using probabilities from NN


7. (Compression) Looks for repeated patterns in found solutions, adds them to
grammar


8. Goes to step 3
DreamCoder
• Takes a set of tasks of the same type and a
grammar


• Programs are expressions of typed lambda calculus
with De Bruijn indexing


• Search starts from a single Hole ( ?? ) of expected
type


• All primitives from the grammar are checked if they
can unify with the hole type


• All possibilities are weighted according to the
grammar, partial solutions are stored in a priority
queue


• When all holes are
fi
lled, the program is checked
against all unsolved tasks
Enumeration
(
?
?
[list(int)
-
>
list(int)] )
(lambda
?
?
[list(int)] )
(lambda empty) (lambda $0)
(lambda (cons
?
?
[int]
?
?
[list(int)] )
…
(lambda (cons 0
?
?
[list(int)] ) …
DreamCoder
• Type-correctness requires that we go from output to input


• We can’t check partial programs for runtime correctness, all the possible solutions
of (cons (car empty)
?
?
) will be explored (within priorities and time limit)


• Can generate in
fi
nite loops, requires timeouts and interruption management
Enumeration
DreamCoder
Generates many transformations of found
programs and looks for repeating
subprograms such that adding them to
library reduces combined length of all
found solutions and the library itself
Compression
DreamCoder
• RNN with LSTM layers


• Input is task de
fi
nition


• Di
ff
erent domains can have di
ff
erent features (like a couple CNN layers for image
domains)


• For a grammar with n functions NN will have n+1 outputs


• Each output is a probability that the corresponding function is used in the
solution to the task


• The last output is the probability of a free variable term
Recognition
DreamCoder
• Gradually expands its library of available functions, thus learning new discrete
concepts without human guidance


• NN model can be referred to as an intuition part. “This task looks like I should
totally use reduce and not map in the solution”


• No support of dependent types means that we can’t propagate constraints
through holes, see (car empty) example


• Single probability for a function may be not enough for complex problems with
long solutions that utilize a big portion of the library. There is the context
grammar extension, but it’s still fairly limited


• Lambda calculus may be quite limited for e
ffi
cient algorithms
Overall
Abstraction and Reasoning Corpus
• Introduced by François Chollet in “On the
Measure of Intelligence”


• Solvable by humans but not machines


• Targets ability to operate with complex
combinations of abstract patterns without
knowledge about real world, except for
Core Knowledge


• Has parallels with skill acquisition


• Private test set su
ffi
ciently di
ff
erent from
public train and test data


• Tests developer-aware generalization
Intermission
How do I solve these tasks?
How do I solve these tasks?
How do I solve these tasks?
Abstractors
• A.k.a reversible functions


• Somewhat akin to witness functions from FlashMeta


• A combination of to_abstract and from_abstract operations


• Preserve information, but present it in a di
ff
erent, possibly more e
ffi
cient way


• to_abstract can have several outputs


• to_abstract can output several possible options


• Examples: grid_size, extract_background, extract_objects,
group_similar_items, group_objects_by_color, vert_symmetry
How to evaluate representations?
A good evaluation function should:


• Work on di
ff
erent data types


• Probably not Monte-Carlo — if it returns non-zero result, we have a solution


My current solution is weighted Kolmogorov complexity.


• Each type has a certain weight per item


• Items of complex types use sum of the weight of all their subitems plus the
weight of the type itself
Intermediate results
• Solved 34/400 training tasks with a threshold of 500 visited partial solutions


• Abstractor library was quite limited


• I had to write all abstractors by hand


• I had to manually pick weights for di
ff
erent abstractors and types
Moving to DreamCoder
• It can learn new functions from primitives on its own


• It can learn weights for functions on its own
Why?
Moving to DreamCoder
• Written in OCaml — no type information in runtime, hard to experiment, not so
easy to read


• Creating programs from output to input means that I don’t have any intermediate
representations to evaluate during the search
Obstacles
Moving to DreamCoder
• No runtime type information in OCaml and absolute type strictness (you can have
either unit ref and have no idea what’s inside, or manually specify all the
possible options) meant that I can’t manipulate any intermediate representations
at all. The solution is to rewrite it to another more dynamic language, I chose Julia


• Introduce named variables to generated programs as in let $x = … in …


• Make search bidirectional, go for simpler representations of both input and
output while checking if new representations can help in explaining the output


• Add a special class of reversible functions, specify how they can be combined so
that the compression step will be able to learn new abstractors without losing
their reversible nature


• Measure intermediate data complexity, learn type weight alongside function
probabilities
Path to solution
Moving to DreamCoder
• What is the best way to evaluate a program with a types and functions weights
set? If we make decisions based on the qualities of intermediate representations,
it’s no longer an admissible search problem


• Should we run NN model not only in the beginning of an attempt to solve a task,
but also on some intermediate representations? We are no longer constraint by
OCaml here, but our model should be able to deal with various data types on its
own without our additional feature engineering


• Should we add dependent types support and learn aliases for them? Rectangle is
still an object but it supports some very speci
fi
c set of operations
Questions
References
• Kevin Ellis, Lucas Morales, Mathias Sable ́-Meyer, Armando Solar-Lezama, and Josh
Tenenbaum: Library learning for neurally-guided bayesian program induction. (2018)


• Ellis, K., Wong, C., Nye, M., Sable-Meyer, M., Cary, L., Morales, L., Hewitt, L.,


Solar-Lezama, A., Tenenbaum, J.B.: Dreamcoder: Growing generalizable, inter-


pretable knowledge with wake-sleep bayesian program learning (2020)


• Chollet, F.: On the measure of intelligence (2019)


• Polozov, O., Gulwani, S.: Flashmeta: a framework for inductive program synthesis. In: Aldrich,
J., Eugster, P. (eds.) OOPSLA. pp. 107–126. ACM (2015), http: //dblp.uni-trier.de/db/conf/
oopsla/oopsla2015.html#PolozovG15


• Alford, S., Gandhi, A., Rangamani, A., Banburski, A., Wang, T., Dandekar, S., ... & Chin, P. (2021,
November). Neural-Guided, Bidirectional Program Search for Abstraction and Reasoning.
In International Conference on Complex Networks and Their Applications (pp. 657-668).
Springer, Cham.
That’s all!
• I’m open for collaboration and discussions


• I’m also open for employment, especially on
something related


• https://github.com/andreyz4k/ec/tree/
julia_enumerator


• https://www.linkedin.com/in/
andreyzakharevich/


• Or @andreyz4k on most social media

More Related Content

PPTX
Gaussian noise
PDF
Chapter 2. Digital Image Fundamentals.pdf
PPTX
Perceptron & Neural Networks
PPTX
Generative Adversarial Network (GANs).
PPTX
Uncertain Knowledge and Reasoning in Artificial Intelligence
PPTX
Adversarial search
PDF
Regularization
PPT
Vanishing & Exploding Gradients
Gaussian noise
Chapter 2. Digital Image Fundamentals.pdf
Perceptron & Neural Networks
Generative Adversarial Network (GANs).
Uncertain Knowledge and Reasoning in Artificial Intelligence
Adversarial search
Regularization
Vanishing & Exploding Gradients

What's hot (20)

PPTX
Unification and Lifting
PDF
Daa notes 3
PPTX
PPTX
Support Vector Machine ppt presentation
PDF
AI meets Big Data
PPTX
Multilayer & Back propagation algorithm
PPT
First order logic
PDF
Training Neural Networks
PPTX
Advanced topics in artificial neural networks
PPTX
K-Nearest Neighbor Classifier
PPTX
PAC Learning and The VC Dimension
PDF
Bayesian classification
PPTX
Autoencoders in Deep Learning
PPTX
Compiler Design Unit 3
PDF
02 Machine Learning - Introduction probability
PDF
L2. Evaluating Machine Learning Algorithms I
PPTX
Cascade R-CNN_ Delving into High Quality Object Detection.pptx
PPTX
Attention in Deep Learning
PDF
linear classification
Unification and Lifting
Daa notes 3
Support Vector Machine ppt presentation
AI meets Big Data
Multilayer & Back propagation algorithm
First order logic
Training Neural Networks
Advanced topics in artificial neural networks
K-Nearest Neighbor Classifier
PAC Learning and The VC Dimension
Bayesian classification
Autoencoders in Deep Learning
Compiler Design Unit 3
02 Machine Learning - Introduction probability
L2. Evaluating Machine Learning Algorithms I
Cascade R-CNN_ Delving into High Quality Object Detection.pptx
Attention in Deep Learning
linear classification
Ad

Similar to Program Synthesis, DreamCoder, and ARC (20)

PPTX
2CPP19 - Summation
PPT
Problem solving
PPTX
[OOP - Lec 01] Introduction to OOP
PPT
Oop(object oriented programming)
PPTX
SE-IT JAVA LAB OOP CONCEPT
PPTX
CPP16 - Object Design
PPT
History of Object Orientation in OOP.ppt
PPT
History of Object Orientation in OOP.ppt
PDF
Are High Level Programming Languages for Multicore and Safety Critical Conver...
PDF
6_Object-oriented-using-java.pdf object oriented programming concepts
PPTX
Different paradigms for problem solving.pptx
PPTX
The Big Picture
PPT
Java Fundamentalojhgghjjjjhhgghhjjjjhhj.ppt
PPTX
tensorflow.pptx
PPTX
CPP02 - The Structure of a Program
PPTX
[OOP - Lec 02] Why do we need OOP
PPTX
SKILLWISE - OOPS CONCEPT
PPTX
Metaprogramming in Ruby
PPTX
Introduction to Software - Coder Forge - John Mulhall
2CPP19 - Summation
Problem solving
[OOP - Lec 01] Introduction to OOP
Oop(object oriented programming)
SE-IT JAVA LAB OOP CONCEPT
CPP16 - Object Design
History of Object Orientation in OOP.ppt
History of Object Orientation in OOP.ppt
Are High Level Programming Languages for Multicore and Safety Critical Conver...
6_Object-oriented-using-java.pdf object oriented programming concepts
Different paradigms for problem solving.pptx
The Big Picture
Java Fundamentalojhgghjjjjhhgghhjjjjhhj.ppt
tensorflow.pptx
CPP02 - The Structure of a Program
[OOP - Lec 02] Why do we need OOP
SKILLWISE - OOPS CONCEPT
Metaprogramming in Ruby
Introduction to Software - Coder Forge - John Mulhall
Ad

Recently uploaded (20)

PPTX
A Presentation on Artificial Intelligence
PPTX
Big Data Technologies - Introduction.pptx
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Empathic Computing: Creating Shared Understanding
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PPT
Teaching material agriculture food technology
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
cuic standard and advanced reporting.pdf
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
Cloud computing and distributed systems.
PDF
Electronic commerce courselecture one. Pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
A Presentation on Artificial Intelligence
Big Data Technologies - Introduction.pptx
MYSQL Presentation for SQL database connectivity
Empathic Computing: Creating Shared Understanding
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
“AI and Expert System Decision Support & Business Intelligence Systems”
Dropbox Q2 2025 Financial Results & Investor Presentation
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Assigned Numbers - 2025 - Bluetooth® Document
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Digital-Transformation-Roadmap-for-Companies.pptx
Diabetes mellitus diagnosis method based random forest with bat algorithm
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Teaching material agriculture food technology
The AUB Centre for AI in Media Proposal.docx
cuic standard and advanced reporting.pdf
Chapter 3 Spatial Domain Image Processing.pdf
Cloud computing and distributed systems.
Electronic commerce courselecture one. Pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?

Program Synthesis, DreamCoder, and ARC

  • 1. Andrey Z a kh a revich for MLST, 9.03.2022 Program Synthesis, DreamCoder and ARC
  • 2. About me • 2002 — fi rst Hello World 🤯 • 2010 — dropped out from the university • 2012-2021 — various software engineering jobs, mostly backend • 2013 — fi rst neural network, in Ruby (sic) • 2018 — immigrated to Israel • March 2020 — started working on an ARC solution • July 2021 — learned about DreamCoder and switched to using it as a base for an ARC solution attempt
  • 3. Outline • What is program synthesis • Top-level overview of DreamCoder • What is ARC and why it is important • My own insights from working on all this and possible directions
  • 4. Program Synthesis • Task de fi nition • ???? • PROGRAM!
  • 5. Program synthesis • Input-output pairs (FlashMeta, DreamCoder) • Text prompt (Codex, Copilot) • Logical constraints (Coq) • High-level code (compilers) Task definition
  • 6. Program synthesis • Incremental search over a tree of possible programs • Tree is exponentially big • Hard to evaluate incomplete programs • Full-text generation by language model • Hard to ensure syntax, type, and memory correctness • Prompts usually don’t include tests • Genetic programming • Needs mutation and crossover operations that preserve code correctness • Hard to de fi ne which intermediate programs are more “ fi t” Main approaches
  • 7. DreamCoder 1. Takes a set of tasks 2. Starts with a library (or grammar) of primitive functions 3. (Enumeration) Tries to solve tasks with the current grammar 4. Generates more possible programs from the current grammar (dreams) 5. (Recognition) Trains a neural network on found solutions and dreams that predicts probabilities of each function from a string of task description 6. (Enumeration) Tries to solve tasks again, this time using probabilities from NN 7. (Compression) Looks for repeated patterns in found solutions, adds them to grammar 8. Goes to step 3
  • 8. DreamCoder • Takes a set of tasks of the same type and a grammar • Programs are expressions of typed lambda calculus with De Bruijn indexing • Search starts from a single Hole ( ?? ) of expected type • All primitives from the grammar are checked if they can unify with the hole type • All possibilities are weighted according to the grammar, partial solutions are stored in a priority queue • When all holes are fi lled, the program is checked against all unsolved tasks Enumeration ( ? ? [list(int) - > list(int)] ) (lambda ? ? [list(int)] ) (lambda empty) (lambda $0) (lambda (cons ? ? [int] ? ? [list(int)] ) … (lambda (cons 0 ? ? [list(int)] ) …
  • 9. DreamCoder • Type-correctness requires that we go from output to input • We can’t check partial programs for runtime correctness, all the possible solutions of (cons (car empty) ? ? ) will be explored (within priorities and time limit) • Can generate in fi nite loops, requires timeouts and interruption management Enumeration
  • 10. DreamCoder Generates many transformations of found programs and looks for repeating subprograms such that adding them to library reduces combined length of all found solutions and the library itself Compression
  • 11. DreamCoder • RNN with LSTM layers • Input is task de fi nition • Di ff erent domains can have di ff erent features (like a couple CNN layers for image domains) • For a grammar with n functions NN will have n+1 outputs • Each output is a probability that the corresponding function is used in the solution to the task • The last output is the probability of a free variable term Recognition
  • 12. DreamCoder • Gradually expands its library of available functions, thus learning new discrete concepts without human guidance • NN model can be referred to as an intuition part. “This task looks like I should totally use reduce and not map in the solution” • No support of dependent types means that we can’t propagate constraints through holes, see (car empty) example • Single probability for a function may be not enough for complex problems with long solutions that utilize a big portion of the library. There is the context grammar extension, but it’s still fairly limited • Lambda calculus may be quite limited for e ffi cient algorithms Overall
  • 13. Abstraction and Reasoning Corpus • Introduced by François Chollet in “On the Measure of Intelligence” • Solvable by humans but not machines • Targets ability to operate with complex combinations of abstract patterns without knowledge about real world, except for Core Knowledge • Has parallels with skill acquisition • Private test set su ffi ciently di ff erent from public train and test data • Tests developer-aware generalization
  • 15. How do I solve these tasks?
  • 16. How do I solve these tasks?
  • 17. How do I solve these tasks?
  • 18. Abstractors • A.k.a reversible functions • Somewhat akin to witness functions from FlashMeta • A combination of to_abstract and from_abstract operations • Preserve information, but present it in a di ff erent, possibly more e ffi cient way • to_abstract can have several outputs • to_abstract can output several possible options • Examples: grid_size, extract_background, extract_objects, group_similar_items, group_objects_by_color, vert_symmetry
  • 19. How to evaluate representations? A good evaluation function should: • Work on di ff erent data types • Probably not Monte-Carlo — if it returns non-zero result, we have a solution My current solution is weighted Kolmogorov complexity. • Each type has a certain weight per item • Items of complex types use sum of the weight of all their subitems plus the weight of the type itself
  • 20. Intermediate results • Solved 34/400 training tasks with a threshold of 500 visited partial solutions • Abstractor library was quite limited • I had to write all abstractors by hand • I had to manually pick weights for di ff erent abstractors and types
  • 21. Moving to DreamCoder • It can learn new functions from primitives on its own • It can learn weights for functions on its own Why?
  • 22. Moving to DreamCoder • Written in OCaml — no type information in runtime, hard to experiment, not so easy to read • Creating programs from output to input means that I don’t have any intermediate representations to evaluate during the search Obstacles
  • 23. Moving to DreamCoder • No runtime type information in OCaml and absolute type strictness (you can have either unit ref and have no idea what’s inside, or manually specify all the possible options) meant that I can’t manipulate any intermediate representations at all. The solution is to rewrite it to another more dynamic language, I chose Julia • Introduce named variables to generated programs as in let $x = … in … • Make search bidirectional, go for simpler representations of both input and output while checking if new representations can help in explaining the output • Add a special class of reversible functions, specify how they can be combined so that the compression step will be able to learn new abstractors without losing their reversible nature • Measure intermediate data complexity, learn type weight alongside function probabilities Path to solution
  • 24. Moving to DreamCoder • What is the best way to evaluate a program with a types and functions weights set? If we make decisions based on the qualities of intermediate representations, it’s no longer an admissible search problem • Should we run NN model not only in the beginning of an attempt to solve a task, but also on some intermediate representations? We are no longer constraint by OCaml here, but our model should be able to deal with various data types on its own without our additional feature engineering • Should we add dependent types support and learn aliases for them? Rectangle is still an object but it supports some very speci fi c set of operations Questions
  • 25. References • Kevin Ellis, Lucas Morales, Mathias Sable ́-Meyer, Armando Solar-Lezama, and Josh Tenenbaum: Library learning for neurally-guided bayesian program induction. (2018) • Ellis, K., Wong, C., Nye, M., Sable-Meyer, M., Cary, L., Morales, L., Hewitt, L., 
 Solar-Lezama, A., Tenenbaum, J.B.: Dreamcoder: Growing generalizable, inter- 
 pretable knowledge with wake-sleep bayesian program learning (2020) • Chollet, F.: On the measure of intelligence (2019) • Polozov, O., Gulwani, S.: Flashmeta: a framework for inductive program synthesis. In: Aldrich, J., Eugster, P. (eds.) OOPSLA. pp. 107–126. ACM (2015), http: //dblp.uni-trier.de/db/conf/ oopsla/oopsla2015.html#PolozovG15 • Alford, S., Gandhi, A., Rangamani, A., Banburski, A., Wang, T., Dandekar, S., ... & Chin, P. (2021, November). Neural-Guided, Bidirectional Program Search for Abstraction and Reasoning. In International Conference on Complex Networks and Their Applications (pp. 657-668). Springer, Cham.
  • 26. That’s all! • I’m open for collaboration and discussions • I’m also open for employment, especially on something related • https://github.com/andreyz4k/ec/tree/ julia_enumerator • https://www.linkedin.com/in/ andreyzakharevich/ • Or @andreyz4k on most social media