Instructions to use prithivMLmods/TOI-157-Phi-4-Reasoning-Mini with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use prithivMLmods/TOI-157-Phi-4-Reasoning-Mini with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="prithivMLmods/TOI-157-Phi-4-Reasoning-Mini") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("prithivMLmods/TOI-157-Phi-4-Reasoning-Mini") model = AutoModelForCausalLM.from_pretrained("prithivMLmods/TOI-157-Phi-4-Reasoning-Mini") 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 prithivMLmods/TOI-157-Phi-4-Reasoning-Mini with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "prithivMLmods/TOI-157-Phi-4-Reasoning-Mini" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "prithivMLmods/TOI-157-Phi-4-Reasoning-Mini", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/prithivMLmods/TOI-157-Phi-4-Reasoning-Mini
- SGLang
How to use prithivMLmods/TOI-157-Phi-4-Reasoning-Mini 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 "prithivMLmods/TOI-157-Phi-4-Reasoning-Mini" \ --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": "prithivMLmods/TOI-157-Phi-4-Reasoning-Mini", "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 "prithivMLmods/TOI-157-Phi-4-Reasoning-Mini" \ --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": "prithivMLmods/TOI-157-Phi-4-Reasoning-Mini", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use prithivMLmods/TOI-157-Phi-4-Reasoning-Mini with Docker Model Runner:
docker model run hf.co/prithivMLmods/TOI-157-Phi-4-Reasoning-Mini
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
Abliterated Reasoning Enhanced reasoning precision through polished token probability distributions in Phi-based models, ensuring balanced and context-aware outputs.
Event Simulation & Logical Analysis Models random events, probability-driven reasoning, and logical decision-making with strong consistency.
Multilingual Mathematical & General-Purpose Problem Solving Delivers robust performance in math, probability, and structured multilingual tasks, enabling wide applicability in global research and education.
Hybrid Symbolic-Probabilistic Thinking Combines structured logic, probabilistic inference, and reasoning fluency, providing accuracy across uncertainty-driven tasks.
Structured Output Mastery Generates well-structured outputs in LaTeX, Markdown, JSON, CSV, and YAML, supporting technical workflows and data-driven research.
Optimized Lightweight Footprint Compact mini parameter size, deployable on edge devices, offline clusters, and mid-range GPUs, while maintaining reasoning quality.
Quickstart with Transformers
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.
- Downloads last month
- 5
