**Exploring the future of AI: Where Quantum Computing meets Federated Learning** *Research/Educational Project ā Not Production Ready*
[Documentation](#-quick-start) ⢠[Quick Start](#-quick-start) ⢠[Contributing](#-contributing) ⢠[License](#-license)
What is Q-Edge?
Q-Edge is an experimental platform that explores the intersection of three cutting-edge technologies:
| Technology | Description | Status |
|---|---|---|
| Federated Learning | Distributed ML without exposing raw data | Simulated |
| Quantum ML | Variational Quantum Circuits (VQC) & Quantum Kernel | PennyLane Simulator |
| Post-Quantum Crypto | Kyber & Dilithium (NIST standards) | Placeholder |
| Azure Quantum | Cloud quantum hardware integration | Code Ready |
Why Quantum?
"Why does FL aggregation need quantum?"
| Aspect | Classical FL | Quantum-Enhanced FL |
|---|---|---|
| Aggregation | FedAvg (linear) | Quantum kernel for non-linear patterns |
| Privacy | Differential privacy | + Quantum key distribution potential |
| Optimization | Gradient descent | Variational quantum optimization |
| Scalability | O(n) parameters | Quantum parallelism for high-dim data |
Honest take: At this stage, quantum advantages are still theoretical and only running on simulators. But research shows potential for:
- Better resistance against adversarial attacks
- More efficient loss function landscape exploration
- Quantum-secure communication between FL clients
Key Features
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā Q-EDGE ARCHITECTURE ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā¤
ā ā
ā Mobile Clients Backend Quantum ā
ā āāāāāāāāāāāāāāā āāāāāāāāāāāāāāā āāāāāāāāāāāāā ā
ā ā Flutter App ā āāPQCāāā¶ ā FastAPI ā āāāā¶ ā PennyLane ā ā
ā ā FL Client ā ā + Celery ā ā Circuits ā ā
ā āāāāāāāāāāāāāāā āāāāāāāāāāāāāāā āāāāāāāāāāāāā ā
ā ā
ā Security: Kyber-1024 KEM + Dilithium-5 Signatures ā
ā Aggregation: FedAvg + Quantum-Enhanced ā
ā Error Mitigation: Zero-Noise Extrapolation ā
ā ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
Important Disclaimer
| ### What This IS - Educational/research project - Working quantum circuits on simulator - Learning resource for FL + QML + PQC - Architecture proof-of-concept | ### What This is NOT - Production-ready software - Connected to real quantum hardware - Real Kyber/Dilithium (simulated) - Trained on real datasets |
Quick Start
Prerequisites
Python 3.10+
Flutter 3.0+
Docker (optional)
Installation
# Clone the repository
git clone https://github.com/rasidi3112/q-edge.git
cd q-edge
# Create virtual environment
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Run demo
python demo.py
Run Flutter App
cd mobile_app
flutter pub get
flutter run -d chrome # or your preferred device
Project Structure
q-edge/
āāā src/
ā āāā quantum/ # Quantum ML modules
ā ā āāā circuits.py # Variational Quantum Circuits
ā ā āāā kernels.py # Quantum Kernel Alignment
ā ā āāā error_mitigation.py # Zero-Noise Extrapolation
ā ā āāā aggregator.py # Quantum-Enhanced Aggregation
ā ā āāā azure_connector.py # Azure Quantum Integration
ā ā
ā āāā backend/ # FastAPI Backend
ā ā āāā main.py # API endpoints
ā ā āāā security.py # PQC implementation
ā ā āāā celery_app.py # Async task queue
ā ā
ā āāā mobile/ # Mobile FL Client
ā āāā fl_client.py # Flower-based FL client
ā āāā pqc_transport.py # PQC transport layer
ā
āāā mobile_app/ # Flutter UI
ā āāā lib/main.dart # Mobile dashboard
ā
āāā tests/ # Unit & integration tests
āāā docs/ # Documentation
āāā demo.py # Demo script
āāā requirements.txt # Python dependencies
āāā docker-compose.yml # Container orchestration
How It Works
1. Federated Learning Flow
Mobile Device A āā
ā Encrypted
Mobile Device B āā¼āāāāāāāāāāāāāāā¶ Q-Edge Server āāā¶ Quantum Aggregation
ā Weights
Mobile Device C āā
2. Quantum Circuit
# Variational Quantum Circuit for Global Aggregation
@qml.qnode(dev)
def vqc(params, data):
# Data encoding
for i, x in enumerate(data):
qml.RY(x, wires=i)
# Parameterized layers
qml.StronglyEntanglingLayers(params, wires=range(n_qubits))
return qml.probs(wires=range(n_qubits))
3. Post-Quantum Security
| Algorithm | Purpose | Security Level |
|---|---|---|
| Kyber-1024 | Key Encapsulation | NIST Level 5 |
| Dilithium-5 | Digital Signatures | NIST Level 5 |
| AES-256-GCM | Symmetric Encryption | NIST Approved |
Simulation Results
ā ļø Note: Results from local simulator with synthetic data
Quantum Circuit Performance
| Qubits | Layers | Parameters | Execution Time |
|---|---|---|---|
| 4 | 2 | 24 | ~12ms |
| 8 | 4 | 96 | ~45ms |
| 16 | 6 | 288 | ~180ms |
Federated Learning Simulation
| Clients | Rounds | Convergence |
|---|---|---|
| 5 | 10 | ~95% |
| 10 | 20 | ~97% |
Simulated convergence with synthetic random data
Tech Stack
| Category | Technologies | |----------|-------------| | **Quantum** | PennyLane, NumPy, SciPy | | **Backend** | FastAPI, Celery, Redis | | **Mobile** | Flutter, Dart | | **Security** | cryptography, python-jose | | **Cloud** | Azure Quantum (ready) | | **DevOps** | Docker, GitHub Actions |Roadmap
- [x] Variational Quantum Circuits
- [x] Quantum Kernel Alignment
- [x] Zero-Noise Extrapolation
- [x] Federated Learning Simulation
- [x] Flutter Mobile App
- [x] FastAPI Backend
- [ ] Real PQC with liboqs
- [ ] Azure Quantum Integration
- [ ] Real Dataset Training
- [ ] Mobile Device Testing
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
License
This project is licensed under the Apache License 2.0 - see the LICENSE file for details.
Acknowledgments
**Star this repo if you find it interesting!** Made for the Quantum Computing Community
Built With
- dart
- html
- kotlin
- objective-c
- python
- swift
Log in or sign up for Devpost to join the conversation.