Skip to main content

Python package codecov-python codecov-js Pixi Badge Transformers.js

xeus-badge pyodide-badge

lmLite

Package version: 0.5.6

Browser-native LLM orchestration in JupyterLite - run language models entirely in your browser using WebAssembly or WebGPU.

Quick Start

Try online (no installation required):

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)

Features

  • 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

What is lmLite?

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.

Documentation

Notebooks

Open demo.ipynb in the online demo to see lmLite in action. See notebooks/README.md for a complete notebook guide.

How It Works

┌─────────────────────────────────────┐
│   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)              │
└─────────────────────────────────────┘

License

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.

Citation

@software{lmlite2026,
  author = {Decitre, Emmanuel},
  title = {lmLite: Browser-native LLM orchestration in JupyterLite},
  year = {2026},
  url = {https://github.com/decitre/lmlite}
}

Acknowledgments


Metadata

Release files for lmlite 0.5.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lmlite 0.5.6
File Size Uploaded
lmlite-0.5.6.tar.gz 51.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for lmlite 0.5.6
File Interpreter ABI Platform
lmlite-0.5.6-py3-none-any.whl Python 3 none any Details

Total release size: 85.0 kB

Release files / lmlite-0.5.6.tar.gz

Download URL lmlite-0.5.6.tar.gz
Size 51.4 kB
Tags Source
SHA-256 checksum
How to use checksums
3ae9b778c6ffc594bd1c04412e31f878d17f618a7e630f31e96a4d15c45b2123
BLAKE2b-256 checksum
How to use checksums
17f30a693b5384340678e68828ce08b7d4204b9a85e6b007ebcb09a1b4fe296b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 11, 2026.

Transparency log

Release files / lmlite-0.5.6-py3-none-any.whl

Download URL lmlite-0.5.6-py3-none-any.whl
Size 33.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
da44000e50ca766c3e5a58243e07fad52bc300c5f0816240051a717c0afa3ac2
BLAKE2b-256 checksum
How to use checksums
d03decfbedbf322bb3506294ecb824afceb8c568dc10dbf0eba6a4b1dc0af30b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 11, 2026.

Transparency log

Release history Release notifications | RSS feed

0.5.7

2 release files

This release

0.5.6 This release

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page