Overview
FastChat provides a three-component architecture:1
Controller
Manages distributed workers and routes requests
2
Model Worker
Loads and serves the model (can use vLLM backend)
3
API/UI Server
Provides web interface or OpenAI-compatible API
Installation
FastChat 0.2.33 is the recommended version for stability with Qwen models.
Quick Start
Web UI Deployment
1
Start the Controller
The controller manages model workers:Runs on
http://localhost:21001 by default.2
Launch Model Worker
Start vLLM worker for high performance:
3
Start Web Server
Launch the Gradio web interface:Access at
http://localhost:7860OpenAI API Deployment
1
Start Controller
2
Launch vLLM Worker
3
Start API Server
Configuration
Worker Configuration
Worker Parameters
string
required
Path to model checkpoint (HuggingFace or local path)
boolean
required
Required for Qwen models
int
default:"1"
Number of GPUs for tensor parallelism
string
default:"auto"
Model data type:
auto, bfloat16, float16, float32float
default:"0.90"
Fraction of GPU memory to use
int
default:"256"
Maximum concurrent sequences
string
Worker listening address
string
Controller address to register with
API Server Configuration
string
default:"localhost"
API server bind address
int
default:"8000"
API server port
string
Address of the controller service
string[]
List of valid API keys for authentication
API Usage
OpenAI Python Client
Unlike vLLM standalone mode, FastChat handles stop tokens automatically. No need to specify
stop_token_ids.Multi-Model Deployment
Deploy multiple models simultaneously:1
Start Controller
2
Launch Multiple Workers
Start workers on different ports:
3
Start API Server
Model Selection
Clients can specify which model to use:Production Deployment
Systemd Services
Create systemd service files for each component:Docker Compose
Complete deployment with Docker Compose:docker-compose.yml
Load Balancing
FastChat controller automatically load balances across multiple workers:Monitoring
Worker Status
Check registered workers:Health Checks
Logging
Enable detailed logging:Troubleshooting
Worker registration fails
Worker registration fails
Error: Worker not appearing in controllerSolutions:
- Check controller is running:
curl http://localhost:21001 - Verify controller address in worker:
--controller-address http://localhost:21001 - Check network connectivity between services
- Review logs for connection errors
API returns 'No available models'
API returns 'No available models'
Error: API returns empty model listSolutions:
- Ensure workers have registered successfully
- Check controller status:
curl http://localhost:21001/list_models - Wait for model loading to complete (can take minutes)
- Check worker logs for errors
Slow response times
Slow response times
Issue: High latency in responsesSolutions:
- Use vLLM worker instead of model_worker
- Increase
--max-num-seqson worker - Add more workers for horizontal scaling
- Enable tensor parallelism for large models
- Use quantized models (Int4/Int8)
Worker crashes
Worker crashes
Error: Worker process exits unexpectedlySolutions:
- Check GPU memory:
nvidia-smi - Reduce
--gpu-memory-utilization - Use smaller model or quantized version
- Check CUDA compatibility
- Review system logs:
dmesg | grep -i error
Advanced Features
Custom System Prompts
Set system prompts in the web UI or API:Conversation History
Maintain multi-turn conversations:Performance Comparison
FastChat vs Standalone
Next Steps
Production Guide
Best practices for production deployments
Monitoring
Set up comprehensive monitoring
Performance Tuning
Advanced optimization techniques
API Reference
Complete API documentation