This model is a fine-tuned version of Qwen2-0.5B-Instruct trained to play the popular word game Wordle using reinforcement learning. Instead of supervised learning from human examples, this model learned purely from reward signals — improving its strategy game by game through the GRPO algorithm.
The model learns strategies like:
Opening with vowel-rich words like CRANE or SLATE
Using green letter positions in subsequent guesses
Repositioning yellow letters correctly
Never repeating previously guessed words
🏗️ Model Details
Property
Value
Base Model
Qwen/Qwen2-0.5B-Instruct
Model Size
0.5B parameters
Tensor Type
F16
Training Algorithm
GRPO (Group Relative Policy Optimization)
Training Games
20
Hardware
NVIDIA T4 GPU
Framework
Hugging Face Transformers + TRL
Environment
OpenEnv + TextArena Wordle
🎮 What is Wordle?
Wordle is a word guessing game where:
A secret 5-letter word is chosen
You have 6 attempts to guess it
After each guess you get color-coded feedback:
🟢 G (Green) — correct letter, correct position
🟡 Y (Yellow) — correct letter, wrong position
⬛ X (Gray) — letter not in the word
🏆 Reward System
The model was trained using 5 reward signals:
Signal
Reward
Description
Win the game
+1.0
All 5 letters correct (GGGGG)
Green letters
+0.3
Correct letter in correct position
Yellow letters
+0.1
Correct letter in wrong position
New guess
+0.3
Not repeating a previous guess
Valid word
+0.2
Guess is exactly 5 letters
🚀 Quick Start
python
1from transformers import AutoTokenizer, AutoModelForCausalLM
2import torch
34# Load model and tokenizer5model = AutoModelForCausalLM.from_pretrained(6"shaikabdulfahad/wordle-qwen2-mini",7 torch_dtype=torch.float16,8 device_map="auto",9)10tokenizer = AutoTokenizer.from_pretrained(11"shaikabdulfahad/wordle-qwen2-mini"12)1314# System prompt15system_prompt ="""You are an expert Wordle solver.
16Guess a 5-letter English word each turn.
17Feedback: G=correct position, Y=wrong position, X=not in word.
18Only respond with your guess in square brackets. Example: [crane]"""1920# Ask for a guess21messages =[22{"role":"system","content": system_prompt},23{"role":"user","content":"Start! What is your first guess?"},24]2526text = tokenizer.apply_chat_template(27 messages, tokenize=False, add_generation_prompt=True28)29inputs = tokenizer(text, return_tensors="pt").to(model.device)3031with torch.no_grad():32 outputs = model.generate(33**inputs,34 max_new_tokens=20,35 temperature=0.7,36 do_sample=True,37)3839response = tokenizer.decode(40 outputs[0][inputs["input_ids"].shape[1]:],41 skip_special_tokens=True42)43print("Model guesses:", response)
🔁 Training Pipeline
1. Connect to live Wordle environment (TextArena)
↓
2. Generate guess using current model
↓
3. Send guess to Wordle — get feedback (G/Y/X)
↓
4. Calculate reward from 5 signals
↓
5. Update model using GRPO
↓
6. Repeat for 20 games