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.
Instructions to use pgmharikrishnan/Hy4-flash-MLX-Serve-3.5bit with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use pgmharikrishnan/Hy4-flash-MLX-Serve-3.5bit with MLX:
# Make sure mlx-vlm is installed # pip install --upgrade mlx-vlm from mlx_vlm import load, generate from mlx_vlm.prompt_utils import apply_chat_template from mlx_vlm.utils import load_config # Load the model model, processor = load("pgmharikrishnan/Hy4-flash-MLX-Serve-3.5bit") config = load_config("pgmharikrishnan/Hy4-flash-MLX-Serve-3.5bit") # Prepare input image = ["http://images.cocodataset.org/val2017/000000039769.jpg"] prompt = "Describe this image." # Apply chat template formatted_prompt = apply_chat_template( processor, config, prompt, num_images=1 ) # Generate output output = generate(model, processor, formatted_prompt, image) print(output) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- Pi
How to use pgmharikrishnan/Hy4-flash-MLX-Serve-3.5bit with Pi:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "pgmharikrishnan/Hy4-flash-MLX-Serve-3.5bit"
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": "pgmharikrishnan/Hy4-flash-MLX-Serve-3.5bit" } ] } } }Run Pi
# Start Pi in your project directory: pi
- Hermes Agent
How to use pgmharikrishnan/Hy4-flash-MLX-Serve-3.5bit 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 "pgmharikrishnan/Hy4-flash-MLX-Serve-3.5bit"
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 pgmharikrishnan/Hy4-flash-MLX-Serve-3.5bit
Run Hermes
hermes
- Atomic Chat
- OpenClaw
How to use pgmharikrishnan/Hy4-flash-MLX-Serve-3.5bit with OpenClaw:
Start the MLX server
# Install MLX LM: uv tool install mlx-lm # Start a local OpenAI-compatible server: mlx_lm.server --model "pgmharikrishnan/Hy4-flash-MLX-Serve-3.5bit"
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 "pgmharikrishnan/Hy4-flash-MLX-Serve-3.5bit" \ --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"
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(branchhy4-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_projanddown_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.biasandkey_projs.*.biasare 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
3-bit
Model tree for pgmharikrishnan/Hy4-flash-MLX-Serve-3.5bit
Base model
tencent/Hy4-flash