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 ranMethod as code

In Syntology View this paper on Syntology, its page in Syntology's graph. That page adds which of its functions are also present in other papers' code Syntology holds, with dates, and its dated run record as JSON and a README badge. It also lists the repositories linked to the paper, the abstract and the calls for agents.

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

For agents, on Syntology's MCP service (how to connect):

Code

Syntology 20 code samples harvested from 1 repository linked to this paper: 15 ran (of which 6 constructed an object rather than computing a result; 8 with no instrument failure: 0 honoured, 2 violated, 6 with no contract checked; 7 where Syntology's instrument failed) · 5 unverified. Where Syntology's instrument failed: 4 where our contract draft was wrong; 3 where the contract check could not run; failures of Syntology's instrument, not of the code.

By repository: community (archive-listed): 20 samples from 1 repository, 15 ran (8 with no instrument failure; 7 where Syntology's instrument failed). The run record, sample by sample. “Ran” means executed on a synthesized input, not that the code is correct or reproduces the paper.

Levels written on 2026-09-22 (UTC): the dates Syntology's graph wrote each sample's verification level, not when the code executed.

clvrai/leaps mentioned on GitHubpytorchSyntology: 20 samples, 15 ran (7 instrument-failed) · 5 unverified 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 (of which 6 constructed an object rather than computing a result; 8 with no instrument failure: 0 honoured, 2 violated, 6 with no contract checked; 7 where Syntology's instrument failed) · 5 unverified. “Where Syntology's instrument failed” counts failures of Syntology's instrument, not of the code. Syntology's record for this page has not changed since , the first build that kept a record date for it; when this build read Syntology's graph is in the build record. That date is not when the samples ran.

2ran · violated contract
4ran · our draft was wrong
3ran; the contract check could not run
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. A line beginning “fixture:” under a sample that ran gives the arguments Syntology's fixture called the sample with, each as name:type/rank/element kind (? where none was recorded), and the type of what the fixture's run returned, exactly as the harness recorded them; the arguments and the returned type were recorded by two separate runs of the same fixture. No output value is shown, and a returned type says nothing about whether the output was right. “Level recorded” gives the UTC date when Syntology's graph wrote the sample's verification level, not when the code executed; where the level was written before Syntology's graph kept that date, the row says “level recorded, date not recorded”. “Honoured” and “violated” refer to a contract Syntology drafted from the code itself. “Our draft was wrong” and “the contract check could not run” are failures of Syntology's instrument, not of the code: the sample ran on Syntology's synthesized input, and then the drafted contract did not describe it, or the check itself raised an error (RAISES), lacked a dependency (DEP_MISSING) or ran out of time (TIMEOUT); hover the label for which. A metamorphic tier, where shown, is evidence of the output's shape, not that the sample implements the method.

Each sample ends with its code_sha256. A sample's code_sha256 is Syntology's identity for that exact code. It is printed in full (16 hexadecimal characters for every sample in this build), and get_code(code_sha256="…") takes it exactly as printed. An agent calls it on Syntology's MCP service (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 are grouped by repository: a repository marked official first, then by how directly the repository is tied to the paper, then in the archive's order; never by how many ran. 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 six 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; the licence is outside the permissive list Syntology serves text under (MIT, Apache-2.0, BSD and similar); this paper's copy was not located, so its licence is not recorded; or this paper's copy is cleared, but the stored copy of the same code that Syntology serves is not. 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.

A function or class name links to its page when the name occurs in the harvested code of at least 5 papers; the name is a string, not an identity. A census tag appears when Syntology's census ran implementations with that name on one shared input per bucket: it gives how many were compared, from how many papers, and how many distinct outputs they produced, and names this sample's bucket when this sample was one of them.

clvrai/leaps community (archive-listed) 20 samples, 15 ran (7 instrument-failed) · 5 unverified
CheckerState pretrain/models.py ran MIT (permissive) · 2070a867b9921946 · report fixture: returned CheckerState · level recorded 2026-09-22
Encoder in 278 papers pretrain/models.py ran MIT (permissive) · 219771e4ff1f21bd · report fixture: returned Encoder · level recorded 2026-09-22
Karel_world_supervised pretrain/models.py ran MIT (permissive) · adff31c7886a3c8b · report fixture: returned Karel_world_supervised · level recorded 2026-09-22
NNBase pretrain/models.py ran MIT (permissive) · 57994492ff60cc1c · report fixture: returned NNBase · level recorded 2026-09-22
PySyntaxChecker pretrain/models.py ran MIT (permissive) · 63334595c40e1b4f · report fixture: returned PySyntaxChecker · level recorded 2026-09-22
SyntaxVocabulary pretrain/models.py ran MIT (permissive) · f109c2975e44ea7c · report fixture: returned SyntaxVocabulary · level recorded 2026-09-22
_unmask_idx pretrain/models.py ran · our draft was wrong fingerprinted MIT (permissive) · 68a7cd46f1488e51 · report fixture: signature output_mask_all:Tensor/2/bool, first_end_token_idx:Tensor/1/int, max_program_len:int/0/int · returned Tensor · level recorded 2026-09-22
_unmask_idx2 pretrain/models.py ran · violated contract MIT (permissive) · 709e9af7c826f886 · report fixture: signature x:tuple/1/Tensor · returned bool · level recorded 2026-09-22
front_is_clear pretrain/models.py ran · our draft was wrong fingerprinted MIT (permissive) · 4ec9bafe8f3946bb · report fixture: signature s:Tensor/3/float, loc:list/1/int · returned tuple · level recorded 2026-09-22
get_location pretrain/models.py ran; the contract check could not run (RAISES) fingerprinted MIT (permissive) · 552f40715e6a4741 · report fixture: signature s:ndarray/3/float · returned ndarray · level recorded 2026-09-22
get_neighbor pretrain/models.py ran; the contract check could not run (RAISES) fingerprinted MIT (permissive) · f169f731be71897b · report fixture: signature s:str/0/str, loc:ndarray/1/int, face:int/0/int · returned ndarray · level recorded 2026-09-22
masked_mean in 74 papers
census: 8 implementations from 11 papers, 5 distinct outputs across 2 buckets, one shared input per bucket this sample: bucket 2 of 2, arg 1: rank 2, kind float, dtype float32 · arg 2: rank 2, kind bool, dtype bool
pretrain/models.py ran · our draft was wrong fingerprinted MIT (permissive) · 6f0e0c50d69a79bf · report fixture: signature x:Tensor/2/float, mask:Tensor/2/bool, dim:int/0/int, keepdim:bool/0/bool · returned Tensor · level recorded 2026-09-22
masked_sum in 10 papers pretrain/models.py ran · our draft was wrong fingerprinted MIT (permissive) · 656bc963190be4b0 · report fixture: signature x:Tensor/2/float, mask:Tensor/2/float, dim:int/0/int, keepdim:bool/0/bool · returned Tensor · level recorded 2026-09-22
neighbor_is_clear pretrain/models.py ran; the contract check could not run (RAISES) fingerprinted MIT (permissive) · d031ea99e1a1dd51 · report fixture: signature s:Tensor/3/float, loc:list/1/int, face:int/0/int · returned tuple · level recorded 2026-09-22
state_transition pretrain/models.py ran · violated contract fingerprinted MIT (permissive) · b7fff67e10e92e79 · report fixture: signature s:ndarray/3/bool, a:int/0/int, make_error:bool/0/bool · returned ndarray · level recorded 2026-09-22
ConditionPolicy pretrain/models.py unverified MIT (permissive) · 9c0f14ab711773c9 · report
Decoder in 210 papers pretrain/models.py unverified MIT (permissive) · 692eaa2dd0184a17 · report
ProgramVAE pretrain/models.py unverified MIT (permissive) · 49ce8132f623d5b6 · report
VAE in 29 papers pretrain/models.py unverified MIT (permissive) · 5f52cac9a31533ed · report
check_type in 6 papers pretrain/models.py unverified MIT (permissive) · 5e9899cd4f3029e3 · report

Method as code Syntology

What Syntology's graph records as this paper's claimed method, lifted into code: each assembly names its bricks (functions and classes), each with its own role and its own verification level. An assembly is not a check that the code implements the method correctly or reproduces the paper's results. Levels are each brick's own verification level in Syntology's graph (level 0: no recorded run), listed brick by brick and never combined into one level; “ran” means the brick executed on a synthesized input, not that its output is correct, and the instrument figure counts failures of Syntology's instrument, not of the code. Where a model read the code against the paper's claim, each assembly's label verdict is one model's judgement, kept in this page's JSON twin; it is not calibrated, so no card prints it.

1 assembly on this paper: 1 harvested, 0 generated.

harvested Assembly for a framework that learns to synthesize a program (graph method: a framework that learns to synthesize a program). 23 bricks; individually on a fixture: 18 ran (of which 7 constructed an object rather than computing a result; 10 with no instrument failure: 0 honoured, 2 violated, 8 with no contract checked; 8 where Syntology's instrument failed) · 5 unverified. The assembly has not been run end-to-end.

  1. ProgramVAE entry · level 0 · unverified · 49ce8132f623d5b6
  2. ConditionPolicy helper · level 0 · unverified · 9c0f14ab711773c9
  3. VAE model · level 0 · unverified · 5f52cac9a31533ed
  4. FixedCategorical helper · level 1 · ran · 16be22c531bda7dd
  5. Flatten helper · level 1 · ran · dca1bdd65a0d90e0
  6. Karel_world_supervised helper · level 1 · ran · adff31c7886a3c8b
  7. NNBase helper · level 1 · ran · 57994492ff60cc1c
  8. _unmask_idx2 helper · level 1 · ran · violated contract · 709e9af7c826f886
  9. init helper · level 1 · ran · our draft was wrong · 9de355e93051e4ad
  10. masked_mean helper · level 1 · ran · our draft was wrong · 6f0e0c50d69a79bf
  11. masked_sum helper · level 1 · ran · our draft was wrong · 656bc963190be4b0
  12. Decoder model · level 0 · unverified · 692eaa2dd0184a17
  13. Encoder model · level 1 · ran · 219771e4ff1f21bd
  14. state_transition helper · level 1 · ran · violated contract · b7fff67e10e92e79
  15. PySyntaxChecker helper · level 1 · ran · 63334595c40e1b4f
  16. _unmask_idx helper · level 1 · ran · our draft was wrong · 68a7cd46f1488e51
  17. front_is_clear helper · level 1 · ran · our draft was wrong · 4ec9bafe8f3946bb
  18. get_location helper · level 1 · ran; the contract check could not run (RAISES) · 552f40715e6a4741
  19. CheckerState helper · level 1 · ran · 2070a867b9921946
  20. SyntaxVocabulary helper · level 1 · ran · f109c2975e44ea7c
  21. check_type helper · level 0 · unverified · 5e9899cd4f3029e3
  22. neighbor_is_clear helper · level 1 · ran; the contract check could not run (RAISES) · d031ea99e1a1dd51
  23. get_neighbor helper · level 1 · ran; the contract check could not run (RAISES) · f169f731be71897b

Each brick ends with its code_sha256, Syntology's identity for that exact code; click one to copy the get_code call that returns it. For agents, on Syntology's MCP service: assembly(arxiv_id="2108.13643") returns these assemblies with each brick's role and wiring (how to connect).

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