File size: 3,453 Bytes
a9c4730
e4afbb9
a9c4730
 
e4afbb9
 
 
 
 
 
 
 
 
 
 
e3abe48
 
e4afbb9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e3abe48
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
---
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
---

![1](https://cdn-uploads.huggingface.co/production/uploads/65bb837dbfb878f46c77de4c/jhaXgo4VgX-9HbP3wtu7s.png)

# **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.