A decentralized gossip learning framework for P2P edge intelligence
Project description
QuinkGL: Gossip Learning Framework
QuinkGL is a decentralized, peer-to-peer (P2P) machine learning framework designed to enable edge intelligence through Gossip Learning algorithms. Unlike traditional Federated Learning, which relies on a central server for aggregation, QuinkGL distributes the training and aggregation process across all participating nodes.
Key Features
- Decentralized Architecture – No central parameter server required
- Gossip Learning – Random walk and gossip-based aggregation for model convergence
- IPv8 Networking – Native P2P communication with NAT traversal (UDP hole punching)
- Scalability – Handles dynamic networks with node churn
- Framework-Agnostic – Supports PyTorch and TensorFlow models
- Built-in Data Splitting – IID and Non-IID data distribution utilities
Installation
pip install quinkgl
For development:
git clone https://github.com/aliseyhann/QuinkGL-Gossip-Learning-Framework.git
cd QuinkGL-Gossip-Learning-Framework
pip install -e .
Quick Start
import asyncio
import torch.nn as nn
from quinkgl import (
GossipNode,
PyTorchModel,
RandomTopology,
FedAvg,
TrainingConfig,
DatasetLoader,
FederatedDataSplitter
)
# 1. Define your model
class SimpleNet(nn.Module):
def __init__(self):
super().__init__()
self.fc1 = nn.Linear(784, 128)
self.fc2 = nn.Linear(128, 10)
self.relu = nn.ReLU()
def forward(self, x):
x = x.view(x.size(0), -1)
return self.fc2(self.relu(self.fc1(x)))
# 2. Wrap the model
model = PyTorchModel(SimpleNet(), device="cpu")
# 3. Create the gossip node
node = GossipNode(
node_id="alice",
domain="mnist-vision",
model=model,
topology=RandomTopology(),
aggregation=FedAvg(weight_by="data_size"),
training_config=TrainingConfig(epochs=1, batch_size=32)
)
# 4. Load and split data
loader = DatasetLoader()
(X, y), info = loader.load_iris()
splitter = FederatedDataSplitter(seed=42)
splits = splitter.create_iid_split(X, y, num_nodes=5)
my_data = splits[0] # This node's data partition
# 5. Run gossip learning
async def main():
await node.start()
await node.run_continuous(data=my_data)
asyncio.run(main())
Public API
Core
| Class | Description |
|---|---|
GossipNode |
Main P2P gossip learning node with IPv8 networking |
Models
| Class | Description |
|---|---|
PyTorchModel |
Wrapper for PyTorch nn.Module |
TensorFlowModel |
Wrapper for TensorFlow/Keras models |
TrainingConfig |
Training configuration (epochs, batch_size, lr) |
TrainingResult |
Training result with metrics |
Topology
| Class | Description |
|---|---|
RandomTopology |
Random peer selection strategy |
CyclonTopology |
Scalable peer sampling (Cyclon algorithm) |
PeerInfo |
Peer information dataclass |
Aggregation
| Class | Description |
|---|---|
FedAvg |
Federated Averaging aggregation |
ModelAggregator |
Manages train→gossip→aggregate cycle |
ModelUpdate |
Peer model update dataclass |
Data
| Class | Description |
|---|---|
DatasetLoader |
Load common datasets (CIFAR-10, Iris, etc.) |
FederatedDataSplitter |
Create IID/Non-IID data splits |
Architecture
┌─────────────────────────────────────────────────────────────┐
│ GossipNode │
├─────────────────────────────────────────────────────────────┤
│ ┌─────────────┐ ┌──────────────┐ ┌───────────────────┐ │
│ │ PyTorchModel│ │RandomTopology│ │ FedAvg │ │
│ │ (or TF) │ │ (or Cyclon) │ │ (Aggregation) │ │
│ └─────────────┘ └──────────────┘ └───────────────────┘ │
├─────────────────────────────────────────────────────────────┤
│ ModelAggregator │
│ (Train → Gossip → Aggregate) │
├─────────────────────────────────────────────────────────────┤
│ IPv8 Network Layer │
│ (P2P, NAT Traversal, UDP) │
└─────────────────────────────────────────────────────────────┘
License
MIT License © 2025, 28 December - Ali Seyhan, Baki Turhan
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file quinkgl-0.1.20.tar.gz.
File metadata
- Download URL: quinkgl-0.1.20.tar.gz
- Upload date:
- Size: 66.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a22a13748c3133818b866a39c543be1feefb1e47fb63934fb9970349b916d5ac
|
|
| MD5 |
b46c22d3b0b053c9d50f85a3bf160bf4
|
|
| BLAKE2b-256 |
8da6e2256b872055e20b7b280df5f4efce7510d58054da437fdd5d154c6450cf
|
File details
Details for the file quinkgl-0.1.20-py3-none-any.whl.
File metadata
- Download URL: quinkgl-0.1.20-py3-none-any.whl
- Upload date:
- Size: 78.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b1e7ba28a6bb52df897bd4958a56e752d50c609177abc7b1c37eb7c4b99ed355
|
|
| MD5 |
b01326670d262cf0427254b5eec0628d
|
|
| BLAKE2b-256 |
462d6ecfc4874d2cc2f4a6397599fb50697dde4b20e483e3c448df16f209a754
|