Indic PrivacyFL
// how it works
A robust Federated Learning framework designed for categorizing Multimodal Indic Educational Data across 7 languages and 8 subject domains without compromising student data privacy.
Project Objectives
- Data & Challenge Characterization: Analyze multimodal Indic educational data (text, speech, image, video) and cross-lingual code-mixed language patterns.
- Robust Multimodal Architecture: Implement a multi-encoder network using state-of-the-art foundation models with a Self-Attention Fusion mechanism that degrades gracefully when client modalities are missing.
- Privacy-Preserving Prototype: Deploy a distributed Federated Learning simulation using Differential Privacy (Opacus DP) to guarantee user privacy at the node level.
- Evaluation & Benchmarking: Measure performance across 8 educational subjects, comparing Centralized baselines against Federated implementations.
Quick Start (Demo Mode)
For a rapid, zero-download test run of the architecture locally:
# 1. Create and activate a virtual environment
python -m venv venv
# Windows: venv\Scripts\activate
# Linux/macOS: source venv/bin/activate
# 2. Install dependencies
pip install -r requirements.txt
# 3. Generate instant demo data (50 samples)
python -m src.data.download_data --demo
# 4. Run the fast federated simulation demo
python -m src.fl.run_simulation --demo
️ Environment Setup
1. Requirements
- Python 3.10+
- PyTorch 2.1+ (CUDA recommended for full training)
2. Installation
python -m venv venv
# Windows
venv\Scripts\activate
# macOS/Linux
source venv/bin/activate
pip install -r requirements.txt
Data Acquisition
The framework supports multiple data acquisition modes depending on your hardware limits and network access.
A. Demo Version (Instant)
Generates 50 minimal synthetic records for instant pipeline testing. No downloads required.
python -m src.data.download_data --demo
B. Sample Version (Rapid Local Prototyping)
Generates lightweight multimodal sample records (500 samples/language).
python -m src.data.download_data --sample
C. Full Version (HuggingFace Stream)
Attempts to stream the full multimodal educational corpora (AI4Bharat Sangraha, IndicVoices-R) via HuggingFace. If authentication or quotas fail, it falls back to extended synthetic generation with a printed warning.
python -m src.data.download_data --full
Running the Pipeline
1. Centralized Training Baseline
Train a centralized baseline model to evaluate the upper-bound accuracy without federation constraints.
python -m src.fl.run_centralized
2. Federated Learning Simulation
Run the distributed federated learning network across multiple clients using Flower (flwr).
# Standard Federated Simulation (No DP)
python -m src.fl.run_simulation
# Federated Simulation with Differential Privacy (DP)
python -m src.fl.run_simulation --dp-enabled
3. Interpreting Results
To generate comparison tables and plots across Centralized vs. Federated results:
python -m src.eval.compare_results
Note: Results are saved to the results/ directory as comparison_plot.png and comparison_table.csv.
️ Command-Line Flags Overview
run_simulation.py Flags
| Flag | Description | Default |
|---|---|---|
--config |
Path to custom YAML configuration | configs/default.yaml |
--num-clients |
Overrides active clients count | (from config) |
--num-rounds |
Overrides communication rounds | (from config) |
--dp-enabled |
Enables Opacus Differential Privacy | False |
--demo |
Runs fast simulation loop with synthetic math curves | False |
Project Structure
IndicPrivacy-FL/
├── configs/ # YAML configuration files (default.yaml)
├── data/ # Raw and processed multimodal data
├── DIAGRAMS/ # Architectural diagrams
├── docs/ # Technical architecture documentation
├── reports/ # Output reports and evaluation summaries
├── results/ # Generated metrics, tables, and plots
├── src/
│ ├── data/ # Dataset loaders and partitioners
│ ├── eval/ # Evaluation and comparison scripts
│ ├── fl/ # Federated clients, server logic, strategies
│ └── models/ # Modality encoders, fusion mechanisms
└── tests/ # Unit tests for core components
️ Architecture Documentation
For technical implementation details, please refer to the documentation:
Running Tests
To verify the integrity of the core components (encoders, fusion, and model):
python -m pytest tests/ -v
️ Differential Privacy Configuration
Configured via configs/default.yaml.
| Parameter | Default Value | Description |
|---|---|---|
| Epsilon (ε) | 100.0 | Target privacy budget |
| Delta (δ) | 1.0e-5 | Probability of privacy bound violation |
| Noise Multiplier | 0.01 | Noise scale added to clipped gradients |
| Max Grad Norm | 1.0 | Threshold for gradient clipping |
Datasets & Technologies
Please see TOOLLIST.md for the complete list of target datasets, open-source libraries, and foundational models (IndicBERT, Wav2Vec, ViT) powering this framework.