Package version: 0.5.7
Browser-native LLM orchestration in JupyterLite - run language models entirely in your browser using WebAssembly or WebGPU.
Try online (no installation required):
- Launch with Xeus-Python (recommended)
- Launch with Pyodide
Basic usage:
from lmlite import LLM
# Create LLM instance (downloads model on first run)
llm = await LLM.create(
generator_model="gpt2",
embedding_model="all-MiniLM-L6-v2"
)
# Generate text
text = await llm.generate("Python is a great language because")
# Generate embeddings
embedding = await llm.embed("Hello world")
# Similarity search
docs = ["JupyterLite runs in the browser.", "Python is widely used for ML."]
results = await llm.similarity_search("Where does JupyterLite run?", docs)- Browser-native: Run LLMs entirely in the browser, no server required
- Privacy-first: All computation happens locally in your browser
- Zero setup: No installation or API keys for hosted demos
- Multiple backends: WebAssembly (WASM) or WebGPU
- Multiple models: GPT-2, DistilGPT-2, TinyLlama, and more via Transformers.js
- Embeddings & classification: Sentence vectors and text classification
- Model caching: Browser-cached downloads and portable ZIP export/import
- Pythonic API: Clean, async Python interface
lmLite is a lightweight Python-to-JavaScript bridge for local LLM inference in the browser, designed for JupyterLite notebooks. It provides:
- Async Python API for text generation, embeddings, classification, and similarity search
- Model loading, caching, and portable ZIP workflows
- Independent backend/dtype controls for embeddings and generation
Inference is powered by Transformers.js and ONNX Runtime. lmLite is not a new model engine or native Python inference backend. Its similarity search is an in-memory cosine ranking helper, not a vector database.
Best suited for: Teaching, interactive experiments, and browser-local prototypes where avoiding remote inference services matters.
Note: Installing the Python package on desktop does not enable desktop inference.
LLM.create()requires a browser Python runtime (xeus-python or Pyodide) with JavaScript bridge. See docs/RUNTIME.md for details.
- Getting Started - Installation, development setup, and testing
- Usage Guide - Detailed API examples and configuration
- Model Guide - Recommended models and dtype selection
- Runtime & Integration - Platform support and integration boundaries
- Glossary - Key concepts and terminology
Open demo.ipynb in the online demo to see lmLite in action. See the notebooks directory for all examples.
┌─────────────────────────────────────┐
│ Python (JupyterLite) │
│ ├─ xeus-python (recommended) │
│ └─ pyodide (alternative) │
│ │
│ from lmlite import LLM │
│ llm = await LLM.create() │
│ text = await llm.generate(...) │
└─────────────┬───────────────────────┘
│ Bridge (pyodide.ffi / pjs)
┌─────────────▼───────────────────────┐
│ JavaScript (Browser) │
│ Transformers.js + ONNX Runtime │
│ ├─ WebAssembly (WASM) │
│ └─ WebGPU (optional) │
└─────────────────────────────────────┘
Apache License 2.0. See LICENSE for details.
Dependencies: Transformers.js v4 (Apache 2.0)
Note: Individual model licenses may vary. Check model cards on HuggingFace before use.
@software{lmlite2026,
author = {Decitre, Emmanuel},
title = {lmLite: Browser-native LLM orchestration in JupyterLite},
year = {2026},
url = {https://github.com/decitre/lmlite}
}- Transformers.js by @xenova / HuggingFace
- JupyterLite team
- Pyodide project
- Hugging Face for model hosting