laya-tetris-placement

A Laya typed-decision model, fine-tuned with LoRA to choose where a Tetris piece should go. Given a text state that contains a table of candidate placements, it returns a probability for each option letter (A to H) in one forward pass, about 25 ms on a Mac.

Code, evals and the full story: https://github.com/arkaung/laya-tetris. Write-up: https://arkaung.github.io/laya-tetris/. Dataset: https://huggingface.co/datasets/aaung/laya-tetris-decisions.

Result

Ten 150-move games (seeds 1 to 10), scoring options by averaging four random orderings per move:

Player Lines per game Survived 150 moves
Random placement 0.2 0 / 10
Laya base, zero-shot, one 8-way question with lettered options 0.1 0 / 10
This model 56.6 10 / 10
Heuristic teacher (greedy) 56.4 10 / 10

It chose the teacher's move on essentially every decision and took all 480 line clears that were available. The ceiling in 150 moves is 60 lines, so this test can't tell it apart from the teacher. Read it as a distilled heuristic that matches the teacher, not as a model that plays better than it.

How to use it

The model only works with the exact state and question format it was trained on. The easiest way is the game code:

git clone https://github.com/arkaung/laya-tetris && cd laya-tetris
uv run laya_tetris.py --model aaung/laya-tetris-placement --compare letters --games 3 --max-moves 150

To call it directly:

import json
import laya_mlx as laya
from huggingface_hub import hf_hub_download

repo = "aaung/laya-tetris-placement"
agent = laya.load(repo)
questions = json.load(open(hf_hub_download(repo, "questions.json")))   # keep it exactly as shipped

state = """Tetris. Piece L, next IJO, hold none. Stack height 8, holes 2, bumpiness 15. Options:
A: clears 0, holes 2, bumpiness 15, height 8
B: clears 0, holes 2, bumpiness 15, height 8
C: clears 0, holes 2, bumpiness 21, height 8
D: clears 0, holes 3, bumpiness 15, height 8
E: clears 0, holes 2, bumpiness 13, height 8
F: clears 0, holes 3, bumpiness 13, height 8
G: clears 0, holes 3, bumpiness 17, height 10
H: clears 1, holes 2, bumpiness 15, height 7"""
print(agent.predict(state, questions)["answers"]["placement"]["probabilities"])   # H should get nearly all of it

The state is built by tetris_state_text in the repo. The options are the best eight placements for the current piece, in random order, so a letter means nothing by itself. Each line gives lines cleared, total holes after the move, surface bumpiness and maximum column height.

Training

  • Base model: aac6fef/laya-mlx, an MLX conversion of the English convaiinnovations/laya (ModernBERT-large, 421M parameters, 512-token context). It is the same model used in the zero-shot experiments, so the before and after are directly comparable.
  • Method: LoRA, trained with LayaStudio on an Apple silicon Mac.

Limitations

  • It doesn't see the board. Our code enumerates landing spots, computes four numbers per spot and shows the best eight. Without that table the model has nothing to read.
  • It was trained to imitate one one-move-lookahead heuristic. It can't exceed it.
  • It was tested only in the setting above: 150-move games on a Mac with laya-mlx.
  • Changing the question text, the option descriptions or the line format changes the model's input and is likely to hurt. Zero-shot, the base model got the format wrong in many small ways; this checkpoint is tuned to one exact format.

License

Apache-2.0, matching the Laya base model.

Downloads last month

-

Downloads are not tracked for this model. How to track
Safetensors
Model size
0.4B params
Tensor type
F16
·
MLX
Hardware compatibility
Log In to add your hardware

Quantized

Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for aaung/laya-tetris-placement

Finetuned
aac6fef/laya-mlx
Adapter
(1)
this model

Dataset used to train aaung/laya-tetris-placement