Federated Learning for Privacy-Preserving Financial Data Generation with RAG Integration
This project implements a federated learning framework combined with a Retrieval-Augmented Generation (RAG) system to generate privacy-preserving synthetic financial data.
Features
- Federated Learning using TensorFlow
- Privacy-preserving data generation using VAE/GAN
- RAG integration for enhanced data quality
- Secure Multi-Party Computation (SMPC)
- Differential Privacy implementation
- Kubernetes-based deployment
- Comprehensive monitoring and logging
- NEW: Interactive Web Demo - Try it out without setup!
Quick Demo (No Installation Required)
π Live Demo: Hugging Face Spaces
The web demo allows you to:
- Enter customer features and get credit score predictions
- See how federated learning works
- Understand privacy-preserving ML concepts
Installation
# Create virtual environment
python3 -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
Federated Credit Scoring Demo (with Web App)
This project includes a demo where multiple banks (clients) collaboratively train a credit scoring model using federated learning. A Streamlit web app allows you to enter customer features and get a credit score prediction from the federated model.
Quick Start
- Install dependencies
pip install -r requirements.txt
- Start the Federated Server
python -m src.main --mode server --config config/server_config.yaml
- Start at least two Clients (in separate terminals)
python -m src.main --mode client --config config/client_config.yaml
- Run the Web App
streamlit run webapp/streamlit_app.py
- Use the Web App
- Enter 32 features (dummy values are fine for demo)
- Click "Predict Credit Score" to get a prediction from the federated model
- View training progress in the app
- Toggle between Demo Mode (no server required) and Real Mode (connects to server)
For best results, keep the server and at least two clients running in parallel.
Project Structure
FinFedRAG-Financial-Federated-RAG/
βββ src/
β βββ api/ # REST API for server and client communication
β βββ client/ # Federated learning client implementation
β βββ server/ # Federated learning server and coordinator
β βββ rag/ # Retrieval-Augmented Generation components
β βββ models/ # VAE/GAN models for data generation
β βββ utils/ # Privacy, metrics, and utility functions
βββ webapp/ # Streamlit web application
βββ config/ # Configuration files
βββ tests/ # Unit and integration tests
βββ docker/ # Docker configurations
βββ kubernetes/ # Kubernetes deployment files
βββ app.py # Root app.py for Hugging Face Spaces deployment
License
MIT
Contributing
Please read our contributing guidelines before submitting pull requests.
Demo URL: https://huggingface.co/spaces/ArchCoder/federated-credit-scoring