explaingit

joeysalmons/slm-in-a-box

Analysis updated 2026-05-18

1PythonAudience · developerComplexity · 2/5Setup · easy

TLDR

A small 50 million parameter language model packed into a single self-contained HTML file that runs offline in any browser, no install or server needed.

Mindmap

mindmap
  root((slm-in-a-box))
    What it does
      Offline chat model
      Single HTML file
      No server needed
    Tech stack
      Python
      HTML
      ONNX
      WebAssembly
    Use cases
      Offline chatbot
      USB portable AI
      Model packaging demo
    Audience
      Developers
      AI hobbyists
    Controls
      Temperature
      Top p and top k
      Repetition penalty

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Chat with a small offline AI model without installing any software.

USE CASE 2

Carry a self-contained AI chatbot on a USB stick to use on any computer.

USE CASE 3

Learn how to package an ONNX language model into a single portable HTML file.

USE CASE 4

Experiment with generation settings like temperature and top-p on a tiny local model.

What is it built with?

PythonHTMLONNXWebAssembly

How does it compare?

joeysalmons/slm-in-a-box0xustaz/streamgatea-bissell/unleash-lite
Stars111
LanguagePythonPythonPython
Setup difficultyeasyhardhard
Complexity2/54/54/5
Audiencedeveloperdeveloperresearcher

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 5min

The prebuilt download is a large file (~120 MB), building your own version requires separate ONNX model files from Hugging Face.

The README does not state a license, so it is unclear what uses are permitted.

In plain English

slm-in-a-box is an experiment that packs a small AI language model into a single HTML file, so anyone can chat with it just by opening that file in a web browser like Chrome. There is no installation, no server to run, and no internet connection needed once the file is downloaded. The model at the center of this project has 50 million parameters, which is tiny compared to the large models behind tools like ChatGPT, but it is small enough to fit inside a self-contained web page along with everything needed to run it. Because the whole thing lives in one file, it works completely offline after the initial download, and it can even be carried around and run from a USB stick on a different computer. The HTML file includes a basic chat interface with several adjustable settings: temperature, top-p, top-k, maximum tokens, and repetition penalty, which are all common controls for tuning how creative or repetitive the model's replies are. It also has a system prompt field, an editable conversation history, and buttons to stop, regenerate, or copy responses. On a modern laptop running Chrome, the author reports speeds of around 50 tokens per second. There is an experimental option to use WebGPU instead of the default CPU-based backend, which runs through WebAssembly, but the README warns this will likely freeze the browser tab, so it recommends sticking with the CPU option. For people who want to build the file themselves rather than download the prebuilt one, the repository includes a Python script, build_supra_chat-v2.py. Running it requires first downloading a specific set of model files, an ONNX version of the Supra 1.5 50M Instruct model along with its tokenizer and config files, from Hugging Face, and placing them in the same folder as the script.

Copy-paste prompts

Prompt 1
Explain how slm-in-a-box packs a 50 million parameter language model into a single HTML file.
Prompt 2
Help me download the Supra 1.5 50M Instruct ONNX model files and run build_supra_chat-v2.py to build my own version.
Prompt 3
Show me how WebAssembly is used to run a language model inside a browser without a server.
Prompt 4
Walk me through adjusting temperature, top-p, and repetition penalty in this chat interface.

Frequently asked questions

What is slm-in-a-box?

A small 50 million parameter language model packed into a single self-contained HTML file that runs offline in any browser, no install or server needed.

What language is slm-in-a-box written in?

Mainly Python. The stack also includes Python, HTML, ONNX.

What license does slm-in-a-box use?

The README does not state a license, so it is unclear what uses are permitted.

How hard is slm-in-a-box to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is slm-in-a-box for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.