Instructions to use Myric/Moonlight-16B-A3B-Instruct-APEX-GGUF with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use Myric/Moonlight-16B-A3B-Instruct-APEX-GGUF with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="Myric/Moonlight-16B-A3B-Instruct-APEX-GGUF", filename="Moonlight-16B-A3B-Instruct-APEX-handroll.gguf", )
llm.create_chat_completion( messages = [ { "role": "user", "content": "What is the capital of France?" } ] ) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use Myric/Moonlight-16B-A3B-Instruct-APEX-GGUF with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf Myric/Moonlight-16B-A3B-Instruct-APEX-GGUF # Run inference directly in the terminal: llama cli -hf Myric/Moonlight-16B-A3B-Instruct-APEX-GGUF
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf Myric/Moonlight-16B-A3B-Instruct-APEX-GGUF # Run inference directly in the terminal: llama cli -hf Myric/Moonlight-16B-A3B-Instruct-APEX-GGUF
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf Myric/Moonlight-16B-A3B-Instruct-APEX-GGUF # Run inference directly in the terminal: ./llama-cli -hf Myric/Moonlight-16B-A3B-Instruct-APEX-GGUF
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf Myric/Moonlight-16B-A3B-Instruct-APEX-GGUF # Run inference directly in the terminal: ./build/bin/llama-cli -hf Myric/Moonlight-16B-A3B-Instruct-APEX-GGUF
Use Docker
docker model run hf.co/Myric/Moonlight-16B-A3B-Instruct-APEX-GGUF
- LM Studio
- Jan
- vLLM
How to use Myric/Moonlight-16B-A3B-Instruct-APEX-GGUF with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Myric/Moonlight-16B-A3B-Instruct-APEX-GGUF" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Myric/Moonlight-16B-A3B-Instruct-APEX-GGUF", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Myric/Moonlight-16B-A3B-Instruct-APEX-GGUF
- Ollama
How to use Myric/Moonlight-16B-A3B-Instruct-APEX-GGUF with Ollama:
ollama run hf.co/Myric/Moonlight-16B-A3B-Instruct-APEX-GGUF
- Unsloth Studio
How to use Myric/Moonlight-16B-A3B-Instruct-APEX-GGUF with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for Myric/Moonlight-16B-A3B-Instruct-APEX-GGUF to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for Myric/Moonlight-16B-A3B-Instruct-APEX-GGUF to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for Myric/Moonlight-16B-A3B-Instruct-APEX-GGUF to start chatting
- Atomic Chat new
- Docker Model Runner
How to use Myric/Moonlight-16B-A3B-Instruct-APEX-GGUF with Docker Model Runner:
docker model run hf.co/Myric/Moonlight-16B-A3B-Instruct-APEX-GGUF
- Lemonade
How to use Myric/Moonlight-16B-A3B-Instruct-APEX-GGUF with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull Myric/Moonlight-16B-A3B-Instruct-APEX-GGUF
Run and chat with the model
lemonade run user.Moonlight-16B-A3B-Instruct-APEX-GGUF-{{QUANT_TAG}}List all available models
lemonade list
Moonlight-16B-A3B-Instruct β APEX GGUF
MoE-aware, mixed-precision APEX quantizations of moonshotai/Moonlight-16B-A3B-Instruct (16B total / ~3B active, DeepSeek-V2/V3-style MoE: 64 routed + 2 shared experts, MLA attention).
APEX assigns quantization precision per tensor role and per layer instead of uniformly β keeping always-active shared experts and edge layers high-precision while compressing the sparse routed-expert middle layers hard. The result is near-full-precision quality at a fraction of the size.
Results
Perplexity on wikitext-2-raw (test split, 200 Γ 512-token windows), measured with
llama-perplexity. Lower is better.
| File | Size | BPW | PPL | Ξ vs F16 |
|---|---|---|---|---|
| F16 (reference baseline) | 30 GB | 16.0 | 8.836 | β |
| APEX-i-quality | 12 GB | 5.99 | 8.916 | +0.90% |
| APEX-handroll | 11 GB | 5.40 | 8.959 | +1.38% |
Both tiers hold within ~1% of full-precision perplexity at ~2.6Γ smaller. Coherent in English and on code prompts; ~85 tok/s generation on a single modern GPU.
Which file to pick
- APEX-i-quality (12 GB) β highest quality; edge/near routed experts at Q6_K/Q5_K, middle at IQ4_XS, shared experts Q8_0, attention Q6_K. Uses a diverse ("I") imatrix.
- APEX-handroll (11 GB) β same recipe, but the routed down projections are pinned to IQ4_NL (see Method). ~8% smaller for +0.05 PPL β the better size/quality trade on this architecture.
Usage (llama.cpp)
llama-cli -m Moonlight-16B-A3B-Instruct-APEX-handroll.gguf -ngl 999 -p "Hello"
# or serve an OpenAI-compatible endpoint:
llama-server -m Moonlight-16B-A3B-Instruct-APEX-handroll.gguf -ngl 999 --host 0.0.0.0 --port 8081
Requires a llama.cpp build recent enough to support the deepseek2 architecture
and the kimi-k2 pre-tokenizer (Moonlight shares Moonshot's tiktoken tokenizer).
Method & notes
APEX is a bit-allocation recipe over stock llama-quantize --tensor-type-file
(no kernel/format changes). Two architecture-specific adaptations were required
for Moonlight that the stock APEX profiles do not handle:
- MLA attention tensors. Moonlight uses Multi-head Latent Attention, so its
attention projections are named
attn_q,attn_kv_a_mqa,attn_k_b,attn_v_b,attn_outputβ not the usualattn_q/k/v. The generated config was patched to assign precision to the real MLA tensors (otherwise the KV projections silently keep the base type). - Non-256-divisible expert dim (1408). Moonlight's routed-expert intermediate
size is 1408, which K-quants (Q6_K/Q5_K/IQ4_XS require 256-divisibility) cannot
quantize β they fall back to Q8_0, wasting bits on the largest tensors. The
handroll tier pins routed
ffn_down_expsto IQ4_NL (a block-32 4-bit type) to compress them properly. This is the difference between the two tiers.
Baseline: quantized from
gabriellarson/Moonlight-16B-A3B-Instruct-GGUF's
F16 conversion. Calibration imatrix built from Bartowski's calibration_datav3
(diverse chat/code/reasoning text).
Reproduce
Full recipe with exact commands, pinned tool versions, the tensor-type configs,
and the config-generation/patch scripts is in REPRODUCE.md.
Bundled: generate_config.sh, patch_moonlight_config.py,
configs/moonlight_*.txt, and the imatrix β so the whole pipeline is
reproducible without any private dependency.
Attribution & licenses
All components are MIT-licensed; see LICENSE and NOTICE.
- Base model: Moonshot AI (@moonshotai) β Moonlight-16B-A3B-Instruct (MIT)
- F16 GGUF conversion: gabriellarson (@gabriellarson) β source GGUF (MIT-derived)
- Quantization engine: llama.cpp by the ggml authors (@ggml-org Β· github) (MIT)
- APEX recipe & toolkit: Ettore Di Giacinto / LocalAI (@mudler) β localai-org/apex-quant (MIT)
- Calibration data: Bartowski (@bartowski) β calibration_datav3
This is an unofficial community quantization and is not affiliated with or endorsed by Moonshot AI.
- Downloads last month
- 248
We're not able to determine the quantization variants.
Model tree for Myric/Moonlight-16B-A3B-Instruct-APEX-GGUF
Base model
moonshotai/Moonlight-16B-A3B-Instruct