94 lines
3.4 KiB
Markdown
94 lines
3.4 KiB
Markdown
|
|
---
|
|||
|
|
license: mit
|
|||
|
|
base_model:
|
|||
|
|
- microsoft/Phi-4-mini-reasoning
|
|||
|
|
language:
|
|||
|
|
- en
|
|||
|
|
pipeline_tag: text-generation
|
|||
|
|
library_name: transformers
|
|||
|
|
tags:
|
|||
|
|
- trl
|
|||
|
|
- text-generation-inference
|
|||
|
|
- math
|
|||
|
|
- code
|
|||
|
|
---
|
|||
|
|
|
|||
|
|

|
|||
|
|
|
|||
|
|
# **TOI-157-Phi-4-Reasoning-Mini**
|
|||
|
|
|
|||
|
|
> **TOI-157-Phi-4-Reasoning-Mini** is a reasoning-focused model fine-tuned on **Microsoft’s Phi-4-mini-reasoning** for **Edge-level Abliterated Reasoning** and optimized **polished token probabilities**, enhancing balanced **multilingual generation** across mathematics and general-purpose reasoning.
|
|||
|
|
> It specializes in **event-driven logic**, **structured analysis**, and precise probabilistic modeling—making it an ideal tool for researchers, educators, and developers working with uncertainty and structured reasoning.
|
|||
|
|
|
|||
|
|
## **Key Features**
|
|||
|
|
|
|||
|
|
1. **Abliterated Reasoning**
|
|||
|
|
Enhanced reasoning precision through polished token probability distributions in Phi-based models, ensuring balanced and context-aware outputs.
|
|||
|
|
|
|||
|
|
2. **Event Simulation & Logical Analysis**
|
|||
|
|
Models random events, probability-driven reasoning, and logical decision-making with strong consistency.
|
|||
|
|
|
|||
|
|
3. **Multilingual Mathematical & General-Purpose Problem Solving**
|
|||
|
|
Delivers robust performance in **math**, **probability**, and **structured multilingual tasks**, enabling wide applicability in global research and education.
|
|||
|
|
|
|||
|
|
4. **Hybrid Symbolic-Probabilistic Thinking**
|
|||
|
|
Combines structured logic, probabilistic inference, and reasoning fluency, providing accuracy across uncertainty-driven tasks.
|
|||
|
|
|
|||
|
|
5. **Structured Output Mastery**
|
|||
|
|
Generates well-structured outputs in **LaTeX**, **Markdown**, **JSON**, **CSV**, and **YAML**, supporting technical workflows and data-driven research.
|
|||
|
|
|
|||
|
|
6. **Optimized Lightweight Footprint**
|
|||
|
|
Compact **mini parameter size**, deployable on **edge devices**, **offline clusters**, and **mid-range GPUs**, while maintaining reasoning quality.
|
|||
|
|
|
|||
|
|
## **Quickstart with Transformers**
|
|||
|
|
|
|||
|
|
```python
|
|||
|
|
import torch
|
|||
|
|
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
|
|||
|
|
torch.random.manual_seed(0)
|
|||
|
|
|
|||
|
|
model_id = "prithivMLmods/TOI-157-Phi-4-Reasoning-Mini"
|
|||
|
|
model = AutoModelForCausalLM.from_pretrained(
|
|||
|
|
model_id,
|
|||
|
|
device_map="cuda",
|
|||
|
|
torch_dtype="auto",
|
|||
|
|
trust_remote_code=True,
|
|||
|
|
)
|
|||
|
|
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
|||
|
|
|
|||
|
|
messages = [{
|
|||
|
|
"role": "user",
|
|||
|
|
"content": "How to solve 3*x^2 + 4*x + 5 = 1?"
|
|||
|
|
}]
|
|||
|
|
inputs = tokenizer.apply_chat_template(
|
|||
|
|
messages,
|
|||
|
|
add_generation_prompt=True,
|
|||
|
|
return_dict=True,
|
|||
|
|
return_tensors="pt",
|
|||
|
|
)
|
|||
|
|
|
|||
|
|
outputs = model.generate(
|
|||
|
|
**inputs.to(model.device),
|
|||
|
|
max_new_tokens=32768,
|
|||
|
|
temperature=0.8,
|
|||
|
|
top_p=0.95,
|
|||
|
|
do_sample=True,
|
|||
|
|
)
|
|||
|
|
outputs = tokenizer.batch_decode(outputs[:, inputs["input_ids"].shape[-1]:])
|
|||
|
|
|
|||
|
|
print(outputs[0])
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
## **Intended Use**
|
|||
|
|
|
|||
|
|
* Balanced multilingual reasoning and probability modeling
|
|||
|
|
* Event simulation, uncertainty analysis, and structured problem solving
|
|||
|
|
* Educational and research-focused reasoning tasks
|
|||
|
|
* Lightweight deployment in constrained environments
|
|||
|
|
* Technical content and structured data generation
|
|||
|
|
|
|||
|
|
## **Limitations**
|
|||
|
|
|
|||
|
|
* Focused on reasoning and mathematics—less suited for creative writing
|
|||
|
|
* Smaller size may limit depth on highly complex, multi-step tasks
|
|||
|
|
* Prioritizes structured reasoning and probabilistic accuracy over conversational or emotional tone.
|