---
title: Llama-Guard-3-1B-chat-mlx-8bit
canonical_url: "https://www.modelscope.cn/models/mlx-community/Llama-Guard-3-1B-chat-mlx-8bit"
md_url: "https://www.modelscope.cn/models/mlx-community/Llama-Guard-3-1B-chat-mlx-8bit.md"
repository: mlx-community/Llama-Guard-3-1B-chat-mlx-8bit
last_updated: 2026-10-14
license: llama3.2
pipeline_tag: text-generation
tasks:
  - text-generation
model_type:
  - llama
architectures:
  - LlamaForCausalLM
base_model:
  - meta-llama/Llama-Guard-3-1B
base_model_relation: quantized
library_name:
  - mlx
  - safetensors
  - pytorch
frameworks:
  - pytorch
downloads: 48
stars: 0
tags:
  - mlx
  - safetensors
  - apple-silicon
  - 8-bit
  - conversational
  - transformers
  - llama
  - text-generation
  - facebook
  - meta
  - pytorch
  - llama-3
  - en
  - de
  - fr
  - it
  - pt
  - hi
  - es
  - th
  - "arxiv:2404.12241"
  - "arxiv:2312.06674"
  - "arxiv:2204.05862"
  - "arxiv:2308.01263"
  - "arxiv:2403.03853"
  - "license:llama3.2"
  - text-generation-inference
  - endpoints_compatible
  - "deploy:sagemaker"
---

# Llama-Guard-3-1B-chat-mlx-8bit

> Llama-Guard-3-1B-chat-mlx-8bit - mlx-community 在 ModelScope 开源的模型。Llama-Guard-3-1B-mlx-8bit

mlx-community/Llama-Guard-3-1B-chat-mlx-8bit 是 ModelScope 魔搭社区上的text-generation模型，采用 llama3.2 许可，基于 meta-llama/Llama-Guard-3-1B 构建。

- **Repository**: mlx-community/Llama-Guard-3-1B-chat-mlx-8bit
- **License**: llama3.2
- **Tasks**: text-generation
- **Base model**: meta-llama/Llama-Guard-3-1B
- **Tags**: mlx, safetensors, apple-silicon, 8-bit, conversational, transformers, llama, text-generation, facebook, meta, pytorch, llama-3, en, de, fr, it, pt, hi, es, th, arxiv:2404.12241, arxiv:2312.06674, arxiv:2204.05862, arxiv:2308.01263, arxiv:2403.03853, license:llama3.2, text-generation-inference, endpoints_compatible, deploy:sagemaker
- **Downloads**: 48
- **Stars**: 0
- **Last updated**: 2026-10-14

Source: https://www.modelscope.cn/models/mlx-community/Llama-Guard-3-1B-chat-mlx-8bit

---

# Llama-Guard-3-1B-mlx-8bit

> 8-bit MLX conversion of [meta-llama/Llama-Guard-3-1B](https://huggingface.co/meta-llama/Llama-Guard-3-1B) optimized for Apple Silicon native GPU inference.

**Converted by**: [SirSahOl](https://huggingface.co/SirSahOl)  
**Source Model**: [meta-llama/Llama-Guard-3-1B](https://huggingface.co/meta-llama/Llama-Guard-3-1B)  
**Framework**: [MLX](https://github.com/ml-explore/mlx) by Apple  
**Quantization**: 8-bit (Average 8.25 bits per weight)  
**Format**: safetensors  
**License**: llama3.2  

---

## Model Details

*   **Architecture**: LlamaForCausalLM
*   **Parameters**: 1.0B
*   **Context Length**: 131,072 tokens
*   **Format**: MLX (Apple Silicon native GPU format)
*   **Quantization**: 8-bit (Average 8.25 bits per weight)
*   **Active VRAM Footprint**: ~1.5 GB (Minimum recommended: 8 GB Unified Memory)

---

## Quick Start

### Installation

```bash
pip install mlx-lm
```

### Usage

#### CLI

```bash
# Chat interactively
mlx_lm.chat --model SirSahOl/Llama-Guard-3-1B-chat-mlx-8bit

# Generate text
mlx_lm.generate --model SirSahOl/Llama-Guard-3-1B-chat-mlx-8bit --prompt "Write a short poem about artificial intelligence."
```

#### Python API (with Chat Template)

```python
from mlx_lm import load, generate

model, tokenizer = load("SirSahOl/Llama-Guard-3-1B-chat-mlx-8bit")

messages = [
    {"role": "user", "content": "Explain quantum superposition in simple terms."}
]
prompt = tokenizer.apply_chat_template(
    messages, tokenize=False, add_generation_prompt=True
)

response = generate(model, tokenizer, prompt=prompt, verbose=True)
print(response)
```

---

## Performance Benchmarks

### Apple Silicon Hardware Sizing Matrix

Estimated decoding throughput, time-to-first-token (TTFT), and active unified memory footprint across Apple Silicon tiers:

| Apple Silicon Tier | Unified Memory | Active VRAM | Estimated Speed | Est. TTFT | Recommended Use Case |
| :--- | :--- | :--- | :--- | :--- | :--- |
| **M1 / M2 / M3 / M4 (Base)** | 8 GB Unified Memory | ~1.5 GB | **~121 tokens/sec** | ~22 ms | Everyday interactive assistant & fast local completions |
| **M1 / M2 / M3 / M4 Pro** | 18 GB – 36 GB | ~1.5 GB | **~182 tokens/sec** | ~15 ms | Balanced daily driver for coding, tool invocation, and multi-turn chat |
| **M1 / M2 / M3 / M4 Max** | 36 GB – 128 GB | ~1.5 GB | **~260 tokens/sec** | ~9 ms | High-throughput generation, low latency, agent orchestration |
| **M1 / M2 / M3 Ultra** | 64 GB – 192 GB | ~1.5 GB | **~363 tokens/sec** | ~6 ms | Peak concurrency, batch document extraction, production serving |

> *Projections based on Apple Silicon memory bandwidth saturation for 8-bit weights. Real-world speeds vary by prompt length.*

---

## Multi-Quantization Comparison

Evaluate your hardware budget and choose the optimal precision:

| Variant | Disk Size | VRAM Footprint | Target Apple Silicon Hardware | Key Advantage |
| :--- | :--- | :--- | :--- | :--- |
| **[4-bit MLX](https://huggingface.co/SirSahOl/Llama-Guard-3-1B-chat-mlx-4bit)** | ~0.9 GB | ~0.9 GB | M1 / M2 / M3 / M4 (8GB+) | Maximum generation speed and lowest RAM overhead. |
| **8-bit MLX** (This Repository) | ~1.5 GB | ~1.5 GB | M1 / M2 / M3 / M4 Pro/Max (16GB+) | Balanced accuracy and generation speed; near-lossless reasoning. |
| **[16-bit MLX](https://huggingface.co/SirSahOl/Llama-Guard-3-1B-chat-mlx-16bit)** | ~2.8 GB | ~2.8 GB | M2 / M3 / M4 Max/Ultra (32GB+) | Full unquantized precision; reference evaluation quality. |

---

## Who Should Use This?

| Your Hardware | Recommended Quantization |
|---------------|--------------------------|
| M1/M2/M3/M4 (8GB – 16GB) | **4-bit** — Best balance of speed, low memory, and multitasking capability |
| M1/M2/M3/M4 Pro/Max (18GB – 36GB) | **8-bit** — Higher quality reasoning with comfortable memory headroom |
| M1/M2/M3/M4 Max/Ultra (36GB – 192GB) | **16-bit** — Unquantized full precision, zero quality degradation |

**General guidance:**
- Use **4-bit** if you want to run this model alongside IDEs, browsers, and background development tools.
- Use **8-bit** if you have 16GB+ unified memory and require superior reasoning and code accuracy.
- Use **16-bit** for research, benchmarking, evaluation, or high-end workstation deployments.

---

## Other Quantization Variants

| Variant | Link |
|---------|------|
| 4-bit | [SirSahOl/Llama-Guard-3-1B-chat-mlx-4bit](https://huggingface.co/SirSahOl/Llama-Guard-3-1B-chat-mlx-4bit) |
| 8-bit | [SirSahOl/Llama-Guard-3-1B-chat-mlx-8bit](https://huggingface.co/SirSahOl/Llama-Guard-3-1B-chat-mlx-8bit) |
| 16-bit | [SirSahOl/Llama-Guard-3-1B-chat-mlx-16bit](https://huggingface.co/SirSahOl/Llama-Guard-3-1B-chat-mlx-16bit) |

---

## LM Studio & Local Inference Setup Guide

To prevent runaway loops and ensure correct conversational turn-taking, configure custom stop tokens in your local inference runtime:

1. `<|im_start|>`
2. `<|im_end|>`
3. `<|endoftext|>`

### Prompt Template Formatting

*   **System Prefix**: `<|im_start|>system\n`
*   **System Suffix**: `<|im_end|>\n`
*   **User Prefix**: `<|im_start|>user\n`
*   **Assistant Suffix**: `<|im_end|>\n<|im_start|>assistant\n`

### Ollama Quickstart

```dockerfile
FROM SirSahOl/Llama-Guard-3-1B-chat-mlx-8bit
PARAMETER stop "<|im_start|>"
PARAMETER stop "<|im_end|>"
PARAMETER stop "<|endoftext|>"
PARAMETER temperature 0.7
```

```bash
ollama create llama-guard-3-1b-chat-mlx-8bit -f Modelfile
ollama run llama-guard-3-1b-chat-mlx-8bit
```

---

## Conversion Details

| Property | Value |
|----------|-------|
| **Source Model** | [meta-llama/Llama-Guard-3-1B](https://huggingface.co/meta-llama/Llama-Guard-3-1B) |
| **Quantization** | 8-bit |
| **mlx-lm Version** | 0.31.3 |
| **Conversion Time** | 5.41s |
| **Output Size** | 1.5 GB |
| **Date** | 2026-09-22T02:19:25.790702+00:00 |

### Reproduction

To reproduce this conversion:

```bash
pip install mlx-lm==0.31.3
python3 -m mlx_lm.convert --hf-path /root/.cache/huggingface/hub/models--alpindale--Llama-Guard-3-1B/snapshots/758d9d0f17f85db2fb7fae0dd9ec67bb9b099592 --mlx-path output/Llama-Guard-3-1B-mlx-8bit -q --q-bits 8
```

---

## Limitations & Known Issues

- 4-bit group-wise quantization introduces minor precision loss compared to unquantized weights; for deep mathematical derivations or precision-critical reasoning, test the 8-bit or 16-bit variants.
- High context sequences (>32K tokens) require sufficient unified memory headroom; ensure unified memory is not overcommitted.
- This is a weight-only MLX conversion designed specifically for Apple Silicon GPUs (M1/M2/M3/M4 series).

---

## License

This model conversion inherits the license of the source model: **llama3.2**.

See the [original model card](https://huggingface.co/meta-llama/Llama-Guard-3-1B) for full license details.

---

## Changelog

| Version | Date | Changes |
|---------|------|---------|
| v1.0 | 2026-09-22 | Initial conversion |

---

*Converted with [MLX Foundry](https://github.com/SirSahOl/mlx-foundry) — a professional pipeline for converting models to Apple MLX format.*
