Instructions to use hkust-aaron/EdgeRock-4B-FP8 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use hkust-aaron/EdgeRock-4B-FP8 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="hkust-aaron/EdgeRock-4B-FP8", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("hkust-aaron/EdgeRock-4B-FP8", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use hkust-aaron/EdgeRock-4B-FP8 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "hkust-aaron/EdgeRock-4B-FP8" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "hkust-aaron/EdgeRock-4B-FP8", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/hkust-aaron/EdgeRock-4B-FP8
- SGLang
How to use hkust-aaron/EdgeRock-4B-FP8 with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "hkust-aaron/EdgeRock-4B-FP8" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "hkust-aaron/EdgeRock-4B-FP8", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "hkust-aaron/EdgeRock-4B-FP8" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "hkust-aaron/EdgeRock-4B-FP8", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use hkust-aaron/EdgeRock-4B-FP8 with Docker Model Runner:
docker model run hf.co/hkust-aaron/EdgeRock-4B-FP8
EdgeRock-4B-FP8
EdgeRock's constant-memory reasoning architecture in a smaller weight package. This release uses FP8 E4M3 weights in 128 × 128 blocks, with dynamic FP8 activations. It retains the full recurrent-state, local-attention, and Rock Memory Anchors (RMA) architecture.
The source is Rock Matrix's EdgeRock, frozen at a6a53a5573f1. Quantization changes the large projection and MLP matrices. RMA weights, small recurrent gates, the tied embedding/output head, cache capacity, and recurrent-state settings retain their source values. This is mixed-precision quantization; the format name describes the quantized matrices.
Load and generate
Use a fresh Python environment and install this repository's requirements.txt. The pinned Transformers wheel contains the Qwen3.5 implementation used by EdgeRock. This package contains the text model and supports the PyTorch inference path.
pip install -r requirements.txt
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "hkust-aaron/EdgeRock-4B-FP8"
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
from transformers.integrations import finegrained_fp8
finegrained_fp8._deepgemm_available = False # Validated Triton path for the pinned Transformers version.
model = AutoModelForCausalLM.from_pretrained(
model_id, trust_remote_code=True, dtype=torch.bfloat16, device_map={"": 0},
).eval()
messages = [{"role": "user", "content": "Calculate 17 * 23."}]
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(text, return_tensors="pt", add_special_tokens=False).to("cuda")
output = model.generate(**inputs, max_new_tokens=2048, do_sample=False)
print(tokenizer.decode(output[0, inputs.input_ids.shape[1]:], skip_special_tokens=True))
FP8 execution requires an NVIDIA GPU with compute capability 9.0 or newer. The first run downloads the finegrained-FP8 kernel from Hugging Face.
The quantization configuration is embedded in config.json; loading does not require a second quantization pass.
Conversion validation
| Check | BF16 source | This release |
|---|---|---|
| Weight files | 8.527 GiB | 5.208 GiB |
| Teacher-forced NLL on 32 GSM8K test examples | 0.9892 | 0.9932 |
| Maximum logit change after saving and reloading | — | 0 |
The NLL check scores the final up-to-64 tokens of each question/answer sequence, truncated to 512 tokens. Lower is better; these examples are held out from conversion and are not calibration data. This is a conversion check, not a GSM8K accuracy score.
Fresh-process checks verified 168 protected tensors against the source bit for bit. All three arithmetic checks and both identifier-retrieval checks passed; retrieval prompts span approximately 2K and 8K tokens. A Chinese-to-English translation check is included. See validation.json for the exact protocol and outputs. Full benchmark accuracy and optimized serving throughput have not been remeasured for these quantized weights.
A separate generation screen uses GSM8K test rows 32–47, greedy decoding and a 4,096-token output budget. Correct complete answers: 15/16, compared with 15/16 for the BF16 source. Two additional memory update/key-disambiguation checks use 9,664 and 10,462 input tokens: 2/2, compared with 2/2 for BF16. A correct answer must match the expected value, close the thinking section, and reach EOS within the budget. These small screens do not establish unchanged full-benchmark accuracy.
The source model's multimodal frontend and native serving adapters are distributed in the original repository. This quantized package validates text inference; it does not bundle or validate the visual frontend. It is not a GGUF or Ollama model.
License and provenance
The weights retain the EdgeRock Model License 1.0; code retains Apache-2.0. Original notices are preserved in NOTICE. Changes in this derivative release consist of weight quantization, the packaged chat template and generation settings, and the HQQ loader where applicable. Source benchmark claims are described in the technical report.
- Downloads last month
- -
Model tree for hkust-aaron/EdgeRock-4B-FP8
Base model
rockmatrix-ai/EdgeRock