Instructions to use prithivMLmods/Logics-Qwen3-Math-4B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use prithivMLmods/Logics-Qwen3-Math-4B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="prithivMLmods/Logics-Qwen3-Math-4B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("prithivMLmods/Logics-Qwen3-Math-4B") model = AutoModelForCausalLM.from_pretrained("prithivMLmods/Logics-Qwen3-Math-4B") 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
- vLLM
How to use prithivMLmods/Logics-Qwen3-Math-4B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "prithivMLmods/Logics-Qwen3-Math-4B" # 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/Logics-Qwen3-Math-4B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/prithivMLmods/Logics-Qwen3-Math-4B
- SGLang
How to use prithivMLmods/Logics-Qwen3-Math-4B 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/Logics-Qwen3-Math-4B" \ --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/Logics-Qwen3-Math-4B", "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/Logics-Qwen3-Math-4B" \ --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/Logics-Qwen3-Math-4B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use prithivMLmods/Logics-Qwen3-Math-4B with Docker Model Runner:
docker model run hf.co/prithivMLmods/Logics-Qwen3-Math-4B
Logics-Qwen3-Math-4B
Logics-Qwen3-Math-4B is a reasoning-focused model fine-tuned on Qwen3-4B-Thinking-2507 for mathematical reasoning and logical coding, trained on OpenMathReasoning, OpenCodeReasoning, and Helios-R-6M datasets. It excels in structured mathematical problem solving, algorithmic logic, and probabilistic reasoning, making it ideal for educators, researchers, and developers focused on computational logic and math.
Key Features
Mathematical & Logical Reasoning Fine-tuned for high-precision math reasoning, algorithmic problem-solving, and logical coding tasks.
Event-Driven & Probabilistic Modeling Performs probability-based simulations, structured decision-making, and multi-step logical reasoning with strong accuracy.
Multilingual Problem Solving Supports math and logic tasks across multiple languages, suitable for global research and education workflows.
Hybrid Symbolic-Algorithmic Thinking Combines structured logic, symbolic computation, and probabilistic inference to handle uncertainty-driven problems efficiently.
Structured Output Mastery Generates outputs in LaTeX, Markdown, JSON, CSV, and YAML, enabling smooth integration into technical and research workflows.
Optimized 4B Parameter Footprint Deployable on mid-range GPUs, offline clusters, and edge devices, maintaining high reasoning quality while being resource-efficient.
Quickstart with Transformers
from transformers import AutoModelForCausalLM, AutoTokenizer
model_name = "prithivMLmods/Logics-Qwen3-Math-4B"
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype="auto",
device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained(model_name)
prompt = "Solve the equation x^2 - 5x + 6 = 0 and show all reasoning steps."
messages = [
{"role": "system", "content": "You are a math and logic tutor skilled in algebra, probability, and structured programming reasoning."},
{"role": "user", "content": prompt}
]
text = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True
)
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
generated_ids = model.generate(
**model_inputs,
max_new_tokens=512
)
generated_ids = [
output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
]
response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
print(response)
Intended Use
- High-precision mathematical reasoning and problem-solving
- Algorithmic logic, structured coding tasks, and probability analysis
- Educational and research-focused workflows
- Deployment on mid-resource environments with efficient reasoning
- Structured data and technical content generation
Limitations
- Focused on math and logic—less suited for creative writing or casual conversation
- Very complex multi-hop reasoning may challenge the 4B parameter capacity
- Prioritizes structured reasoning over conversational tone
- Outputs may be inconsistent for extremely long or cross-domain multi-document contexts
- Downloads last month
- 51
Model tree for prithivMLmods/Logics-Qwen3-Math-4B
Base model
Qwen/Qwen3-4B-Thinking-2507