explaingit

thestageai/edge-lm

Analysis updated 2026-05-18

86PythonAudience · developerComplexity · 3/5LicenseSetup · moderate

TLDR

Compressed Gemma 4 language models that run locally on Apple Silicon Macs and iPhones via MLX, shrinking checkpoints up to 7 times while preserving key capabilities.

Mindmap

mindmap
  root((edge-lm))
    What it does
      Compresses Gemma 4 models
      Runs on Apple Silicon
      Up to 7x smaller
    Tech stack
      MLX framework
      Python package
      Hugging Face weights
    Use cases
      On-device AI assistants
      Mobile app tool use
      Benchmark reproduction
    Audience
      Mobile developers
      On-device AI builders

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

Run a compact Gemma 4 language model locally on a Mac or iPhone without a cloud API.

USE CASE 2

Build an on-device assistant that needs instruction following and tool calling within a tight memory budget.

USE CASE 3

Compare compressed model quality and speed against reference Gemma checkpoints using the included benchmark scripts.

USE CASE 4

Add image description or audio transcription to an app using the provided example scripts.

What is it built with?

PythonMLXGemmaHugging Face

How does it compare?

thestageai/edge-lmamazon-science/cyber-zeroitalozucareli/zabbix-observability
Stars868785
LanguagePythonPythonPython
Setup difficultymoderatehardmoderate
Complexity3/54/53/5
Audiencedeveloperresearcherops devops

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

How do you get it running?

Difficulty · moderate Time to first run · 30min

Requires an Apple Silicon Mac or iPhone via MLX, model weights download automatically from Hugging Face on first run.

The code is MIT licensed, free to use for any purpose including commercial use, but the model weights themselves are derivatives of Gemma 4 and are also subject to Google's separate Gemma Terms of Use.

In plain English

edge-lm provides heavily compressed versions of Google's Gemma 4 language models designed to run locally on Apple Silicon Macs and iPhones rather than on remote servers. Language models are large by default: the original Gemma 4 E2B model weighs around 9 gigabytes. The compressed checkpoints in this repository bring that down to 1.44 gigabytes, which fits within the memory budgets of mobile devices and downloads in a reasonable amount of time. The project ships two model sizes: E2B (around 2 billion parameters before compression) and E4B (around 4 billion). Each comes in two operating points called M and L, where M is the smaller and faster version and L trades some size back for higher quality. The models are designed to preserve performance on three specific tasks: following instructions, answering general knowledge questions, and making tool calls, which the README treats as the most important capabilities for an on-device assistant. The underlying framework is MLX, Apple's machine learning library built for Apple Silicon chips. The compression technique uses a combination of per-group quantization for the main decoder weights and a more specialized codec for a component called PLE tables, which the project claims are the bottleneck that standard quantization tools handle poorly. The result at the 6.4x compression level is reported to outperform other compressed Gemma checkpoints from tools like Unsloth on instruction following and tool use benchmarks, while being smaller. Installation involves cloning the repository, creating a Python virtual environment, and running pip install. Model weights download automatically from Hugging Face on first use. The package provides a simple Python API for text generation plus example scripts for chat, image description, and audio transcription. Benchmark scripts for both quality and speed are included so you can reproduce the reported numbers on your own machine. The code is MIT licensed. The compressed model weights are derivatives of Gemma 4 and are also subject to Google's Gemma Terms of Use.

Copy-paste prompts

Prompt 1
Walk me through installing edge-lm and running the text generation example on my Mac.
Prompt 2
Explain the difference between the M and L operating points for the Gemma 4 E2B model.
Prompt 3
Show me how to use edge-lm from Python to generate a streamed response to a prompt.
Prompt 4
Explain how edge-lm's compression technique differs from standard quantization tools like Unsloth.
Prompt 5
Help me reproduce the quality benchmarks reported in the edge-lm README.

Frequently asked questions

What is edge-lm?

Compressed Gemma 4 language models that run locally on Apple Silicon Macs and iPhones via MLX, shrinking checkpoints up to 7 times while preserving key capabilities.

What language is edge-lm written in?

Mainly Python. The stack also includes Python, MLX, Gemma.

What license does edge-lm use?

The code is MIT licensed, free to use for any purpose including commercial use, but the model weights themselves are derivatives of Gemma 4 and are also subject to Google's separate Gemma Terms of Use.

How hard is edge-lm to set up?

Setup difficulty is rated moderate, with roughly 30min to a first successful run.

Who is edge-lm for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.