Athenea-4B-Math is a fine-tuned version of
huihui-ai/Huihui-Qwen3-4B-Thinking-2507-abliterated, specialized in
mathematical reasoning and problem solving.
Trained on high-quality data with explicit reasoning traces using
<think> and
</think> tags, the model is designed to perform detailed step-by-step reasoning on tasks such as
calculus, algebra, and equation solving.
Athenea-4B-Math builds upon Huihui-Qwen3’s structured reasoning capabilities, adapting them to mathematical domains. It demonstrates strong performance on symbolic reasoning and numerical problem-solving tasks.
The model was fine-tuned using the dataset
Aquiles-ai/Athenea-Math-100k, which contains a diverse range of curated math problems with reasoning traces and natural language explanations.
1from transformers import AutoModelForCausalLM, AutoTokenizer
2import torch
3model = AutoModelForCausalLM.from_pretrained("Aquiles-ai/Athenea-4B-Math",
4 dtype=torch.bfloat16,
5 trust_remote_code=True,
6 device_map="auto",
7 attn_implementation="flash_attention_2") # Requires flash-attn
8
9# Without flash-attn:
10# model = AutoModelForCausalLM.from_pretrained("Aquiles-ai/Athenea-4B-Math",
11# dtype="auto",
12# device_map="auto"
13# )
14
15tokenizer = AutoTokenizer.from_pretrained("Aquiles-ai/Athenea-4B-Math", trust_remote_code=True)
16
17messages = [
18 {"role": "user", "content": "Hey, find the derivative of 3x^4 - 2x^2 + 5x - 7"}
19]
20
21inputs = tokenizer.apply_chat_template(
22 messages,
23 add_generation_prompt=True,
24 tokenize=True,
25 return_dict=True,
26 return_tensors="pt",
27).to('cuda')
28
29with torch.no_grad():
30 output = model.generate(
31 **inputs,
32 max_new_tokens=8092,
33 pad_token_id=tokenizer.eos_token_id,
34 eos_token_id=tokenizer.eos_token_id,
35 )
36
37# Decode and print the output
38print(tokenizer.decode(output[0], skip_special_tokens=True))
1from transformers import AutoModelForCausalLM, AutoTokenizer, TextIteratorStreamer
2import torch
3from threading import Thread
4model = AutoModelForCausalLM.from_pretrained("Aquiles-ai/Athenea-4B-Math",
5 dtype=torch.bfloat16,
6 trust_remote_code=True,
7 device_map="auto",
8 attn_implementation="flash_attention_2")
9tokenizer = AutoTokenizer.from_pretrained("Aquiles-ai/Athenea-4B-Math", trust_remote_code=True)
10messages = [
11 {"role": "user", "content": "Hey, find the derivative of x^2(3x + 1) using the product rule."}
12]
13
14inputs = tokenizer.apply_chat_template(
15 messages,
16 add_generation_prompt=True,
17 tokenize=True,
18 return_dict=True,
19 return_tensors="pt",
20).to('cuda')
21
22# Create the streamer
23streamer = TextIteratorStreamer(tokenizer, skip_prompt=True, skip_special_tokens=True)
24
25# Build kwargs for generate
26generate_kwargs = dict(
27 **inputs,
28 max_new_tokens=8092,
29 pad_token_id=tokenizer.eos_token_id,
30 eos_token_id=tokenizer.eos_token_id,
31 streamer=streamer,
32)
33
34def _generate_thread(model, kwargs):
35 with torch.no_grad():
36 model.generate(**kwargs)
37
38thread = Thread(target=_generate_thread, args=(model, generate_kwargs))
39
40thread.start()
41
42for chunk in streamer:
43 print(chunk, end="", flush=True)
1vllm serve Aquiles-ai/Athenea-4B-Math \
2 --host 0.0.0.0 \
3 --port 8000 \
4 --api-key dummyapikey \
5 --max-model-len=16384 \
6 --async-scheduling \
7 --gpu-memory-utilization=0.90
1from openai import OpenAI
2client = OpenAI(api_key="dummyapikey", base_url="http://127.0.0.1:8000/v1")
3stream = client.chat.completions.create(
4 model="Aquiles-ai/Athenea-4B-Math",
5 messages=[{
6 "role": "user",
7 "content": "Hey, find the indefinite integral of 4x^3 -2x + 7"
8 }],
9 max_tokens=8092,
10 stream=True
11)
12for chunk in stream:
13 if chunk.choices[0].delta.content:
14 print(chunk.choices[0].delta.content, end="", flush=True)
In addition to code usage, you can also try our models locally through an
open-source playground on GitHub.