Skip to main content
Back

mlx-community Shrinks Llama-3.1-8B to 4.5 GB for Mac Users

The mlx-community group published a 4-bit MLX conversion of Meta's Llama-3.1-8B-Instruct, letting Apple Silicon Macs run it locally in about 4.5 GB.

Pro

  • mlx-community published a 4-bit MLX conversion of Meta's Llama-3.1-8B-Instruct on Hugging Face.
  • Converted with mlx-lm 0.21.4, weights weigh in at roughly 4.52 GB on disk.
  • Runs natively on Apple Silicon via mlx_lm.load or the OpenAI-compatible mlx_lm.server.
  • Community benchmarks report ~18 tokens/sec for Llama 3 8B 4-bit on an 8GB M2 mini.
  • Preserves the Llama 3.1 chat template, 8-language coverage, and original Llama 3.1 license.
  • Known tradeoffs: 4-bit variant can loop on long generations; tool-calling support in MLX is limited.

A 4-bit MLX build of Llama-3.1-8B-Instruct is now available on Hugging Face, packaged by the mlx-community group for Apple's MLX framework. It converts Meta's instruction-tuned 8B model into the tensor format MLX loads natively on Apple Silicon, letting you run the chat model locally on an M-series Mac without touching PyTorch or GGUF tooling.

This is a community repackaging, not a new model from Meta. Weights, tokenizer, and chat template come from the original Llama 3.1 release; only the storage format and precision changed. The conversion used mlx-lm version 0.21.4.

What you actually get

  • Weights quantized to 4-bit, roughly 4.52 GB on disk instead of the ~16 GB fp16 original.
  • Native MLX safetensors shards that load directly via mlx_lm.load.
  • The original Llama 3.1 chat template, so tokenizer.apply_chat_template works out of the box.
  • The same 8-language coverage as upstream: English, German, French, Italian, Portuguese, Hindi, Spanish, and Thai.
  • Meta's Llama 3.1 license, unchanged.

Running it locally

After pip install mlx-lm, a minimal chat call looks like this:

from mlx_lm import load, generate
model, tokenizer = load("mlx-community/Llama-3.1-8B-Instruct-4bit")
messages = [{"role": "user", "content": "Write a story about Einstein"}]
prompt = tokenizer.apply_chat_template(messages, add_generation_prompt=True)
text = generate(model, tokenizer, prompt=prompt, verbose=True)

For an API surface, mlx-lm ships an OpenAI-compatible server you can point existing clients at:

uv tool install mlx-lm
mlx_lm.server --model "mlx-community/Llama-3.1-8B-Instruct-4bit"

curl against /v1/chat/completions works like any OpenAI-style endpoint, and local agent tools like LM Studio, Pi, and Hermes Agent can consume it as a provider.

Why MLX plus 4-bit quantization

MLX is Apple's array framework tuned for unified memory on M-series chips. Without quantization, the fp16 weights alone exceed the RAM on a base-spec Mac. At 4-bit, the model fits comfortably, and community benchmarks on earlier Llama 3 8B 4-bit MLX builds show it runs at roughly 18.5 tokens per second on an 8 GB M2 Mini. The target audience is anyone who wants a capable open chat model on a laptop with no GPU rental required.

Known rough edges

One documented issue from a previous Llama 3.1 8B MLX 4-bit conversion: on long-context runs, the model would generate up to max-tokens and then repeat the final two paragraphs in a loop. Switching to 8-bit resolved it cleanly. If you see degenerate repetition, reach for the 8-bit variant.

Tool calling is a separate gap. MLX lacks first-class function-calling support compared to Ollama, and community projects like mlx-omni-server exist specifically to fill the OpenAI-SDK-compatible tool-calling hole.

When to reach for it

  • You are on Apple Silicon and want Llama 3.1 8B running locally with minimal setup.
  • You need an offline chat or drafting assistant that fits in ~5 GB of RAM.
  • You are prototyping an agent behind an OpenAI-compatible endpoint without paying per token.
  • You want a Llama 3.1 baseline to compare against fine-tunes or other quantizations in the same MLX runtime.

On non-Mac hardware, a GGUF or AWQ build will serve you better. For Mac-local development, this is one of the most downloaded MLX chat models on the Hub and a sensible default for Llama 3.1 experimentation.