Downloads · 30 days
0
chayuto/gemma-4-e2b-it-solitaire-advisor-volcloseout-lora
gemma-4-e2b-it-solitaire-advisor-volcloseout-lora is a text generation model from chayuto. Use it when you need the model to write or continue text. It is set up for mlx. The card lists the license as gemma.
A LoRA adapter that distils a 31B Gemma Klondike Solitaire advisor into the ~2B-effective Gemma 4 E2B text model (4-bit, MLX), runnable locally on a 16 GB Apple Silicon Mac.
Downloads · 30 days
0
Access
Public
Updated Jun 20, 2026
Repo size
50.9 MB
Likes
0
Public
Click a slice to open those files.
.safetensors50.9 MB · 100%
From the Hugging Face model README
A LoRA adapter that distils a 31B Gemma Klondike Solitaire advisor into the ~2B-effective Gemma 4 E2B text model (4-bit, MLX), runnable locally on a 16 GB Apple Silicon Mac.
This is the close-out variant of
chayuto/gemma-4-e2b-it-solitaire-advisor-lora
(the "volume" lead student). It keeps everything about that recipe and adds one
change to the training corpus: a gentle, train-only oversample of winning-game
close-out decisions (rows from won games where the board is near-complete,
faceDown <= 2). That single change targets a specific failure of the volume
student, a false resign on a winnable endgame, and on the in-distribution eval
it both removes that failure and raises the win count.
The teacher is gemma-4-31b-it (Google's Gemma 4 31B, accessed through a
separate harvester app). The teacher itself wins roughly 31% of games, so this
adapter's ceiling is teacher-level imitation, not optimal play.
| Base model | mlx-community/Gemma4-E2B-IT-Text-int4 (Gemma 4 E2B IT, text-only, int4) |
| Adapter type | LoRA over a 4-bit-quantised base |
| LoRA rank | 16 (scale 2.0, dropout 0.05) |
| LoRA target modules | self_attn.{q,k,v,o}_proj, mlp.{gate,up,down}_proj |
| LoRA layers | top 16 layers |
| Training framework | mlx-lm |
| Hardware | Apple Silicon, 16 GB unified memory (Metal GPU) |
| Adapter size on disk | ~51 MB (bf16 LoRA weights over the 4-bit base) |
| Iterations trained | 1,000 (shipped weights = iter 1,000, the evaluated checkpoint) |
| Decoding used for eval | greedy (temp-0.3 JSON parse-rescue only) |
Hyperparameters are byte-for-byte identical to the volume lead and the project's other Gemma 4 E2B arms, so the only difference from volume is the corpus reweighting described under Training data.
In scope. Acting as a move-selection advisor inside a Klondike Solitaire client that already enforces game rules:
LEGAL MOVES block),
emit a single JSON object choosing one offered legal move by index, or
move_index: -1 to resign.mlx-lm.Out of scope. Open-ended chat; game-rule enforcement (it selects from the
supplied legalMoves, it does not verify legality); optimal play (teacher
ceiling ~31%); other Solitaire variants; non-MLX backends.
Each game is played turn-by-turn under the faithful production prompt
(hybrid-v1.6) on a fixed deck, greedy decoding, cap 300 turns, with a
tiered JSON parse-rescue (temp-0.3 retry) matching production. Every finished or
resigned game is then exact-adjudicated: the recorded decisions are replayed
through the engine with zero drift, and the final or resign position is handed
to a sound best-first solver (SOLVED / UNSOLVABLE / UNKNOWN at a node cap). This
distinguishes a real win from a cap-truncated one, and a correct resign on a
dead board from a quit on a winnable one.
The eval set is 13 winnable decks held out by seed from the harvester pool
the training data was drawn from. meanFC is the mean cards on foundations
(out of 52) at game end; 52 is a win.
| arm | corpus | meanFC | wins | resigns |
|---|---|---|---|---|
| volume (lead) | 6,859 rows, 36% won | ~30 | 5 | 2 |
| close-out (this adapter) | volume + gentle close-out oversample | 40.8 | 8 | 0 |
The 8 wins reproduced across two independent runs (the volume baseline scored 5
in the same window). The win that most cleanly shows the effect is
#4221577640: the volume student false-resigns it (the board is winnable); this
adapter wins it. Of the 5 non-wins here, adjudication shows reach is intact, not
a mid-game collapse:
#1388178981 (fc22), #3263196305
(fc18), #4161700176 (fc12), #4250754298 (fc18). No legal line wins them.#3841057237 reached fc45 fd0 and the solver marks
it SOLVED; it was cap-truncated on the last few foundation moves, not stalled.Not yet run. The fresh-deck pass (12 solver-winnable decks with zero corpus overlap) that the volume lead reports has not been executed for this adapter. A generalization number will be added here when it exists. Treat the in-distribution result above as the only verified claim.
Source. Per-decision play logs from a Klondike client where the 31B
gemma-4-31b-it teacher chose moves, published as the
chayuto/klondike-llm-decisions
dataset (CC-BY-4.0).
Base selection (the "volume" pool). The entire non-eval success pool: 6,859 decisions across 77 games (36% won), with the 13 eval seeds held out. Split at the game level into 5,663 train / 531 validation / 665 test.
Close-out reweighting (this adapter). Train-only: each training row that comes from a won game and shows a near-complete board (faceDown <= 2) gets one extra copy (781 such rows, ~14% of train), giving 6,444 train rows. Validation and test are byte-identical to the volume split, so the only difference between this adapter and the volume lead is the train-side reweighting. The move mix stays draw-healthy (draw fraction 44.7% -> 41.4%, foundation 21.9% -> 27.7%); this is a deliberately gentle 1x oversample. An earlier, more aggressive 2x close-out oversample on a loop-compressed base was rejected for regressing mid-game reach; the gentle 1x on the intact volume pool does not show that regression (reach intact, see Evaluation).
model: mlx-community/Gemma4-E2B-IT-Text-int4
max_seq_length: 2048
batch_size: 1
num_layers: 16
grad_checkpoint: true
learning_rate: 2.0e-4
iters: 1000
save_every: 250
val_batches: 25
lora_parameters:
rank: 16
scale: 2.0
dropout: 0.05
keys:
- self_attn.q_proj
- self_attn.k_proj
- self_attn.v_proj
- self_attn.o_proj
- mlp.gate_proj
- mlp.up_proj
- mlp.down_proj
# Apple Silicon, Python 3.12 venv recommended
python3.12 -m venv venv && source venv/bin/activate
pip install mlx mlx-lm huggingface-hub
The Gemma4-E2B-IT-Text-int4 base needs a small sanitize() patch to load on
current mlx-lm. The 6-line patch is gemma4_finetune/gemma4_text_patch.py in
the source repo
(github.com/chayuto/solitaire-analytics);
apply it (or use an mlx-lm version that merged the support) before loading.
from huggingface_hub import snapshot_download
from mlx_lm import load, generate
# import gemma4_text_patch # apply the base-loading patch first (see above)
adapter_path = snapshot_download(
repo_id="chayuto/gemma-4-e2b-it-solitaire-advisor-volcloseout-lora",
allow_patterns=["adapters.safetensors", "adapter_config.json"],
)
model, tokenizer = load(
"mlx-community/Gemma4-E2B-IT-Text-int4",
adapter_path=adapter_path,
)
solitaire_prompt = open("your_solitaire_prompt.txt").read() # the v1.6 harvester prompt
wrapped = tokenizer.apply_chat_template(
[{"role": "user", "content": solitaire_prompt}],
tokenize=False, add_generation_prompt=True,
)
print(generate(model, tokenizer, prompt=wrapped, max_tokens=512))
The model emits a JSON object whose final_decision.move_index is a 0-based
index into the prompt's legalMoves array (or -1 to resign). Trust
move_index, not the prose.
mlx-community/Gemma4-E2B-IT-Text-int4.The adapter is released under the Gemma Terms of Use (inherited from the
base). Use, redistribution, and modification require compliance with the
Gemma Prohibited Use Policy.
The training and evaluation code in the source repository is MIT. The
training data (chayuto/klondike-llm-decisions)
is CC-BY-4.0.
@misc{orapinpatipat2026solitaireadvisorgemma4closeout,
title = {Distilling a 31B Klondike Solitaire advisor into Gemma 4 E2B via MLX LoRA: close-out arm},
author = {Orapinpatipat, Chayut},
year = {2026},
month = jun,
howpublished = {\url{https://huggingface.co/chayuto/gemma-4-e2b-it-solitaire-advisor-volcloseout-lora}},
note = {LoRA adapter; gentle close-out oversample over the volume arm, iter-1000 checkpoint},
}
mlx-community/Gemma4-E2B-IT-Text-int4 from the
mlx-community team.mlx-lm from Apple Machine Learning Research.gemma-4-31b-it from Google DeepMind.This is a variant of the project's lead Gemma 4 E2B student. It improves the
in-distribution win rate over the volume lead by fixing a false-resign on
winnable endgames, confirmed across two eval runs. It is published as a
distinct, clearly-scoped artifact; the
volume
adapter remains the generalization-proven flagship until this adapter's
fresh-deck pass is run.