EXPERIMENT 001 / MACHINE LEARNING

LAYA × Dino.

Can a local model learn when to run, jump, or duck? An experiment with LAYA, 7,200 physics-generated examples, and the original T-Rex game.

The experiment, running.

RECORDED LOCALLY / MAXIMUM PACE
45 seconds · actual game pixels and metrics · Apple GPU · no playback speed-upThis is a recording. No model runs on this page.
7,200generated examples
95.4%held-out accuracy
24/24duckable birds cleared
Evaluation ↓

Every gameplay choice comes from LAYA. The world waits during inference, then advances six original 60 Hz physics frames. Maximum pace runs as fast as decisions arrive.

01 / METHOD

A small training notebook.

Supervised learning. Frozen encoder. Local inference.

01

Let physics label the data.

The original game simulates different jump times, obstacle sizes, speeds and bird heights. If crouching clears the bird, the teacher labels DUCK. Low birds and cacti receive physics-tested RUN or JUMP labels.

1,200 overlapping-bird examples teach the model to hold the crouch until the bird has passed. Total: 7,200 states.

02

Train the decision layers.

LAYA's ModernBERT encoder stays frozen. Decision layers, type embeddings and choice scorer learn from 5,760 examples; 1,440 remain held out. Four training stages refine the same separate checkpoint.

The model sees measured geometry, bird altitude, speed and the dinosaur's posture. It sees only the nearest obstacle.

03

Let LAYA play.

TypeScript reads the game state. A local Python worker calls the official LAYA SDK's choice primitive for RUN, JUMP or DUCK. The executor applies that choice, then advances the simulation.

The training teacher is absent during play. No live distance rule corrects decisions. Failed runs restart after one second; play does not update weights.

02 / EVALUATION

Better. Still imperfect.

Bounded regression checks, not unlimited survival.

Birds and held-out examples

95.42% held-out accuracy; 98.98% DUCK recall. All 24 upper/middle bird encounters used DUCK throughout and cleared. All 12 lowest-bird cases selected JUMP; 11 cleared, one jumped too early.

Bird tests span three speeds, both horizontal motion offsets, and two starting distances. Validation informed checkpoint selection; these checks are a small development evaluation.

Five matching game seeds

Mean score: 808.0 → 915.8 versus the previous RUN/JUMP checkpoint. Each run was capped at 800 decisions. Three new-model runs reached the cap; two died. No empty-ground jumps, but three far-obstacle jumps remained.

Typical warm Apple GPU inference was approximately 40 ms. The recording includes request, rendering and capture overhead. Other machines, especially CPU-only systems, may run more slowly.

03 / REPRODUCE

Run it on your machine.

The public page is static. For live autonomous play, clone the source and run the Python backend locally. Setup downloads the pinned English model and trained decision weights; subsequent play works offline. No cloud API key required.

git clone https://github.com/JakkNaj/laya-dino.git
cd laya-dino
./scripts/setup.sh
./scripts/start.sh

Requires Node.js 20.19+ or 22.12+ and uv. Setup creates Python 3.12 in an isolated environment. Open http://127.0.0.1:8000. Apple GPU acceleration when available; CPU fallback.

Source, setup and training instructions ↗