Skip to content

Add GLiClass decision demos and 2048 model comparison - #6

Merged
Alex-Wengg merged 15 commits into
mainfrom
feat/gliclass-tetris
Sep 22, 2026
Merged

Alex-Wengg merged 15 commits into
mainfrom
feat/gliclass-tetris

Conversation

@Alex-Wengg

@Alex-Wengg Alex-Wengg commented Sep 22, 2026 •

Copy link
Copy Markdown
Member

What this solves

This adds a small, fast decision-model path and measures it against Laya under the same game state, seed, shortlist, and raw-decision rules. In the 10-seed 2048 comparison, GLiClass Edge Apps v2 LUT8 averages 10,740 points and 651.5 moves versus Laya E8 at 2,834 points and 232.5 moves. GLiClass uses 1.77 ms of model time per move versus 7.63 ms for Laya because its 32.7M encoder compares both candidates in one call while Laya scores them separately.

Included work

  • Add the GLiClass Edge Apps v2 Core ML loader, tokenizer, fixtures, and compact FP16, FP16-mask, LUT8, and LUT6 variants.
  • Add GLiClass Tetris and 2048 CLI/demo paths, including real wall clocks, deterministic seeds, marathon play, lookahead, and inference metrics.
  • Add Decision2048BenchDemo, which runs GLiClass LUT8 and Laya E8 side by side from the same seed and alternates inference to avoid Neural Engine contention.
  • Extend the 2048 CLI with Laya noul and one-pass choice policies for reproducible calibration.
  • Record full per-seed data and the conversion gate for every locally runnable sub-1B candidate tried.
  • Link the training, conversion, compression, and parity pipeline in mobius PR #101.

2048 candidate gate

All candidates receive the same top-two one-move expectimax shortlist and make the final raw choice. Core ML latency is reported only for existing verified packages; PyTorch MPS rows are quality screens and do not project Core ML latency.

Candidate Runtime Mean score Mean moves Best tile Median call
Expectimax control no model 21,339 1,170.7 2048 —
GLiClass Edge Apps v2 LUT8 Core ML 14,701 841.7 2048 1.78 ms
Kev 0.8B PyTorch MPS 7,487 494.7 1024 144.79 ms
Laya E8 Core ML 3,239 253.3 512 3.84 ms × 2
GLiNER 2.5 small PyTorch MPS 1,952 175.0 256 20.13 ms
GLiClass Base v3 PyTorch MPS 1,695 163.3 256 41.23 ms
Kev 0.5B FP16 Core ML 1,333 139.0 128 7.49 ms

GLiClass Edge is the conversion winner for this game. Kev 0.8B is the only plausible future challenger, but its current Apple path is about 81 times slower and its mean score is roughly half GLiClass. GLiClass Base and GLiNER small failed the quality gate, so adding incompatible DeBERTa exporters would not improve the shipped result. The expectimax control still wins, which points to 2048-specific training of the existing Edge model as the next quality experiment.

Validation

  • swift format lint --recursive --configuration .swift-format Sources Tests Package.swift
  • swift build -c release
  • Deterministic heuristic smoke: seed 1 reaches 35,364 points, 1,797 moves, and tile 2048.
  • Recomputed every candidate summary from the committed per-game rows.
  • GitHub build-and-test: unit tests, release build, and CLI regression checks pass.

This PR is stacked on #5 so the v0.2.1 runtime fixes can merge independently.

…eces

The original demo topped out at 76 pieces. Two changes fix it and neither works alone:
the harness withholds landings that bury a cell when a clean one exists, and the landing
description stays discriminative on a tall board, where the old clause read identically
for every option once the stack passed 15 rows. Measured over ten seeds: wording alone
47.5 pieces, filter alone 87.3, baseline 75.8, both 568.3, against 582.8 for a
Dellacherie heuristic. Control: random choice among the filtered moves gets 17.2 pieces
and no lines, so the filter is not playing the game.

Also fixes three demo bugs. The seed field was ignored unless Reset was pressed first,
because the board came from the property initialiser. A 120 ms sleep after each placed
piece was three quarters of the wall clock and let the Neural Engine power down between
pieces, so calls measured 5.9 ms instead of 3.8; a piece now takes 29 ms instead of 159.
And a finished game froze the scoreboard with nothing saying so.

Adds a clock and scoreboard to the window, the wall clock to the terminal console so a
recording can be shown to be real time, marathon mode, one-piece lookahead with three
combine modes (off by default: worse on average, 444.5 against 581.5), and an agreement
metric reporting where laya's pick sits in a Dellacherie ranking.
@Alex-Wengg
Alex-Wengg changed the base branch from feat/tetris-harness to main September 22, 2026 19:37
@Alex-Wengg
Alex-Wengg merged commit 2c2913f into main Sep 22, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant