Last updated
3/10/2025
Share
Get started
Federated AI
LLM

Finetune an LLM using Federated AI

This Blueprint demonstrates how to finetune LLMs using Flower, a framework for federated AI. As access to high-quality public datasets declines, federated AI enables multiple data owners to collaboratively fine-tune models without sharing raw data, preserving privacy while leveraging distributed datasets.

We apply parameter-efficient fine-tuning (PEFT) with LoRA adapters to fine-tune the Qwen2-0.5B-Instruct model on the Alpaca-GPT4 dataset. This approach optimizes resource efficiency while maintaining model adaptability, making it a practical solution for decentralized AI development.

Preview this Blueprint in action
Hosted demo
Hosted Demo
Step by step walkthrough
Tools used to create

Trusted open source tools used for this Blueprint

HuggingFace Transformers

HuggingFace Transformers is used for model finetuning and HuggingFace Datasets is used for loading the dataset.

Flower

Flower’s Simulation Engine is used to run federated fine-tuning of the model.

Streamlit

Streamlit is used for testing the finetuned model in real time.

icon choices
Choices

Insights into our motivations and key technical decisions throughout the development process.

Focus
Decision
Rationale
Alternatives Considered
Trade-offs
Focus
Focus
Decision
Rationale
Alternatives Considered
Trade-offs
Federated AI Framework
Federated AI Framework
Used Flower for federated fine-tuning.
Developed by Flower.ai team, with the required expertise to create the Blueprint.
Fine-tune the model locally.
Will require one to gather huge amounts of data, pay for licenses, which will be a costly solution, and performance decreases.
Base Model
Base Model
Fine-tuned Qwen2-0.5B-Instruct.
Smaller size to make federated fine-tuning more accessible for initial experimentation.
Larger/even smaller models from different models series (Qwen, Llama, etc.).
Larger models require more compute; even smaller models may lose expressiveness.
Simulation vs. Deployment
Simulation vs. Deployment
Default simulation mode for federated training.
Easier for developers to test without extensive infra setup.
Direct deployment with Flower’s Deployment Engine.
Simulations may not capture all real-world constraints.
Training Hardware
Training Hardware
Supports CPU and GPU fine-tuning.
Increases accessibility for users with limited compute resources.
GPU-only training for efficiency.
CPU training is significantly slower, especially for larger models.
Dataset
Dataset
Used Alpaca-GPT4 for fine-tuning.
Well-structured dataset for instruction tuning (not too large).
Custom datasets.
Alpaca-GPT4 may not cover edge cases for specific use-case.
Demo and Evaluation
Demo and Evaluation
Provided both Streamlit app and CLI-based evaluation for interactive testing.
Simple way to validate model responses in real time, depending on user-preference.
Real-world deployment across the globe. It's feasible.
Would need to find partners to set this up or rent more instances across the world.
Ready? Try it yourself!
icon extensions
Explore Blueprints Extensions

See examples of extended blueprints unlocking new capabilities and adjusted configurations enabling tailored solutions—or try it yourself.

Load more
Text Link
BYOTA
tags
Text Link
Finetune STT with your voice
tags
Text Link
Map Features in OSM with CV
tags
Text Link
Finetune LLM using Federated AI
tags
Text Link
Embedding
tags
Text Link
Federated AI
tags
Text Link
Image Segmentation
tags
Text Link
Object Detection
tags
Text Link
Automatic Speech Recognition
tags
Text Link
Speech-to-Text
tags
Text Link
Query structured documents Q&A
tags
Text Link
Emails
tags
Text Link
Newsletter
tags
Text Link
Podcast
tags
Text Link
Community
tags
Text Link
Events
tags
Text Link
Discord
tags
Text Link
Data Extraction
tags
Text Link
User-Interface
tags
Text Link
Performance Optimization
tags
Text Link
LLM Inference
tags
Text Link
Language Modelling
tags
Text Link
Text-to-Text
tags
Text Link
Text-to-Speech
tags
Text Link
LLM
tags
Text Link
Email
tags
Text Link
Podcast personalities
tags
Text Link
Document-to-podcast
tags
Text Link
Blueprints
tags
Text Link
Use Cases
tags
Text Link
English
tags
Text Link
General Language
tags
Text Link
Multilingual
tags
Text Link
Audio
tags
Text Link
Text
tags
Text Link
Finetuning
tags
Text Link
Local AI
tags
Text Link
Federated Learning
tags
Text Link
LLM Integration
tags