Mooziq LM: Tiny models for browser-based lo-fi music generation
2 min read
Mooziq LM is a family of ultra-small transformers that generate lo-fi music as symbols (chords, melodies, basslines, and song structure) fast enough to run in real time directly within web browsers using pure JavaScript. Developed by Varun Lohade, these models power the Unlimited Lofi Music project to stream endless, device-generated playlists. The architecture uses decoder-only transformers with KV caching, running without heavy libraries like ONNX. This development will appeal to web developers, generative music hobbyists, and researchers studying compact language models.
Key features
- A family of miniature models ranging from 114K to several million parameters, available in fp16, int8, and int4 weights.
- Runs in browsers or Node.js via a lightweight JavaScript engine implementation (transformer.js).
- Supports multiple musical styles, including Jazz Hop, Steady, Flow, and Folk.
- Trained on public music datasets and generations from open models without proprietary systems.
What you can do
- Integrate generative background music into web applications, websites, or browser games.
- Run local lo-fi track generation on consumer devices without server requests.
- Use the architecture for research in symbolic music generation and constrained decoding.
Example
import {loadModel} from './transformer.js';
const meta = await (await fetch('B483K/model.json')).json();
const bytes = await (await fetch('B483K/model.bin')).arrayBuffer();
const model = loadModel(meta, bytes);
model.reset();
let logits;
for (const t of [meta.BOS, meta.JAZZHOP, meta.MIN, meta.BAR]) logits = model.step(t);
Read more
DetailsLoss benchmarks: B483K (held-out loss ACE — 1.326, public domain — 1.133), S8-int8 (1.304 / 1.038), S4-int4 (1.301 / 1.025).
Hardware requirements: minimal VRAM and memory usage, runs in-browser.
Limitations: vocabulary is restricted to diatonic seventh chords, an eighth-note grid, and 4/4 time; new styles have limited training data.
License: MIT.










Comments