Text Generation
Transformers
Safetensors
English
mixtral
dialog-generation
conversational-ai
state-action-model
conversational
text-generation-inference
Instructions to use apple/sage-ft-mixtral-8x7b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use apple/sage-ft-mixtral-8x7b with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="apple/sage-ft-mixtral-8x7b") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("apple/sage-ft-mixtral-8x7b") model = AutoModelForCausalLM.from_pretrained("apple/sage-ft-mixtral-8x7b", device_map="auto") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use apple/sage-ft-mixtral-8x7b with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "apple/sage-ft-mixtral-8x7b" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "apple/sage-ft-mixtral-8x7b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/apple/sage-ft-mixtral-8x7b
- SGLang
How to use apple/sage-ft-mixtral-8x7b with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "apple/sage-ft-mixtral-8x7b" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "apple/sage-ft-mixtral-8x7b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "apple/sage-ft-mixtral-8x7b" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "apple/sage-ft-mixtral-8x7b", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use apple/sage-ft-mixtral-8x7b with Docker Model Runner:
docker model run hf.co/apple/sage-ft-mixtral-8x7b
Update README.md
Browse files
README.md
CHANGED
|
@@ -17,80 +17,151 @@ metrics:
|
|
| 17 |
|
| 18 |
# SAGE Dialogue Gen 🌱
|
| 19 |
|
| 20 |
-
**Authors**: Yizhe Zhang, Navdeep Jaitly (Apple)
|
| 21 |
-
**Citation**:
|
| 22 |
-
|
| 23 |
|
|
|
|
| 24 |
|
|
|
|
| 25 |
|
| 26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
|
| 28 |
---
|
| 29 |
|
| 30 |
-
##
|
| 31 |
|
| 32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
|
| 34 |
-
|
| 35 |
-
- **Enhanced emotional intelligence** through coarse-grained state planning
|
| 36 |
-
- A **self-improving pipeline** that includes data augmentation, dialogue-tree search, LLM-derived reward modeling, and targeted fine-tuning [oai_citation:2‡github.com](https://github.com/apple/ml-sage-dialog-gen?utm_source=chatgpt.com) [oai_citation:3‡arxiv.org](https://arxiv.org/pdf/2503.03040?utm_source=chatgpt.com)
|
| 37 |
|
| 38 |
---
|
| 39 |
|
| 40 |
-
##
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
|
| 42 |
-
|
|
|
|
|
|
|
| 43 |
|
| 44 |
-
|
| 45 |
-
- Long-horizon, strategy-based dialogue systems
|
| 46 |
-
- Research into structured latent-variable control in LLMs
|
| 47 |
|
| 48 |
-
###
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
|
| 50 |
-
|
| 51 |
-
-
|
|
|
|
|
|
|
| 52 |
|
| 53 |
---
|
| 54 |
|
| 55 |
## Training Details
|
| 56 |
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
|
|
|
| 64 |
|
| 65 |
---
|
| 66 |
|
| 67 |
-
##
|
|
|
|
|
|
|
| 68 |
|
| 69 |
-
|
|
|
|
|
|
|
|
|
|
| 70 |
|
| 71 |
---
|
| 72 |
|
| 73 |
-
##
|
| 74 |
|
| 75 |
-
|
| 76 |
-
# Clone the model
|
| 77 |
-
git lfs install
|
| 78 |
-
git clone https://huggingface.co/your-username/sage-dialog-gen
|
| 79 |
|
| 80 |
-
|
|
|
|
|
|
|
| 81 |
bash setup.sh
|
|
|
|
| 82 |
|
| 83 |
-
#
|
| 84 |
-
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 85 |
|
| 86 |
-
|
| 87 |
-
|
| 88 |
|
| 89 |
-
#
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 93 |
|
|
|
|
| 94 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 95 |
|
|
|
|
| 96 |
|
|
|
|
|
|
| 17 |
|
| 18 |
# SAGE Dialogue Gen 🌱
|
| 19 |
|
| 20 |
+
**Authors**: Yizhe Zhang, Navdeep Jaitly (Apple)
|
|
|
|
|
|
|
| 21 |
|
| 22 |
+
---
|
| 23 |
|
| 24 |
+
## Model Information
|
| 25 |
|
| 26 |
+
- **Language**: English
|
| 27 |
+
- **License**: Apache 2.0
|
| 28 |
+
- **Base Model**: mistralai/Mixtral-8x7B-Instruct-v0.1
|
| 29 |
+
- **Library**: transformers
|
| 30 |
+
- **Tags**: dialog-generation, conversational-ai, state-action-model
|
| 31 |
+
- **Dataset**: ShareGPT
|
| 32 |
+
- **Metrics**: Custom emotional-intelligence evaluation
|
| 33 |
|
| 34 |
---
|
| 35 |
|
| 36 |
+
## Citation
|
| 37 |
|
| 38 |
+
```bibtex
|
| 39 |
+
@misc{zhang2025sage,
|
| 40 |
+
title = {SAGE: Steering and Refining Dialogue Generation with State‑Action Augmentation},
|
| 41 |
+
author = {Zhang, Yizhe and Jaitly, Navdeep},
|
| 42 |
+
year = {2025},
|
| 43 |
+
howpublished = {arXiv preprint},
|
| 44 |
+
note = {arXiv:2503.03040}
|
| 45 |
+
}
|
| 46 |
+
```
|
| 47 |
|
| 48 |
+
📄 **Paper**: Available on arXiv and Papers with Code
|
|
|
|
|
|
|
| 49 |
|
| 50 |
---
|
| 51 |
|
| 52 |
+
## Model Description
|
| 53 |
+
|
| 54 |
+
SAGE introduces **latent state-action variables** between dialogue turns, enabling:
|
| 55 |
+
|
| 56 |
+
- **Structured Control**: Precise management of emotional tone and conversational strategy
|
| 57 |
+
- **Enhanced Emotional Intelligence**: Explicit state planning for more empathetic responses
|
| 58 |
+
- **Self-Improving Pipeline**: Comprehensive training approach including:
|
| 59 |
+
- Data augmentation
|
| 60 |
+
- Dialogue-tree search
|
| 61 |
+
- Reward modeling
|
| 62 |
+
- Fine-tuning optimization
|
| 63 |
|
| 64 |
+
This approach allows for more nuanced and contextually appropriate dialogue generation compared to traditional methods.
|
| 65 |
+
|
| 66 |
+
---
|
| 67 |
|
| 68 |
+
## Intended Uses
|
|
|
|
|
|
|
| 69 |
|
| 70 |
+
### ✅ **Recommended Applications**
|
| 71 |
+
- Emotional or empathetic chatbots
|
| 72 |
+
- Long-horizon, strategy-aware conversation systems
|
| 73 |
+
- Research on structured latent-variable dialogue control
|
| 74 |
+
- Educational conversational AI systems
|
| 75 |
+
- Customer service applications requiring emotional intelligence
|
| 76 |
|
| 77 |
+
### ⚠️ **Important Limitations**
|
| 78 |
+
- **Not suitable** for high-stakes, safety-critical deployment without further evaluation
|
| 79 |
+
- Requires additional testing for production environments
|
| 80 |
+
- May need domain-specific fine-tuning for specialized applications
|
| 81 |
|
| 82 |
---
|
| 83 |
|
| 84 |
## Training Details
|
| 85 |
|
| 86 |
+
**Base Model**: Mixtral-8x7B-Instruct
|
| 87 |
+
|
| 88 |
+
**Training Pipeline**:
|
| 89 |
+
1. **Data Preparation**: ShareGPT-style JSON formatting
|
| 90 |
+
2. **Supervised Fine-Tuning (SFT)**: Initial model adaptation
|
| 91 |
+
3. **Dialogue-Tree Search**: Exploration of conversation paths
|
| 92 |
+
4. **Preference Learning**: Reward model training
|
| 93 |
+
5. **Comparative Evaluation**: Performance assessment and inference optimization
|
| 94 |
|
| 95 |
---
|
| 96 |
|
| 97 |
+
## Performance
|
| 98 |
+
|
| 99 |
+
SAGE demonstrates significant improvements on emotional-intelligence metrics compared to baseline models while maintaining generative flexibility and coherence. The model shows particular strength in:
|
| 100 |
|
| 101 |
+
- Emotional tone consistency
|
| 102 |
+
- Contextual appropriateness
|
| 103 |
+
- Long-term conversation planning
|
| 104 |
+
- Empathetic response generation
|
| 105 |
|
| 106 |
---
|
| 107 |
|
| 108 |
+
## Usage
|
| 109 |
|
| 110 |
+
### Quick Start
|
|
|
|
|
|
|
|
|
|
| 111 |
|
| 112 |
+
```bash
|
| 113 |
+
git clone https://github.com/apple/ml-sage-dialog-gen
|
| 114 |
+
cd ml-sage-dialog-gen
|
| 115 |
bash setup.sh
|
| 116 |
+
```
|
| 117 |
|
| 118 |
+
### Basic Implementation
|
|
|
|
| 119 |
|
| 120 |
+
```python
|
| 121 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
| 122 |
|
| 123 |
+
# Load the model
|
| 124 |
+
tokenizer = AutoTokenizer.from_pretrained("apple/sage-dialogue-gen")
|
| 125 |
+
model = AutoModelForCausalLM.from_pretrained("apple/sage-dialogue-gen")
|
| 126 |
+
|
| 127 |
+
# Generate dialogue
|
| 128 |
+
input_text = "I'm feeling overwhelmed with work lately."
|
| 129 |
+
inputs = tokenizer(input_text, return_tensors="pt")
|
| 130 |
+
outputs = model.generate(**inputs, max_length=150, do_sample=True, temperature=0.7)
|
| 131 |
+
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
| 132 |
+
```
|
| 133 |
+
|
| 134 |
+
---
|
| 135 |
|
| 136 |
+
## Requirements
|
| 137 |
|
| 138 |
+
- Python 3.8+
|
| 139 |
+
- PyTorch 1.12+
|
| 140 |
+
- Transformers 4.21+
|
| 141 |
+
- Additional dependencies listed in `requirements.txt`
|
| 142 |
+
|
| 143 |
+
---
|
| 144 |
+
|
| 145 |
+
## Contributing
|
| 146 |
+
|
| 147 |
+
Contributions are welcome! Please see our contributing guidelines and code of conduct before submitting pull requests.
|
| 148 |
+
|
| 149 |
+
---
|
| 150 |
+
|
| 151 |
+
## License
|
| 152 |
+
|
| 153 |
+
This project is licensed under the Apache License 2.0. See the LICENSE file for details.
|
| 154 |
+
|
| 155 |
+
---
|
| 156 |
+
|
| 157 |
+
## Acknowledgments
|
| 158 |
+
|
| 159 |
+
- Built upon the Mixtral-8x7B-Instruct foundation model
|
| 160 |
+
- Trained using ShareGPT dataset
|
| 161 |
+
- Developed by the Apple Machine Learning Research team
|
| 162 |
+
|
| 163 |
+
---
|
| 164 |
|
| 165 |
+
## Contact
|
| 166 |
|
| 167 |
+
For questions or issues, please open a GitHub issue or contact the development team through the official Apple ML research channels.
|