neurallambda  by neurallambda

Reasoning AI via differentiable lambda calculus

Created 1 year ago
274 stars

Top 94.3% on SourcePulse

GitHubView on GitHub
Project Summary

This project provides a fully differentiable implementation of lambda calculus and other neurosymbolic data structures (Stacks, Queues, Trees, etc.) designed to imbue AI models, particularly LLMs, with reasoning capabilities. It targets researchers and engineers aiming to bridge the gap between connectionist AI and symbolic computation, offering a path to models that can infer knowledge beyond their training data.

How It Works

The core innovation is representing symbolic programs and data structures as tensors within a neural network architecture. Lambda calculus operations, like beta reduction, are implemented through differentiable tensor manipulations, enabling end-to-end training with gradient descent. This approach allows AI models to potentially "compile" and execute programs directly within their latent space, moving beyond pattern matching to principled reasoning.

Quick Start & Requirements

  • Install: pip install neurallambda (or clone the repo for research-grade access).
  • Prerequisites: Python 3.x, PyTorch. GPU recommended for complex operations.
  • Demo: The demo/d01_neurallambda.py script provides an example of differentiable lambda calculus execution.
  • Documentation: The project is research-grade with ongoing documentation efforts.

Highlighted Details

  • Implements a differentiable lambda calculus interpreter, serving as an existence proof for reasoning in neural nets.
  • Introduces "Neural Stacks" and "Neural Queues" using superpositional states for differentiability.
  • Supports mapping arbitrary Python objects (symbols, numbers) to and from tensor representations via nearest neighbor lookup.
  • Explores integrating these structures into existing LLMs like RWKV and Transformers.

Maintenance & Community

The project is actively under development by a single primary contributor. Collaboration is encouraged via GitHub Issues and direct contact. A roadmap is available in TODO.md.

Licensing & Compatibility

The project is currently unlicensed, with all rights retained by the author. The author intends to open-source the work but has not yet specified a license. Commercial use and closed-source linking are not explicitly permitted or restricted at this time.

Limitations & Caveats

The library is research-grade and under active construction (V2 is in progress). Variable scoping in the lambda calculus implementation is not yet robust, leading to potential issues with recursion. The current implementation of substitution may be "heavy-handed" compared to theoretical ideals.

Health Check
Last Commit

10 months ago

Responsiveness

1 day

Pull Requests (30d)
0
Issues (30d)
0
Star History
4 stars in the last 30 days

Explore Similar Projects

Starred by Shizhe Diao Shizhe Diao(Author of LMFlow; Research Scientist at NVIDIA), Eric Zhu Eric Zhu(Coauthor of AutoGen; Research Scientist at Microsoft Research), and
7 more.

reasoning-gym by open-thought

1.2%
1k
Procedural dataset generator for reasoning models
Created 7 months ago
Updated 3 days ago
Starred by Peter Norvig Peter Norvig(Author of "Artificial Intelligence: A Modern Approach"; Research Director at Google), Anton Bukov Anton Bukov(Cofounder of 1inch Network), and
3 more.

HRM by sapientinc

0.9%
11k
Hierarchical reasoning for complex tasks
Created 2 months ago
Updated 1 week ago
Feedback? Help us improve.