Downloads · 30 days
65
31% of all-time downloads
justinj92/Qwen2.5-3B-2048Player
Qwen2.5-3B-2048Player is a text generation model from justinj92. Use it when you need the model to write or continue text. It is set up for transformers, peft. The card lists the license as other.
Downloads · 30 days
65
31% of all-time downloads
All-time downloads
208
Public
Parameters
3.1B
6.2 GB on disk
Likes
1
Public
Click a slice to open those files.
.safetensors6.2 GB · 100%
From the Hugging Face model README
A Qwen2.5-3B model fine-tuned to master the 2048 game using GRPO! 🚀
</div>This model is a fine-tuned version of Qwen2.5-3B-Instruct that has learned to play the addictive 2048 game through Grouped Relative Policy Optimization (GRPO)!
<move>left</move>import torch
from unsloth import FastLanguageModel
# Load the model
model, tokenizer = FastLanguageModel.from_pretrained(
model_name="justinj92/Qwen2.5-3B-2048Player",
max_seq_length=8192,
dtype=torch.bfloat16,
load_in_4bit=True,
)
FastLanguageModel.for_inference(model)
# Game setup
messages = [
{
"role": "system",
"content": "You are an excellent 2048 player. Always choose the move most likely to lead to combine cells to eventually reach the number 2048. Optional moves are 'left', 'right', 'up', 'down'. Return your move as an XML object with a single property 'move', like so: <move>left</move>"
},
{
"role": "user",
"content": "2 | 4 | _ | _\n"
"_ | 2 | _ | _\n"
"_ | _ | _ | _\n"
"_ | _ | _ | _"
}
]
# Generate move
inputs = tokenizer.apply_chat_template(
messages,
return_tensors="pt",
add_generation_prompt=True
).to("cuda")
outputs = model.generate(
input_ids=inputs,
max_new_tokens=100,
temperature=0.7,
top_p=0.9,
)
response = tokenizer.decode(outputs[0][inputs.shape[1]:], skip_special_tokens=True)
print(response) # <move>left</move>
Cloud - Azure VM - Standard_NC40ads_H100_v5 Region - North Europe
The model was trained using GRPO with trajectories collected from self-play:
The game board is represented as a simple text grid:
2 | 4 | 8 | 16
32 | 64 | 128 | 256
512 | 1024 | _ | 2
4 | 8 | 16 | 32
Where _ represents empty cells.
The model learns to:
If you use this model, please consider citing:
@misc{qwen2048player2025,
title={Qwen2.5-3B-2048-Player: A GRPO-trained 2048 Game Agent},
author={JustinJ},
year={2025},
publisher={Hugging Face},
howpublished={\url{https://huggingface.co/justinj92/Qwen2.5-3B-2048Player}}
}
Feel free to open an issue on the model repository for questions or feedback!
Happy sliding! May all your tiles merge smoothly! 🎮✨