Run this model with HF Jobs

Run pgmharikrishnan/Hy4-flash-MLX-Serve-3.5bit on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs to fine-tune https://huggingface.co/pgmharikrishnan/Hy4-flash-MLX-Serve-3.5bit. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/pgmharikrishnan/Hy4-flash-MLX-Serve-3.5bit on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.

Evaluate on a benchmark

Use HF Jobs to evaluate https://huggingface.co/pgmharikrishnan/Hy4-flash-MLX-Serve-3.5bit. Ask me which benchmark to run, then save the scores and the per-example results to a new dataset repo. Run `hf jobs --help` first to learn the CLI.

Hy4-flash-MLX-Serve-3.5bit

A quantized conversion artifact of tencent/Hy4-flash-FP8 for MLX Serve on Apple Silicon. This is a quantized derivative of the Tencent base checkpoint, not an official Tencent release.

Status: Coherent generation verified on Apple Silicon. The model forward pass, prefix consistency, Engram projection biases, table offsets, and tokenization have been verified end-to-end with mlx-serve.

Active Upstream PR: ddalcu/mlx-serve#1251 (resolves issue #1241).
Public Run Branch: pgmharikrishnan/mlx-serve (branch hy4-flash-support).


How to Run

1. Prerequisites

  • Hardware: Apple Silicon Mac (M1/M2/M3/M4 Max or Ultra with 128 GB+ unified memory recommended; resident memory footprint is ~69.7 GiB).
  • Tools: Git, Git LFS, and Zig (or the embedded zig toolchain inside the repository).

2. Download the Model Pack

Download the safetensors shards and the external engram_table.bin into a local directory:

# Using huggingface-cli
huggingface-cli download pgmharikrishnan/Hy4-flash-MLX-Serve-3.5bit --local-dir ~/hy4-packs/Hy4-flash-MLX-Serve-3.5bit

Ensure all 152 files including engram_table.bin (39.6 GB) and shards model-00001.safetensors … model-00141.safetensors are present in the directory.

3. Clone and Build MLX-Serve

Clone the public feature branch and build the optimized server binary:

# Clone the public feature branch (active PR https://github.com/ddalcu/mlx-serve/pull/1251)
git clone -b hy4-flash-support https://github.com/pgmharikrishnan/mlx-serve.git
cd mlx-serve

# Build the release binary
./scripts/fetch-zig.sh 2>/dev/null || true
zig build -Doptimize=ReleaseFast

4. Launch the Server

Launch the server with the appropriate memory allocation:

# Optional: if another mlx-serve daemon is running, free wired memory first
launchctl bootout gui/$(id -u)/com.probackend.mlx-serve-official 2>/dev/null || true

# Start mlx-serve
MLX_MAX_RESIDENT_MEM=96GB ./zig-out/bin/mlx-serve \
  --model ~/hy4-packs/Hy4-flash-MLX-Serve-3.5bit \
  --port 11234 \
  --skip-mem-preflight

Wait until the logs indicate state: ready (~69.7 GiB resident).

5. Chat / Completion API

Use any OpenAI-compatible client or curl:

curl http://localhost:11234/v1/chat/completions \
  -H "Content-Type: application/json" \
  -d '{
    "model": "Hy4-flash-MLX-Serve-3.5bit",
    "messages": [
      {"role": "user", "content": "What is the capital of France?"}
    ],
    "temperature": 0.0
  }'

Expected output:

"The capital of France is Paris. Paris is also the most populous city in France..."


What is in this repository

File Size Notes
model-00001.safetensors … model-00141.safetensors 80.099 GB total 141 trunk shards, 2,738 tensors
model-vit.safetensors 0.933 GB Vision tower
model-dfly2.safetensors 0.899 GB DFLY2 component
engram_table.bin 39.600 GB 4-bit, group size 32; stored outside the trunk
model.safetensors.index.json — Weight index covering all 141 shards
engram_meta.json — Engram table metadata
config.json, generation_config.json — Model and generation configuration
tokenizer.json, tokenizer_config.json, chat_template.jinja — Tokenizer and chat template
LICENSE — Tencent Hy License 1.0

Total uploaded payload: 121.531 GB (152 files plus this README). Source checkpoint is 287.1 GB across 148 shards.

Quantization Recipe

  • Method: MLX affine quantization, group size 64.
  • Expert gate_up_proj: 3-bit.
  • Expert down_proj: 4-bit.
  • Last 6 layers: 4-bit on both gate_up_proj and down_proj.
  • Non-expert and attention projections: 8-bit.
  • Embeddings and lm_head: 4-bit.
  • All 41 MoE routers (model.layers.{1..41}.mlp.gate): 8-bit.

Engram Split & Engine Implementation

The Engram external table is 39.600 GB (39,600,385,352 bytes), quantized to 4-bit with group size 32. It is stored outside the trunk as a single binary file, engram_table.bin, and gathered from disk at runtime.

Key engine implementation details (see PR #1251):

  • Biases: value_proj.bias and key_projs.*.bias are loaded from the pack and applied before normalization.
  • FP8 Round-Trip: Per-head E4M3 rounding is applied matching upstream PR #50903.
  • Table Offsets: Cumulative offsets per hash head advance by each head's vocabulary size.
  • Stop Sequence: <|hy_end:opensource|> (token ID 120025) is recognized as the turn terminator.
  • Prefix Cache Safety: Generic snapshot caching is excluded for Hy4 because it keeps KV and Engram history on the module.

Credit

Base weights and original model architecture by Tencent, released as tencent/Hy4-flash-FP8. This derivative was produced by affine quantization of those weights.

The Tencent Hy License 1.0 applies to this derivative — quantized and derived works are covered by it. The full license text is reproduced in the LICENSE file in this repository.

Downloads last month
852
Safetensors
Model size
188B params
Tensor type
U32
·
I32
·
BF16
·
F32
·
MLX
Hardware compatibility
Log In to add your hardware

3-bit

Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for pgmharikrishnan/Hy4-flash-MLX-Serve-3.5bit

Quantized
(93)
this model