Downloads · 30 days
71
3% of all-time downloads
prithivMLmods/Phi-4-o1
Phi-4-o1 is a text generation model from prithivMLmods. Use it when you need the model to write or continue text. It is set up for transformers. The card lists the license as mit.
Downloads · 30 days
71
3% of all-time downloads
All-time downloads
2.7K
Public
Parameters
14.7B
38.2 GB on disk
Likes
23
Public
Click a slice to open those files.
.safetensors29.3 GB · 100%
From the Hugging Face model README

[Phi-4 O1 finetuned] from Microsoft's Phi-4 is a state-of-the-art open model built upon a blend of synthetic datasets, data from filtered public domain websites, and acquired academic books and Q&A datasets. The goal of this approach is to ensure that small, capable models are trained with high-quality data focused on advanced reasoning.
phi-4 has adopted a robust safety post-training approach. This approach leverages a variety of both open-source and in-house generated synthetic datasets. The overall technique employed to do the safety alignment is a combination of SFT (Supervised Fine-Tuning) and iterative DPO (Direct Preference Optimization), including publicly available datasets focusing on helpfulness and harmlessness as well as various questions and answers targeted at multiple safety categories.
Phi-4 o1 ft is fine-tuned on a synthetic dataset curated through a pipeline explicitly built for this purpose. The data is primarily based on the Chain of Thought (CoT) or Chain of Continuous Thought (COCONUT) methodologies. This approach ensures that the dataset is rich in reasoning, problem-solving, and step-by-step breakdowns of complex tasks. The model is specifically designed to excel in reasoning, mathematics, and breaking down problems into logical, manageable steps.
# pip install accelerate
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
tokenizer = AutoTokenizer.from_pretrained("prithivMLmods/Phi-4-o1")
model = AutoModelForCausalLM.from_pretrained(
"prithivMLmods/Phi-4-o1",
device_map="auto",
torch_dtype=torch.bfloat16,
)
input_text = "Write me a poem about Machine Learning."
input_ids = tokenizer(input_text, return_tensors="pt").to("cuda")
outputs = model.generate(**input_ids, max_new_tokens=32)
print(tokenizer.decode(outputs[0]))
You can ensure the correct chat template is applied by using tokenizer.apply_chat_template as follows:
messages = [
{"role": "user", "content": "Write me a poem about Machine Learning."},
]
input_ids = tokenizer.apply_chat_template(messages, return_tensors="pt", return_dict=True).to("cuda")
outputs = model.generate(**input_ids, max_new_tokens=256)
print(tokenizer.decode(outputs[0]))
The phi-4 o1 ft model is designed for a wide range of applications, particularly those requiring advanced reasoning, high-quality text generation, and multilingual capabilities. Below are some of the intended use cases:
Complex Reasoning Tasks:
Multilingual Applications:
Content Creation:
Educational Tools:
Customer Support:
Safety-Critical Applications:
While phi-4 o1 ft is a powerful and versatile model, it has certain limitations that users should be aware of:
Bias and Fairness:
Contextual Understanding:
Real-Time Knowledge:
Safety and Harmlessness:
Resource Requirements:
Ethical Considerations:
Domain-Specific Limitations:
Detailed results can be found here! Summarized results can be found here!
| Metric | Value (%) |
|---|---|
| Average | 30.11 |
| IFEval (0-Shot) | 2.90 |
| BBH (3-Shot) | 52.17 |
| MATH Lvl 5 (4-Shot) | 39.43 |
| GPQA (0-shot) | 17.67 |
| MuSR (0-shot) | 22.15 |
| MMLU-PRO (5-shot) | 46.37 |