Papers › Learning to Synthesize Programs as Interpretable and Generalizable Policies

Learning to Synthesize Programs as Interpretable and Generalizable Policies

31 Aug 2021NeurIPS 2021 12arXiv:2108.13643archive 2025-07-28

Dweep Trivedi, Jesse Zhang, Shao-Hua Sun, Joseph J. Lim

Recently, deep reinforcement learning (DRL) methods have achieved impressive performance on tasks in a variety of domains. However, neural network policies produced with DRL methods are not human-interpretable and often have difficulty generalizing to novel scenarios. To address these issues, prior works explore learning programmatic policies that are more interpretable and structured for generalization. Yet, these works either employ limited policy representations (e.g. decision trees, state machines, or predefined program templates) or require stronger supervision (e.g. input/output state pairs or expert demonstrations). We present a framework that instead learns to synthesize a program, which details the procedure to solve a task in a flexible and expressive manner, solely from reward signals. To alleviate the difficulty of learning to compose programs to induce the desired agent behavior from scratch, we propose to first learn a program embedding space that continuously parameterizes diverse behaviors in an unsupervised manner and then search over the learned program embedding space to yield a program that maximizes the return for a given task. Experimental results demonstrate that the proposed framework not only learns to reliably synthesize task-solving programs but also outperforms DRL and program synthesis baselines while producing interpretable and more generalizable policies. We also justify the necessity of the proposed two-stage learning scheme as well as analyze various methods for learning the program embedding.

PaperPDFConference PDFCodeCode Syntology ran

In Syntology Open this paper in Syntology's Atlas, the map of the papers in Syntology's graph and their citations.

For agents, Syntology's MCP tool lists every function and class Syntology harvested from this paper and whether it ran (how to connect): get_harvested_code_for_paper(arxiv_id="2108.13643")

Code

Syntology Ran 15 of 20 code samples harvested from 1 repository linked to this paper; 5 have no recorded run. Of those that ran: 2 ran · violated contract; 4 ran · our draft was wrong; 3 ran · fixture could not drive it; 6 ran with no contract checked.

By repository: community (archive-listed): 20 samples from 1 repository, 15 ran. The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

clvrai/leaps mentioned on GitHubpytorch report

Repository list and official/mentioned flags are the archive's, frozen 2025-07-28. Reachability, where shown, is from one Syntology probe window (2026-09-16 to 2026-09-18); repositories not probed show nothing. GitHub stars are not tracked.

Code Syntology ran Syntology

20 samples harvested; 15 ran; 0 honoured the contract we drafted; 5 have no recorded run. Read from Syntology's graph 2026-09-24; that is when this build read the record, not when the samples ran.

2ran · violated contract
4ran · our draft was wrong
3ran · fixture could not drive it
6ran
5unverified

Licence: 0 of the 20 samples are pointer only, meaning Syntology does not serve that copy's text. This page shows no code text for any sample; each one links to its file in the repository.

Harvested from clvrai/leaps. “Ran” means the sample executed on a synthesized input. It does not mean the output is correct, and nothing here reproduces the paper's results. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself; “our draft was wrong” and “fixture could not drive it” are failures of Syntology's instrument, not of the code.

Each sample ends with its code_sha256, Syntology's identity for that exact code. An agent fetches the stored sample with Syntology's MCP tool get_code(code_sha256="…") (how to connect); click an identity to copy that call.

Repository labels, per sample. official repository: The archive marks this repository official for the paper. named in the paper: The archive records that the paper mentions this repository; it is not marked official. community (archive-listed): In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper. found in paper text by Syntology: Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted. community: Not in the archive's code links for this paper; a community repository Syntology harvested. Samples from a repository marked official are listed first. Licence labels name the repository's licence as recorded at harvest. “Pointer only” means Syntology does not serve that copy's text, for one of four reasons: no licence file was found; the licence was not identified; the licence is recorded as permissive but that copy's record is not marked cleared; or the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar). Some licences outside that list permit redistribution, such as WTFPL, and GPL-3.0 under its conditions; they are simply not on the list. Hover a licence label for the reason. File links open the file on GitHub at the default branch, which may have changed since the harvest.

CheckerState clvrai/leaps/pretrain/models.py community (archive-listed) ran MIT (permissive) · 2070a867b9921946 · report
Encoder clvrai/leaps/pretrain/models.py community (archive-listed) ran MIT (permissive) · 219771e4ff1f21bd · report
Karel_world_supervised clvrai/leaps/pretrain/models.py community (archive-listed) ran MIT (permissive) · adff31c7886a3c8b · report
NNBase clvrai/leaps/pretrain/models.py community (archive-listed) ran MIT (permissive) · 57994492ff60cc1c · report
PySyntaxChecker clvrai/leaps/pretrain/models.py community (archive-listed) ran MIT (permissive) · 63334595c40e1b4f · report
SyntaxVocabulary clvrai/leaps/pretrain/models.py community (archive-listed) ran MIT (permissive) · f109c2975e44ea7c · report
_unmask_idx clvrai/leaps/pretrain/models.py community (archive-listed) ran · our draft was wrong fingerprinted MIT (permissive) · 68a7cd46f1488e51 · report
_unmask_idx2 clvrai/leaps/pretrain/models.py community (archive-listed) ran · violated contract MIT (permissive) · 709e9af7c826f886 · report
front_is_clear clvrai/leaps/pretrain/models.py community (archive-listed) ran · our draft was wrong fingerprinted MIT (permissive) · 4ec9bafe8f3946bb · report
get_location clvrai/leaps/pretrain/models.py community (archive-listed) ran · fixture could not drive it fingerprinted MIT (permissive) · 552f40715e6a4741 · report
get_neighbor clvrai/leaps/pretrain/models.py community (archive-listed) ran · fixture could not drive it fingerprinted MIT (permissive) · f169f731be71897b · report
masked_mean clvrai/leaps/pretrain/models.py community (archive-listed) ran · our draft was wrong fingerprinted MIT (permissive) · 6f0e0c50d69a79bf · report
masked_sum clvrai/leaps/pretrain/models.py community (archive-listed) ran · our draft was wrong fingerprinted MIT (permissive) · 656bc963190be4b0 · report
neighbor_is_clear clvrai/leaps/pretrain/models.py community (archive-listed) ran · fixture could not drive it fingerprinted MIT (permissive) · d031ea99e1a1dd51 · report
state_transition clvrai/leaps/pretrain/models.py community (archive-listed) ran · violated contract fingerprinted MIT (permissive) · b7fff67e10e92e79 · report
ConditionPolicy clvrai/leaps/pretrain/models.py community (archive-listed) unverified MIT (permissive) · 9c0f14ab711773c9 · report
Decoder clvrai/leaps/pretrain/models.py community (archive-listed) unverified MIT (permissive) · 692eaa2dd0184a17 · report
ProgramVAE clvrai/leaps/pretrain/models.py community (archive-listed) unverified MIT (permissive) · 49ce8132f623d5b6 · report
VAE clvrai/leaps/pretrain/models.py community (archive-listed) unverified MIT (permissive) · 5f52cac9a31533ed · report
check_type clvrai/leaps/pretrain/models.py community (archive-listed) unverified MIT (permissive) · 5e9899cd4f3029e3 · report

Tasks

Deep Reinforcement LearningProgram Synthesis

Results from the paper archive 2025-07-28

No leaderboard rows for this paper in the archive.

Report a problem or propose a change · a person checks every report against the paper or source before anything changes; decisions are listed on /corrections