An open API service indexing awesome lists of open source software.

https://github.com/aygp-dr/liquid-neural-networks

Liquid Neural Networks (LNN) - Continuous-time neural dynamics inspired by C. elegans. Parameter-efficient AI with 19-302 neurons for complex tasks. Hybrid Clojure/Python implementation.
https://github.com/aygp-dr/liquid-neural-networks

clojure neural-networks python research

Last synced: 10 months ago
JSON representation

Liquid Neural Networks (LNN) - Continuous-time neural dynamics inspired by C. elegans. Parameter-efficient AI with 19-302 neurons for complex tasks. Hybrid Clojure/Python implementation.

Awesome Lists containing this project

README

          

#+TITLE: Liquid Neural Networks
#+AUTHOR: Aidan Pace
#+DATE: 2025-01-17
#+OPTIONS: toc:2 num:nil ^:nil

[[https://github.com/aygp-dr/liquid-neural-networks/blob/main/LICENSE][https://img.shields.io/badge/license-MIT-blue.svg]]
[[https://github.com/aygp-dr/liquid-neural-networks][https://img.shields.io/badge/python-3.9+-blue.svg]]
[[https://github.com/aygp-dr/liquid-neural-networks][https://img.shields.io/badge/clojure-1.11+-blue.svg]]
[[https://github.com/aygp-dr/liquid-neural-networks][https://img.shields.io/badge/status-draft-orange.svg]]
[[https://github.com/aygp-dr/liquid-neural-networks/releases][https://img.shields.io/badge/release-v0.1.0-blue.svg]]

* Overview

*🚧 Project Status: Draft/In Progress*

This project is in early development. Core algorithms and implementations are being actively developed.

Liquid Neural Networks (LNNs) are a revolutionary approach to artificial intelligence that draws inspiration from biological neural systems, particularly the C. elegans nervous system. Unlike traditional neural networks, LNNs use continuous-time dynamics and can adapt in real-time to changing inputs.

** Key Features

- *Parameter Efficiency*: Solve complex tasks with as few as 19-302 neurons
- *Continuous-Time Dynamics*: Based on ordinary differential equations (ODEs)
- *Real-Time Adaptation*: Networks that evolve and adapt during inference
- *Superior Interpretability*: Understand exactly how decisions are made
- *Edge AI Ready*: Efficient enough for deployment on resource-constrained devices

** Why Liquid Neural Networks?

Traditional neural networks require millions of parameters and struggle with:
- Adapting to new situations without retraining
- Explaining their decision-making process
- Running efficiently on edge devices
- Handling time-series data naturally

LNNs address these limitations by mimicking biological neurons more closely, using differential equations to model continuous-time dynamics.

* Quick Start

** Installation

*** Python
#+begin_src bash
# Using pip
pip install liquid-neural-networks

# Using uv (recommended)
uv pip install liquid-neural-networks

# Development installation
git clone https://github.com/aygp-dr/liquid-neural-networks
cd liquid-neural-networks
uv pip install -e ".[dev]"
#+end_src

*** Clojure
#+begin_src bash
# Add to your deps.edn
{:deps {aygp-dr/liquid-neural-networks {:git/url "https://github.com/aygp-dr/liquid-neural-networks"
:git/sha "LATEST_SHA"}}}

# Or use from source
git clone https://github.com/aygp-dr/liquid-neural-networks
cd liquid-neural-networks
clojure -M:dev
#+end_src

** Basic Usage

*** Python Example
#+begin_src python
from liquid_neural_networks import LiquidNeuron, LiquidNetwork

# Create a simple liquid neural network
network = LiquidNetwork(
input_size=10,
hidden_size=32, # Just 32 neurons!
output_size=2
)

# Train on time-series data
for epoch in range(100):
outputs = network(inputs, time_constants)
loss = criterion(outputs, targets)
loss.backward()
#+end_src

*** Clojure Example
#+begin_src clojure
(require '[liquid-neural-networks.core :as lnn])

;; Create a liquid network
(def network (lnn/create-network {:input-size 10
:hidden-size 32
:output-size 2}))

;; Process time-series data
(def result (lnn/forward network input-data time-constants))
#+end_src

* Applications

** Autonomous Systems
- Drone navigation with 19 neurons
- Self-driving car control
- Robotic arm manipulation

** Time-Series Analysis
- Financial market prediction
- Weather forecasting
- Sensor data processing

** Medical Diagnostics
- ECG analysis
- Brain signal interpretation
- Disease progression modeling

** Edge AI
- IoT device intelligence
- Embedded system control
- Real-time anomaly detection

* Architecture

LNNs consist of three main components:

1. *Liquid Time-Constant (LTC) Neurons*: Neurons with adaptive time constants that change based on input
2. *Continuous-Time Dynamics*: ODEs that govern neuron behavior
3. *Sparse Connectivity*: Efficient wiring patterns inspired by biological systems

The mathematical foundation:
#+begin_example
dx/dt = -x/Ï„(t) + f(Wx + b)
where Ï„(t) is the adaptive time constant
#+end_example

* Performance

Benchmark results comparing LNNs to traditional architectures:

| Task | Traditional NN | LNN | Parameters Reduction |
|------+---------------+-----+---------------------|
| Drone Control | 100K params | 19 neurons | 99.98% |
| Time-Series | 1M params | 302 neurons | 99.97% |
| Image Classification | 25M params | 1K neurons | 99.99% |

* Contributing

We welcome contributions! See our [[file:CONTRIBUTING.org][Contributing Guide]] for:
- Code style guidelines
- Testing requirements
- Pull request process
- Development setup

* Documentation

- [[file:docs/tutorials/][Tutorials]]: Step-by-step guides
- [[file:docs/api/][API Reference]]: Detailed documentation
- [[file:examples/][Examples]]: Working code samples
- [[file:SETUP.org][Development Setup]]: For contributors

* Research

This implementation is based on:
- Hasani et al. "Liquid Time-constant Networks" (2021)
- Lechner et al. "Neural Circuit Policies" (2020)
- MIT CSAIL research on continuous-time neural models

* License

MIT License - see [[file:LICENSE][LICENSE]] for details.

* Community

- [[https://github.com/aygp-dr/liquid-neural-networks/discussions][GitHub Discussions]]
- [[https://github.com/aygp-dr/liquid-neural-networks/issues][Issue Tracker]]
- Research papers and citations in [[file:docs/papers/][docs/papers/]]