What is Machine Learning on the Lightning Network?
Machine learning is a set of methods that learn patterns from data instead of following fixed rules. On the Lightning Network it helps with two hard problems: where to place liquidity, and how to estimate channel balances that nodes keep private. Amboss has published three papers on these problems, and two of them run in production.
Types of models
- Supervised models learn from labelled examples. A model that predicts a channel's balance from its features is one.
- Unsupervised models find structure in unlabelled data, such as clusters of nodes.
- Reinforcement learning learns by trial and reward. An agent that chooses channels to open and is rewarded for extra throughput is one.
- Neural networks are a common model family. Layers of connected units adjust their weights during training. A graph neural network does this on a graph such as the Lightning channel graph.
Why Lightning suits machine learning
Lightning is a graph of nodes and channels. Its structure is public, its history can be recorded, and its key unknown, the balance split of each channel, can be estimated from the rest. Amboss Space has recorded the network since 2021, which supplies training data.
MPFlow: placing liquidity
MPFlow asks which channels a node should open, given a fixed budget, to move the most payment value. It measures this with max flow. The agent combines a message-passing graph neural network with proximal policy optimization (PPO) and action masking. It has two message-passing layers, so it is small enough to run in production. During training the largest hubs were hidden from the model, so it learned where capacity is needed instead of connecting to the biggest node.
- On a 5,000-node snapshot it achieved up to 11.3% higher throughput than autopilot algorithms.
- In production it has made 4,640 channel-open decisions allocating 267.3 BTC, over $16 million, across 30 managed nodes.
- The paper is on arXiv. See the MPFlow summary.
Bayesian Binary Search: fewer probes
Binary search assumes every value is equally likely. Bayesian Binary Search first learns where balances tend to sit, using methods such as Gaussian processes or kernel density estimation. It then splits the range at that distribution instead of at the midpoint. For channel balance probing it gave a 3 to 6% efficiency gain in production. It was published in Algorithms in 2025. See the BBS post.
Channel balance interpolation
A third paper tested whether a model can predict a channel's balance from public node and channel features alone. The best model beat an equal-split baseline by 10%. See the paper summary.
How Amboss handles machine learning
- Magma AI, announced in December 2024, is a reinforcement learning channel recommender built with Stillmark. It has an altruistic mode for network health and an optimized mode for one node's payment performance.
- Magma now uses the same matching for one-time purchases, and Liquidity Subscriptions use it for recurring ones. See the Magma page.
- Rails runs MPFlow on its production cluster.
The research is listed on the research page. For related concepts, see AI optimization, predictive analytics and Lightning Network Intelligence.
