Text Generation
Transformers
Safetensors
English
qwen2
math
cot
text-generation-inference
preview
experimental
conversational
Instructions to use prithivMLmods/Deepmath-Competitive-1.5B-Preview with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use prithivMLmods/Deepmath-Competitive-1.5B-Preview with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="prithivMLmods/Deepmath-Competitive-1.5B-Preview") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("prithivMLmods/Deepmath-Competitive-1.5B-Preview") model = AutoModelForCausalLM.from_pretrained("prithivMLmods/Deepmath-Competitive-1.5B-Preview") 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/Deepmath-Competitive-1.5B-Preview with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "prithivMLmods/Deepmath-Competitive-1.5B-Preview" # 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/Deepmath-Competitive-1.5B-Preview", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/prithivMLmods/Deepmath-Competitive-1.5B-Preview
- SGLang
How to use prithivMLmods/Deepmath-Competitive-1.5B-Preview 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/Deepmath-Competitive-1.5B-Preview" \ --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/Deepmath-Competitive-1.5B-Preview", "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/Deepmath-Competitive-1.5B-Preview" \ --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/Deepmath-Competitive-1.5B-Preview", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use prithivMLmods/Deepmath-Competitive-1.5B-Preview with Docker Model Runner:
docker model run hf.co/prithivMLmods/Deepmath-Competitive-1.5B-Preview
Improve language tag
#1
by lbourdois - opened
README.md
CHANGED
|
@@ -1,96 +1,108 @@
|
|
| 1 |
-
---
|
| 2 |
-
library_name: transformers
|
| 3 |
-
tags:
|
| 4 |
-
- math
|
| 5 |
-
- cot
|
| 6 |
-
- text-generation-inference
|
| 7 |
-
- preview
|
| 8 |
-
- experimental
|
| 9 |
-
license: apache-2.0
|
| 10 |
-
language:
|
| 11 |
-
-
|
| 12 |
-
|
| 13 |
-
-
|
| 14 |
-
|
| 15 |
-
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
1.
|
| 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 |
-
|
| 95 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 96 |
Performs best with clearly structured prompts and formal question phrasing.
|
|
|
|
| 1 |
+
---
|
| 2 |
+
library_name: transformers
|
| 3 |
+
tags:
|
| 4 |
+
- math
|
| 5 |
+
- cot
|
| 6 |
+
- text-generation-inference
|
| 7 |
+
- preview
|
| 8 |
+
- experimental
|
| 9 |
+
license: apache-2.0
|
| 10 |
+
language:
|
| 11 |
+
- zho
|
| 12 |
+
- eng
|
| 13 |
+
- fra
|
| 14 |
+
- spa
|
| 15 |
+
- por
|
| 16 |
+
- deu
|
| 17 |
+
- ita
|
| 18 |
+
- rus
|
| 19 |
+
- jpn
|
| 20 |
+
- kor
|
| 21 |
+
- vie
|
| 22 |
+
- tha
|
| 23 |
+
- ara
|
| 24 |
+
base_model:
|
| 25 |
+
- Qwen/Qwen2.5-1.5B-Instruct
|
| 26 |
+
pipeline_tag: text-generation
|
| 27 |
+
---
|
| 28 |
+
|
| 29 |
+

|
| 30 |
+
|
| 31 |
+
# **Deepmath-Competitive-1.5B-Preview**
|
| 32 |
+
|
| 33 |
+
> **Deepmath-Competitive-1.5B-Preview** is a **chain-of-thought reasoning model** fine-tuned from **Qwen-1.5B**, purpose-built for solving **mathematical problems** in both **English** and **Chinese** with a focus on **long-context understanding**. It enables advanced reasoning and detailed step-by-step problem solving in a compact form — ideal for competitive exam preparation, tutoring systems, and math-focused AI assistants.
|
| 34 |
+
|
| 35 |
+
## **Key Features**
|
| 36 |
+
|
| 37 |
+
1. **Chain-of-Thought Math Reasoning**
|
| 38 |
+
Specifically trained to output detailed intermediate steps for math problems, Deepmath-Competitive-1.5B-Preview ensures interpretability and logical clarity — vital for learning and validation.
|
| 39 |
+
|
| 40 |
+
2. **Bilingual Proficiency (English + Chinese)**
|
| 41 |
+
Proficient in understanding and solving math problems in **both English and Simplified Chinese**, supporting diverse educational needs.
|
| 42 |
+
|
| 43 |
+
3. **Long-Context Reasoning**
|
| 44 |
+
Optimized for **long-form math problems** and word problem comprehension, enabling reasoning over extended contexts and compound queries.
|
| 45 |
+
|
| 46 |
+
4. **Compact yet Powerful**
|
| 47 |
+
With just 1.5B parameters, it delivers robust performance on arithmetic, algebra, geometry, logic, and competitive exam-style word problems with minimal computational cost.
|
| 48 |
+
|
| 49 |
+
5. **Structured Step-by-Step Computation**
|
| 50 |
+
Produces clean, stepwise outputs that mimic expert human problem-solving, helping learners follow the process and logic intuitively.
|
| 51 |
+
|
| 52 |
+
## **Quickstart with Transformers**
|
| 53 |
+
|
| 54 |
+
```python
|
| 55 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 56 |
+
|
| 57 |
+
model_name = "prithivMLmods/Deepmath-Competitive-1.5B-Preview"
|
| 58 |
+
|
| 59 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 60 |
+
model_name,
|
| 61 |
+
torch_dtype="auto",
|
| 62 |
+
device_map="auto"
|
| 63 |
+
)
|
| 64 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 65 |
+
|
| 66 |
+
prompt = "Solve: A train travels 180 km in 3 hours. What is its average speed?"
|
| 67 |
+
messages = [
|
| 68 |
+
{"role": "system", "content": "You are a helpful tutor skilled in solving math problems with step-by-step explanations."},
|
| 69 |
+
{"role": "user", "content": prompt}
|
| 70 |
+
]
|
| 71 |
+
text = tokenizer.apply_chat_template(
|
| 72 |
+
messages,
|
| 73 |
+
tokenize=False,
|
| 74 |
+
add_generation_prompt=True
|
| 75 |
+
)
|
| 76 |
+
model_inputs = tokenizer([text], return_tensors="pt").to(model.device)
|
| 77 |
+
|
| 78 |
+
generated_ids = model.generate(
|
| 79 |
+
**model_inputs,
|
| 80 |
+
max_new_tokens=512
|
| 81 |
+
)
|
| 82 |
+
generated_ids = [
|
| 83 |
+
output_ids[len(input_ids):] for input_ids, output_ids in zip(model_inputs.input_ids, generated_ids)
|
| 84 |
+
]
|
| 85 |
+
|
| 86 |
+
response = tokenizer.batch_decode(generated_ids, skip_special_tokens=True)[0]
|
| 87 |
+
```
|
| 88 |
+
|
| 89 |
+
## **Intended Use**
|
| 90 |
+
|
| 91 |
+
- **Math Tutoring Bots**: Delivers in-depth, multi-step solutions for students preparing for competitive and school-level math.
|
| 92 |
+
- **Bilingual Educational Apps**: Effective in English and Chinese teaching environments.
|
| 93 |
+
- **STEM Reasoning Tools**: Supports structured reasoning across science and engineering questions.
|
| 94 |
+
- **Compact LLM Deployments**: Suitable for low-latency environments like mobile apps, edge devices, or web integrations.
|
| 95 |
+
|
| 96 |
+
## **Limitations**
|
| 97 |
+
|
| 98 |
+
1. **Domain Focus**:
|
| 99 |
+
Primarily tuned for mathematics; performance may drop outside STEM or logical domains.
|
| 100 |
+
|
| 101 |
+
2. **Model Scale**:
|
| 102 |
+
While efficient, it may underperform on abstract or research-level problems compared to larger models.
|
| 103 |
+
|
| 104 |
+
3. **Inherited Biases**:
|
| 105 |
+
As a fine-tune of Qwen-1.5B, some pretraining biases may persist. Review is advised in critical applications.
|
| 106 |
+
|
| 107 |
+
4. **Prompt Sensitivity**:
|
| 108 |
Performs best with clearly structured prompts and formal question phrasing.
|