|
Download README.md from rohitdotgg/TinyRealm-45M: direct link, hf CLI and curl.
- Browser
- Download file 12.5 kB
-
https://huggingface.co/rohitdotgg/TinyRealm-45M/resolve/main/README.md
- Command line
-
hf download hf://rohitdotgg/TinyRealm-45M/README.md
-
curl -L -o README.md https://huggingface.co/rohitdotgg/TinyRealm-45M/resolve/main/README.md
12.5 kB
| license: apache-2.0 | |
| library_name: onnx | |
| pipeline_tag: image-to-video | |
| tags: | |
| - udgamlabs | |
| - world-model | |
| - interactive | |
| - action-conditioned | |
| - diffusion | |
| - rectified-flow | |
| - onnx | |
| - webgpu | |
| - onnxruntime-web | |
|  | |
| **UDGAM LABS** · World model · 45M parameters | |
| # TinyRealm-45M | |
| TinyRealm is a 45M-parameter world model: you steer, and it imagines the next frame. There is no game engine; every | |
| pixel comes from the model. One 92.4 MB ONNX file holds four worlds (Red-Rock Canyon, Neon Skyway, Aurora Fjord and | |
| Volcanic Trench) at 256 × 256, and it runs at about 20 frames a second on your own graphics chip inside Chrome, through | |
| WebGPU, with no server. | |
| **Try it:** [in your browser](https://huggingface.co/spaces/udgamlabs/TinyRealm-45M) · [code on GitHub](https://github.com/udgamlabs/tinyrealm) · [udgamlabs.com/models/tinyrealm](https://udgamlabs.com/models/tinyrealm) | |
| <p align="center"><img src="assets/real_vs_model_neon.jpg" alt="Neon Skyway: six frames of the real 3D scene (top) and the same six frames as TinyRealm imagined them (bottom), frames 1 to 128" width="100%"></p> | |
| <sub>Neon Skyway. Top: the real 3D scene we built for training. Bottom: TinyRealm, from the same start and the same 128 | |
| key presses. Frames 1, 16, 32, 64, 96 and 128 of a held-out flight.</sub> | |
| ## Quick start | |
| ### In the browser (JavaScript, Chrome or Edge with WebGPU) | |
| ```js | |
| import * as ort from 'https://cdn.jsdelivr.net/npm/onnxruntime-web@1.30.0/dist/ort.webgpu.min.mjs' | |
| const hf = 'https://huggingface.co/udgamlabs/TinyRealm-45M/resolve/main/' | |
| const model = await ort.InferenceSession.create(hf + 'pocketworld_s1_4worlds_256_fp16.onnx', { executionProviders: ['webgpu'] }) | |
| // A world's starting memory: keys, then values (float16, each [12, 1, 8, 1040, 64]). b1 is Neon Skyway. | |
| const kv = new Float16Array(await (await fetch(hf + 'seed_s1_b1_kv.f16')).arrayBuffer()) | |
| const dims = [12, 1, 8, 1040, 64], half = kv.length / 2 | |
| let k = new ort.Tensor('float16', kv.slice(0, half), dims) | |
| let v = new ort.Tensor('float16', kv.slice(half), dims) | |
| // One frame. The action is [steer, pitch, throttle, boost, strafe]: here, ahead and a little to the right. | |
| const randn = () => Math.sqrt(-2 * Math.log(1 - Math.random())) * Math.cos(2 * Math.PI * Math.random()) | |
| const out = await model.run({ | |
| noise: new ort.Tensor('float16', Float16Array.from({ length: 32 * 16 * 16 }, randn), [1, 32, 16, 16]), | |
| action: new ort.Tensor('float16', Float16Array.of(0.4, 0, 0.85, 0, 0), [1, 5]), | |
| k_cache: k, v_cache: v, | |
| }) | |
| const rgb = await out.rgb.getData() // 3 × 256 × 256 values, 0–255: draw it, then | |
| k = out.next_k; v = out.next_v // feed the memory back for the next frame | |
| ``` | |
| Loop it: draw each frame, feed the memory back, and read the keys for the next action. A complete player (four worlds, | |
| keyboard and touch controls) is in the [GitHub repository](https://github.com/udgamlabs/tinyrealm). | |
| ### In Python (ONNX Runtime) | |
| ```bash | |
| pip install onnxruntime numpy pillow huggingface_hub | |
| ``` | |
| ```python | |
| import numpy as np, onnxruntime as ort | |
| from huggingface_hub import hf_hub_download | |
| from PIL import Image | |
| repo = "udgamlabs/TinyRealm-45M" | |
| sess = ort.InferenceSession(hf_hub_download(repo, "pocketworld_s1_4worlds_256_fp16.onnx")) | |
| kv = np.fromfile(hf_hub_download(repo, "seed_s1_b0_kv.f16"), dtype=np.float16) # b0 = Red-Rock Canyon | |
| k, v = (x.reshape(12, 1, 8, 1040, 64) for x in np.split(kv, 2)) # keys, then values | |
| rng = np.random.default_rng(0) | |
| for i in range(32): | |
| action = np.array([[0.3, 0.0, 0.85, 0.0, 0.0]], dtype=np.float16) # steer right, level, cruise | |
| rgb, k, v = sess.run(None, {"noise": rng.standard_normal((1, 32, 16, 16)).astype(np.float16), | |
| "action": action, "k_cache": k, "v_cache": v}) | |
| Image.fromarray(rgb[0].astype(np.float32).clip(0, 255).astype(np.uint8).transpose(1, 2, 0)).save(f"frame_{i:03d}.png") | |
| ``` | |
| `examples/run_frames.py` in the GitHub repository does the same with options for the world, the number of frames and | |
| the steering pattern. | |
| ### Inputs and outputs | |
| | Name | Type | Shape | What it is | | |
| |---|---|---|---| | |
| | `noise` (in) | float16 | [1, 32, 16, 16] | Standard normal noise, new every frame | | |
| | `action` (in) | float16 | [1, 5] | [steer, pitch, throttle, boost, strafe]. Steer, pitch and strafe in −1…1; boost 0 or 1; throttle 0.65–1 in training (the player holds 0.85) | | |
| | `k_cache`, `v_cache` (in) | float16 | [12, 1, 8, 1040, 64] each | The memory: attention keys and values of the last 16 frames (12 layers, 8 heads, 16 × 65 tokens, 64 dims) | | |
| | `rgb` (out) | float16 | [1, 3, 256, 256] | The new frame, 0–255, channels first | | |
| | `next_k`, `next_v` (out) | float16 | [12, 1, 8, 1040, 64] each | The updated memory: pass it back in for the next frame | | |
| ### Files | |
| | File | Size | What it is | | |
| |---|---|---| | |
| | `pocketworld_s1_4worlds_256_fp16.onnx` | 92.4 MB | The model: world model, 3 denoising steps, memory update and decoder in one graph (opset 17, float16) | | |
| | `seed_s1_b0_kv.f16` … `seed_s1_b3_kv.f16` | 25.6 MB each | Starting memory for each world (raw float16, keys then values): 0 Red-Rock Canyon, 1 Neon Skyway, 2 Aurora Fjord, 3 Volcanic Trench | | |
| | `seed_s1_b*_preview.png` | small | The frame each world starts from | | |
| | `config.json` | small | Sizes, input and output names and shapes, and the list of worlds | | |
| | `SHA256SUMS` | small | Checksums for the model and seed files | | |
| The internal name `pocketworld` in the file names is the project's working name; the files are the released model. | |
| ## Results | |
| **Does it obey your keys?** A separate checker model (an inverse dynamics model, trained on the real 3D scenes) looks at | |
| each pair of consecutive frames and guesses which keys were pressed. We run it on TinyRealm's frames and on the real | |
| scenes for the same flights. If TinyRealm ignored the keys, the checker would score near the shuffled-keys control. | |
| Held-out flights in all four worlds (10 per world), 128 frames each, released model, 1 Dec 2026 [MEASURED]: | |
| | World | TinyRealm, frames 1–128 | The real 3D scene (ceiling) | Shuffled keys (control) | | |
| |---|---:|---:|---:| | |
| | Red-Rock Canyon | 90.9% | 94.2% | 45.0% | | |
| | Neon Skyway | 91.2% | 93.9% | 44.1% | | |
| | Aurora Fjord | 91.7% | 94.7% | 44.3% | | |
| | Volcanic Trench | 91.2% | 94.3% | 45.0% | | |
| | **All four** | **91.3%** | **94.3%** | **44.6%** | | |
| - TinyRealm reaches 96.8% of the checker's score on the real scenes. | |
| - Control holds into the second half of a flight: 92.5% in frames 1–64 and 90.1% in frames 65–128 (all four worlds). | |
| - Speed: about 20 frames a second in Chrome (WebGPU) on a Mac mini with Apple M6; 21.6–23.4 frames a second in our | |
| first measurement of the same demo. Not yet measured on other machines. | |
| - Size: 44.93M parameters in the world model plus 0.68M in the decoder; the float16 ONNX file is 92.4 MB. Float16 and | |
| float32 frames differ by 0.06–0.17 on the 0–255 scale. | |
| **How it compares.** Steerable world models as published by their makers (read 1 Dec 2026; not reproduced by us, and | |
| not like for like: different worlds, steps and hardware): | |
| | Model | Made by | Size | Picture | Runs on | Open weights | | |
| |---|---|---|---|---|---| | |
| | **TinyRealm-45M** | **Udgam Labs** | **45M** | **256 × 256, ~20 fps (M6)** | **Your browser (WebGPU)** | **Yes, Apache-2.0** | | |
| | [Genie 3](https://deepmind.google/discover/blog/genie-3-a-new-frontier-for-world-models/) | Google DeepMind | not published | 720p, 24 fps | Google's servers | No | | |
| | [Oasis 500M](https://huggingface.co/Etched/oasis-500m) | Decart and Etched | 500M | 360p, 20 fps (H100) | Data-centre GPU | Yes, MIT | | |
| | [GameNGen](https://arxiv.org/html/2408.14837v2) | Google | not published | 320 × 240, 20 fps (TPU) | Data-centre chip | No | | |
| | [DIAMOND (CS:GO)](https://diamond-wm.github.io/) | Alonso et al. | 381M | low-res + upsampler, ~10 fps | Gaming GPU (RTX 3090) | Yes, MIT | | |
| | [Matrix-Game 2.0](https://arxiv.org/html/2508.13009v2) | Skywork | 1.8B | 352 × 640, 25 fps (H100) | Data-centre GPU | Yes, MIT | | |
| | [micro-doom-world](https://huggingface.co/kulikov0/micro-doom-world) | kulikov0 | 39M + 7M | 128 × 96 | Your browser (WebGPU) | Yes, MIT | | |
| | [Neural Drive β](https://huggingface.co/codelion/neural-drive-model) | codelion | 131M + decoder | 384 × 192 | Your browser (WebGPU) | Weights, custom licence | | |
| | [Dream Engine](https://github.com/teshnizi2/dream-engine) | teshnizi2 | 6.8M | 64 × 64, ~28 fps (M4) | Your browser (WebGPU) | Yes, MIT | | |
| The big models make far richer worlds on data-centre hardware. TinyRealm is one of a few small models that run on your | |
| own graphics chip inside the browser. | |
| <p align="center"><img src="assets/real_vs_model_fjord.jpg" alt="Aurora Fjord: six frames of the real 3D scene (top) and the same frames as TinyRealm imagined them (bottom)" width="100%"></p> | |
| <sub>Aurora Fjord, real scene (top) and TinyRealm (bottom), same start and keys, frames 1–128. It keeps the look of the | |
| world, but its path drifts from the real one over time.</sub> | |
| ## Where it falls short | |
| - **It only knows four worlds.** It can't make a new world from a sentence or a picture; it imagines the four it was | |
| trained on. | |
| - **Soft details.** Pictures are 256 × 256 and come out painterly; thin lines and window grids blur, more so in Neon | |
| Skyway. Its decoder alone loses the most there: 22.6 dB PSNR on Neon Skyway against 30.5–34.0 dB on the other three | |
| worlds. | |
| - **It drifts on long flights.** After a few seconds the path wanders from the real one, and colours can wash out; | |
| press R to start again. | |
| - **Climbing and diving are followed less well than turning.** Over 128 frames the checker reads steering correctly | |
| 95–99% of the time, but pitch only 80–83% (TinyRealm) against 84–87% on the real scenes. | |
| - **No game rules.** There is no score, no collisions and no goal: walls and rings are only what the model imagines. | |
| - **Desktop browsers only.** It needs WebGPU in Chrome or Edge and about 118 MB of downloads to start (the model plus | |
| one world); phones get the recording. | |
| ## How it was trained | |
| - **Data.** Four 3D worlds that we wrote ourselves as a PyTorch raymarcher (no textures, meshes or downloaded assets), | |
| flown by a scripted pilot that keeps to the corridor and otherwise picks random steering, pitch, throttle, boost and strafe. 1,600 flights of 400 frames at 256 × 256 | |
| (640,000 frames, 160,000 per world); 48 flights held out for evaluation. No outside video or game footage. | |
| - **Compression.** A small autoencoder squeezes each frame to a 16 × 16 × 32 grid (16× smaller on each side). Its | |
| 0.68M-parameter decoder is the part that ships. Held-out reconstruction: 29.85 dB PSNR, 0.0315 LPIPS. Its training | |
| loss included LPIPS, which uses a pretrained AlexNet as a measuring tool; no AlexNet weights are in TinyRealm. | |
| - **World model.** A causal transformer (12 layers, width 512, 8 heads) that predicts the next frame's latent by | |
| rectified flow, from the last 16 frames and the current keys (each frame is 64 patch tokens plus one action token). | |
| It started from random weights and was trained for 20,000 steps of batch 64 on one NVIDIA RTX PRO 6000 GPU, with | |
| noise added to the past frames so it learns to recover from its own mistakes. The whole run, from rendering to | |
| evaluation, took about 4 hours. | |
| - **At run time.** Three denoising steps a frame, then one more pass that writes the new frame into the memory; the | |
| memory keeps the last 16 frames. | |
| ## Intended use and limitations | |
| A research and demo model: a small, open example of an action-conditioned world model that runs on a consumer device, | |
| for learning, teaching, browser experiments and building your own. It is not a game engine and not a simulator: it | |
| has no physics, collisions or score, and it only knows the four worlds above. | |
| ## Licence | |
| Apache-2.0 for the weights and code. The training frames came only from worlds we wrote ourselves. | |
| ## Citation | |
| ```bibtex | |
| @misc{udgamlabs2026tinyrealm, | |
| title = {TinyRealm-45M: a world model that runs in your browser}, | |
| author = {{Udgam Labs}}, | |
| year = {2026}, | |
| url = {https://huggingface.co/udgamlabs/TinyRealm-45M} | |
| } | |
| ``` | |
| TinyRealm by Udgam Labs. | |
| --- | |
| **About Udgam Labs.** Udgam Labs is an independent AI research lab. We work from first principles: before we build, we understand why things work, whether we are training a model, fine-tuning one or applying AI to a new problem. Udgam (उद्गम) is Sanskrit for origin. [udgamlabs.com](https://udgamlabs.com) | |