[Paper Review] Differentiable Programs with Neural Libraries
This paper introduces Neural TerpreT (NTPT), a framework that combines differentiable programming with neural networks to create interpretable, modular models capable of lifelong learning from input-output examples. By structuring solutions as executable source code that calls trainable neural components, the system achieves strong generalization and continual improvement on earlier tasks without catastrophic forgetting, outperforming purely neural baselines in perceptual programming by example tasks.
We develop a framework for combining differentiable programming languages with neural networks. Using this framework we create end-to-end trainable systems that learn to write interpretable algorithms with perceptual components. We explore the benefits of inductive biases for strong generalization and modularity that come from the program-like structure of our models. In particular, modularity allows us to learn a library of (neural) functions which grows and improves as more tasks are solved. Empirically, we show that this leads to lifelong learning systems that transfer knowledge to new tasks more effectively than baselines.
Motivation & Objective
- To address the challenge of lifelong learning in perceptual programming by example (PPBE) with weak supervision (input-output pairs), where models must generalize across diverse tasks involving images or text.
- To develop a hybrid architecture that combines interpretable program structures with trainable neural components, enabling modularity and knowledge sharing across tasks.
- To overcome catastrophic forgetting in continual learning by allowing performance on earlier tasks to improve even after new tasks are introduced.
- To explore how program-like inductive biases—such as control flow and modularity—enhance generalization and interpretability in neural systems.
- To demonstrate that end-to-end differentiable training of source code and neural components leads to effective lifelong learning with transferable knowledge.
Proposed method
- The framework uses a differentiable interpreter as a controller that executes source code containing calls to neural network functions, enabling joint optimization of code and neural parameters.
- Neural components are trained end-to-end via backpropagation, with gradients flowing through the interpreter to update both the program logic and neural weights.
- A shared library of neural functions is dynamically expanded and refined as new tasks are solved, enabling knowledge transfer across tasks.
- Modularity is enforced by allowing the interpreter to selectively invoke or ignore neural components, which helps prevent interference and supports continual learning.
- The system operates in a lifelong learning setting where earlier tasks are not re-encountered, yet performance improves over time due to shared component updates.
- The approach leverages source code structure as an inductive bias to favor generalizable solutions, such as loops that generalize across input lengths.
Experimental results
Research questions
- RQ1Can a hybrid model combining differentiable programming and neural networks achieve better generalization and lifelong learning than purely neural models in perceptual programming tasks?
- RQ2How does modularity in program structure affect knowledge transfer and resistance to catastrophic forgetting in continual learning?
- RQ3To what extent can performance on previously learned tasks improve even after they are no longer directly trained on, due to shared neural component updates?
- RQ4Does the use of source code as a representation impose an inductive bias that favors solutions with strong generalization properties?
- RQ5Can a system learn to write interpretable, reusable algorithms with perceptual components using only weak supervision (input-output examples)?
Key findings
- The system demonstrated continual improvement on earlier tasks even after they were no longer directly trained on, indicating effective lifelong learning and avoidance of catastrophic forgetting.
- Performance on earlier tasks improved as the model learned new tasks, due to shared updates to the neural function library, showing effective knowledge transfer.
- The modular structure of the source code allowed selective use of neural components, which may explain the model's resistance to forgetting by isolating irrelevant components.
- The hybrid model outperformed purely neural baselines in transfer learning and generalization, particularly on tasks requiring reasoning over perceptual inputs like images or text.
- The source code representation enabled interpretable and human-verifiable solutions, supporting domain knowledge integration and feedback loops.
- The framework successfully induced programs with strong generalization, such as loops that generalized across arbitrary list lengths, even when trained on short examples.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.