lua-llama-playground

Pure Lua LLaMA-style inference and speculative decoding

Run, inspect, and understand language model inference.

Lua 5.4 | v1.0.0 | CPU

Load experiment:

Configuration

Lua 5.4

TinyStories completion · max 1,200 characters

Checkpoints by karpathy/tinyllamas ↗

0.0
Greedy / deterministicMore random
Let the draft propose ahead
4 tokens

Shared context: 256 tokens, including the prompt.

Run options tokens & seed

One experiment at a time on the shared CPU.
A 60-token run can take a few minutes.

Generation

Ready

> Runtime: pure Lua 5.4 / CPU

> Configure a run and select Run generation.

Generated text will stream here. Metrics are measured per run.

tokens/sec—wall clock
draft acceptance—accepted / proposed
target rounds—verification blocks
tokens/target-round—tokens emitted
baseline target rounds—one token at a time

Target round comparison

Awaiting run
This run
—
Baseline
—

Rounds are logical verification blocks. Lua executes positions sequentially; speculation adds work and may lower tokens/sec.

What are these numbers?

tokens/sec counts generated tokens over wall-clock inference time, including prompt prefill and both models’ work, excluding model loading. Draft acceptance counts accepted proposals divided by all proposals; it is N/A when speculation is off.

Target rounds counts logical verification blocks, not individual forward passes. Tokens/target-round is emitted tokens divided by rounds. Baseline target rounds is the analytical one-token-at-a-time count for this output length, including a stop-token decision if one occurs. It is not a separately timed run.

Reproduce the reference experiment

Choose 15M → 42M: “Once upon a time”, temperature 0, lookahead 4, 60 new tokens. The repository’s recorded run accepted 46 / 56 proposals (82.1%) in 14 target rounds, yielding 4.29 tokens/round against a baseline of 60.

Those are historical results, not prefilled live measurements. CPU throughput varies by host. Greedy output matches the target alone; sampled runs preserve its distribution but need not produce the same text, even with the same seed. Read the transcript ↗

Runtime, weights & attribution

lua-llama by jeorgexyz is the MIT-licensed inference runtime and experiment. The pretrained TinyStories 15M and 42M checkpoints come from Andrej Karpathy’s tinyllamas repository, whose model card declares MIT. They were not trained by jeorgexyz.

The tokenizer comes from llama2.c. Assets are downloaded from pinned upstream revisions and checked with SHA-256. View asset provenance ↗