The Engine Refactor
Pre-release
Pre-release
This release transforms the procedural WebGPU proof-of-concept into a clean, object-oriented JavaScript library — now branded as bitnet.js.
Highlights
- ~200 ms/token on MacBook Pro M2 Max (~5 tok/s, 300 GPU dispatches per token)
- Coherent, grammatically correct English output through all 30 transformer layers
Architectural Changes
BitNetEngineclass — encapsulates all WebGPU state, tokenizer, KV cache, and generation loop into a single class with a clean public API:init(),generate(),reset()- Renamed to
bitnet.js— file, package name, and all branding updated to reflect library-grade positioning npm run setup— one-command model extraction viascripts/setup_model.pymaster orchestratornpm start— launches the local dev server
Repository Hygiene
- Moved all 9 Python extraction scripts into
scripts/ - Centralized all model assets into
weights/(embeddings, LM head, vocab map, ternary weights, norms, scales) - Deleted stale root-level binaries (
sparse_embeddings.bin,sparse_lm_head.bin,vocab_map.json) - Added
__pycache__/to.gitignore
Documentation
- README fully rewritten: updated Quick Start, project structure, benchmarks section, npm scripts
docs/TESTING.md— test suite documentation extracted into dedicated filepackage.json— license corrected to MIT, keywords updated, description refreshed