Text Generation
MLX
Safetensors
English
Chinese
longcat_flash_sparse
longcat
lsa
Mixture of Experts
ngram-embedding
conversational
4-bit precision
Instructions to use mlx-community/LongCat-Flash-Lite-Sparse-4bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use mlx-community/LongCat-Flash-Lite-Sparse-4bit with MLX:
# Make sure mlx-lm is installed # pip install --upgrade mlx-lm # Generate text with mlx-lm from mlx_lm import load, generate model, tokenizer = load("mlx-community/LongCat-Flash-Lite-Sparse-4bit") prompt = "Write a story about Einstein" messages = [{"role": "user", "content": prompt}] prompt = tokenizer.apply_chat_template( messages, add_generation_prompt=True ) text = generate(model, tokenizer, prompt=prompt, verbose=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Pi
How to use mlx-community/LongCat-Flash-Lite-Sparse-4bit with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "mlx-community/LongCat-Flash-Lite-Sparse-4bit"
Configure the model in Pi
# Install Pi: npm install -g @earendil-works/pi-coding-agent # Add to ~/.pi/agent/models.json: { "providers": { "mlx-lm": { "baseUrl": "http://localhost:8080/v1", "api": "openai-completions", "apiKey": "none", "models": [ { "id": "mlx-community/LongCat-Flash-Lite-Sparse-4bit" } ] } } }Run Pi
# Start Pi in your project directory: pi
- MLX LM
How to use mlx-community/LongCat-Flash-Lite-Sparse-4bit with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "mlx-community/LongCat-Flash-Lite-Sparse-4bit"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "mlx-community/LongCat-Flash-Lite-Sparse-4bit" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "mlx-community/LongCat-Flash-Lite-Sparse-4bit", "messages": [ {"role": "user", "content": "Hello"} ] }' - Hermes Agent
How to use mlx-community/LongCat-Flash-Lite-Sparse-4bit with Hermes Agent:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "mlx-community/LongCat-Flash-Lite-Sparse-4bit"
Configure Hermes
# Install Hermes: curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash hermes setup # Point Hermes at the local server: hermes config set model.provider custom hermes config set model.base_url http://127.0.0.1:8080/v1 hermes config set model.default mlx-community/LongCat-Flash-Lite-Sparse-4bit
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use mlx-community/LongCat-Flash-Lite-Sparse-4bit with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "mlx-community/LongCat-Flash-Lite-Sparse-4bit"
Configure OpenClaw
# Install OpenClaw: npm install -g openclaw@latest # Register the local server and set it as the default model: openclaw onboard --non-interactive --mode local \ --auth-choice custom-api-key \ --custom-base-url http://127.0.0.1:8080/v1 \ --custom-model-id "mlx-community/LongCat-Flash-Lite-Sparse-4bit" \ --custom-provider-id mlx-lm \ --custom-compatibility openai \ --custom-text-input \ --accept-risk \ --skip-health
Run OpenClaw
openclaw agent --local --agent main --message "Hello from Hugging Face"
Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -20,6 +20,8 @@ pipeline_tag: text-generation
|
|
| 20 |
|
| 21 |
To our knowledge this is the **first working implementation of LongCat-Flash-Lite-Sparse in any framework** — no upstream serving stack (mlx-lm, vLLM, SGLang, llama.cpp) supports the `oe_embed_*` variant yet.
|
| 22 |
|
|
|
|
|
|
|
| 23 |
## What's in this checkpoint
|
| 24 |
LongCat-Flash-Lite-Sparse adds three things vanilla LongCat-Flash lacks:
|
| 25 |
- **LongCat Sparse Attention (LSA)** — a DeepSeek-style lightning indexer over MLA, with streaming-aware indexing (fixed sink + local window) and cross-layer index reuse (`cli_factor`). Native long context.
|
|
@@ -48,20 +50,32 @@ print(generate(model, processor, text, max_tokens=64, temperature=0.0))
|
|
| 48 |
# -> The capital of France is Paris.
|
| 49 |
```
|
| 50 |
|
| 51 |
-
##
|
| 52 |
-
|
|
|
|
| 53 |
|
| 54 |
-
|
|
|
|
| 55 |
|--:|--:|--:|--:|
|
| 56 |
-
| 512
|
| 57 |
-
| 1024
|
| 58 |
-
| 2048
|
| 59 |
-
| 4096
|
| 60 |
-
| 8192
|
| 61 |
-
| 16384
|
| 62 |
-
| 32768
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
|
| 64 |
-
LSA's dynamic sparse selection activates once the KV length exceeds `index_topk` (2048),
|
| 65 |
|
| 66 |
## License
|
| 67 |
MIT, inherited from the base model.
|
|
|
|
| 20 |
|
| 21 |
To our knowledge this is the **first working implementation of LongCat-Flash-Lite-Sparse in any framework** — no upstream serving stack (mlx-lm, vLLM, SGLang, llama.cpp) supports the `oe_embed_*` variant yet.
|
| 22 |
|
| 23 |
+
4-bit (~36 GB of weights) is the smallest and fastest variant, for a 64 GB Mac. Also available: [6-bit](https://huggingface.co/AlazarM/LongCat-Flash-Lite-Sparse-6bit) (~52 GB, 96 GB Macs) and [8-bit](https://huggingface.co/AlazarM/LongCat-Flash-Lite-Sparse-8bit) (~68 GB, 128 GB Macs, near-lossless).
|
| 24 |
+
|
| 25 |
## What's in this checkpoint
|
| 26 |
LongCat-Flash-Lite-Sparse adds three things vanilla LongCat-Flash lacks:
|
| 27 |
- **LongCat Sparse Attention (LSA)** — a DeepSeek-style lightning indexer over MLA, with streaming-aware indexing (fixed sink + local window) and cross-layer index reuse (`cli_factor`). Native long context.
|
|
|
|
| 50 |
# -> The capital of France is Paris.
|
| 51 |
```
|
| 52 |
|
| 53 |
+
## Throughput (M5 Max, 128 GB, batch 1, greedy)
|
| 54 |
+
|
| 55 |
+
Same methodology across quantizations (chunk-512 prefill, warmed kernels).
|
| 56 |
|
| 57 |
+
**Decode tok/s**
|
| 58 |
+
| ctx | 4-bit | 6-bit | 8-bit |
|
| 59 |
|--:|--:|--:|--:|
|
| 60 |
+
| 512 | 112 | 87 | 80 |
|
| 61 |
+
| 1024 | 101 | 83 | 75 |
|
| 62 |
+
| 2048 | 85 | 72 | 65 |
|
| 63 |
+
| 4096 | 84 | 72 | 65 |
|
| 64 |
+
| 8192 | 83 | 71 | 65 |
|
| 65 |
+
| 16384 | 79 | 66 | 64 |
|
| 66 |
+
| 32768 | 73 | 64 | 60 |
|
| 67 |
+
|
| 68 |
+
**Prefill tok/s**
|
| 69 |
+
| ctx | 4-bit | 6-bit | 8-bit |
|
| 70 |
+
|--:|--:|--:|--:|
|
| 71 |
+
| 512 | 3142 | 2581 | 2421 |
|
| 72 |
+
| 2048 | 2386 | 2366 | 1923 |
|
| 73 |
+
| 8192 | 1756 | 1627 | 1312 |
|
| 74 |
+
| 32768 | 623 | 504 | 492 |
|
| 75 |
+
|
| 76 |
+
**Footprint** — peak memory across 512→32k: 4-bit ~39–45 GB · 6-bit ~56–63 GB · 8-bit ~74–80 GB.
|
| 77 |
|
| 78 |
+
LSA's dynamic sparse selection activates once the KV length exceeds `index_topk` (2048), keeping decode nearly flat (4-bit 112→73 tok/s to 32k). Batch-1 decode is partly weight-bandwidth-bound, so lower precision is faster; higher precision trades that for quality — only ~3B params are active per token, so quant error has little room to hide.
|
| 79 |
|
| 80 |
## License
|
| 81 |
MIT, inherited from the base model.
|