lmLite provides a Python interface to browser-native machine learning in JupyterLite, using Transformers.js and ONNX Runtime Web. Models run locally in the browser, without an inference server or API keys.
It supports both xeus-python and Pyodide kernels, with WASM and optional WebGPU acceleration.
Capabilities
- Text generation and chat: instruction-tuned models, streaming, cancellation, and token probabilities.
- Embeddings and semantic search: similarity search, RAG, and conversational memory.
- Task pipelines: classification, translation, and speech recognition.
- Tokenization: inspect tokens and count them without loading model weights.
- Model management: cache inspection, download progress, and ZIP export/import.
- WebGPU: GPU inference alongside WASM, with a notebook comparing both.
Native ONNX Runtime backend
An optional headless backend (pip install 'lmlite[native]') uses ONNX Runtime Python outside the browser.
This allows models and workflows to be developed, tested, and tuned locally using the same ONNX files, with parity checks against browser inference.
Performance and model footprint
Initial benchmarks on an Apple M-series laptop show that native ONNX Runtime can be approximately 9–11× faster than single-threaded browser WASM for longer embedding inputs.
Quantization reduces model download size and memory requirements, but does not necessarily improve inference speed.

Generation speed across model data types. Results depend on the model, hardware, and inference backend.
Additional benchmarks, model sizes, and accuracy comparisons are documented in the repository.
Try it online
The repository provides runnable JupyterLite notebooks, including:
- Basic generation, embeddings, and classification.
- RAG and multi-turn chat with memory.
- Streaming generation and token probabilities.
- Tokenization and model-cache management.
- WebGPU inference and WASM comparison.
The hosted notebooks require no installation or API keys.
Applications and feedback
lmLite is an experimental project intended for interactive ML education, NLP experimentation, browser-local applications, and reproducible notebooks.
It builds on existing inference engines rather than implementing a new one.
I’d particularly welcome feedback from the Jupyter community on the Python API, educational use cases, and workflows combining native development with browser-based inference.