Skip to main content

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

xeus-badge pyodide-badge

lmLite

Package version: 0.5.7

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 the notebooks directory for all examples.

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.7

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.7
File Size Uploaded
lmlite-0.5.7.tar.gz 51.5 kB Details

Built distribution (wheel)

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

Total release size: 85.0 kB

Release files / lmlite-0.5.7.tar.gz

Download URL lmlite-0.5.7.tar.gz
Size 51.5 kB
Tags Source
SHA-256 checksum
How to use checksums
40e0ecdca46817b5531fa727a9fad7133c5404ac6764d51788cd1674b08ee2f4
BLAKE2b-256 checksum
How to use checksums
18d23d02da080ea7a11db8873cced05af7d73467c2df3add8ca8043e820c57a1
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.7-py3-none-any.whl

Download URL lmlite-0.5.7-py3-none-any.whl
Size 33.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cf7d1db8240f794b7694e2db020aeb5730a1cc1535417656cd808499ac3d47cf
BLAKE2b-256 checksum
How to use checksums
ea8db988ebe6b5ec4e153694d3ab4be2a4b27632c6f121a0c85d6a719f363c2c
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

This release

0.5.7 This release

2 release files

0.5.6

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