AI-MO/NuminaMath-CoT
Viewer • Updated • 860k • 117k • 597
How to use Natarizki/CMLM-0.8B with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("text-generation", model="Natarizki/CMLM-0.8B")
messages = [
{
"role": "user",
"content": [
{"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"},
{"type": "text", "text": "What animal is on the candy?"}
]
},
]
pipe(text=messages) # Load model directly
from transformers import AutoProcessor, AutoModelForMultimodalLM
processor = AutoProcessor.from_pretrained("Natarizki/CMLM-0.8B")
model = AutoModelForMultimodalLM.from_pretrained("Natarizki/CMLM-0.8B", device_map="auto")
messages = [
{
"role": "user",
"content": [
{"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"},
{"type": "text", "text": "What animal is on the candy?"}
]
},
]
inputs = processor.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(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:]))How to use Natarizki/CMLM-0.8B with vLLM:
# Install vLLM from pip:
pip install vllm
# Start the vLLM server:
vllm serve "Natarizki/CMLM-0.8B"
# Call the server using curl (OpenAI-compatible API):
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "Natarizki/CMLM-0.8B",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'docker model run hf.co/Natarizki/CMLM-0.8B
How to use Natarizki/CMLM-0.8B with SGLang:
# Install SGLang from pip:
pip install sglang
# Start the SGLang server:
python3 -m sglang.launch_server \
--model-path "Natarizki/CMLM-0.8B" \
--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": "Natarizki/CMLM-0.8B",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'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 "Natarizki/CMLM-0.8B" \
--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": "Natarizki/CMLM-0.8B",
"messages": [
{
"role": "user",
"content": "What is the capital of France?"
}
]
}'How to use Natarizki/CMLM-0.8B with Docker Model Runner:
docker model run hf.co/Natarizki/CMLM-0.8B
Coding + Math Language Model — a Qwen3.5-0.8B fine-tuned for code generation and mathematical reasoning.
| Property | Value |
|---|---|
| Base Model | unsloth/Qwen3.5-0.8B |
| Architecture | Qwen3.5 (Gated DeltaNet + Full Attention hybrid) |
| Parameters | 0.8B |
| Training Method | LoRA (r=16, α=32) |
| Precision | float32 (no quantization) |
| Max Context | 2048 tokens |
| Framework | Unsloth + TRL SFTTrainer |
| Hardware | NVIDIA Tesla T4 (16 GB VRAM) |
| Training Steps | 4,000 |
| Dataset | Samples | Domain |
|---|---|---|
| Magicoder-Evol-Instruct-110K | 110,000 | Code instruction following |
| MetaMathQA | 395,000 | Mathematical reasoning |
| NuminaMath-CoT | 860,000 | Math chain-of-thought |
| riddles_v1 | 469 | Riddles & logical reasoning |
| Total | ~1,366,000 |
⚠️ Note: Riddle dataset represents only 0.03% of total training data. Riddle/logic puzzle performance remains limited due to insufficient exposure. See Limitations below.
learning_rate: 2e-4
max_steps: 4000
per_device_train_batch_size: 4
gradient_accumulation_steps: 2
effective_batch_size: 16
warmup_steps: 100
optimizer: adamw_torch_fused
gradient_checkpointing: unsloth
lora_r: 16
lora_alpha: 32
lora_dropout: 0
target_modules: [q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj]
packing: true (ignored for processor-based model)
max_seq_length: 2048
precision: float32
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained("Natarizki/CMLM-0.8B", device_map="auto")
tokenizer = AutoTokenizer.from_pretrained("Natarizki/CMLM-0.8B")
messages = [{"role": "user", "content": "Write a Python function to check if a number is prime."}]
inputs = tokenizer.apply_chat_template(messages, tokenize=True, add_generation_prompt=True, return_tensors="pt").to(model.device)
outputs = model.generate(inputs, max_new_tokens=256, temperature=0.7, do_sample=True)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
Benchmarked on NVIDIA T4 with float32 inference via Unsloth. Results are non-deterministic (temperature=0.7).
| Domain | CMLM-0.8B (tok/s) | Base Qwen3.5-0.8B (tok/s) | Avg Latency (CMLM) |
|---|---|---|---|
| Coding | 12.1 | 15.2 | 39.0s |
| Math | 14.8 | 15.1 | 15.9s |
| General | 15.0 | 15.1 | 17.0s |
Lower coding tok/s reflects longer, more detailed code responses — not degraded quality.
| Domain | Status | Notes |
|---|---|---|
| Code Generation | ✅ Strong | Correct Python with docstrings, clean style |
| Math Reasoning | ✅ Good | Step-by-step CoT, correct answers on standard problems |
| Definitions/Explanations | ✅ Accurate | Concise, technically correct |
| Arithmetic | ⚠️ Variable | Correct ~50% at temp=0.7; verify critical outputs |
| Riddles/Logic Puzzles | ❌ Weak | Insufficient training signal (0.03% of data) |
temperature=0.0 for deterministic outputs when correctness matters.Apache 2.0 (inherits from Qwen3.5)