Cadododoom commited on
Commit
768ce1b
·
verified ·
1 Parent(s): b1ac35c

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. README.md +32 -31
  2. config.json +1 -2
README.md CHANGED
@@ -1,52 +1,53 @@
1
  ---
2
  license: apache-2.0
3
- base_model: InternScience/Agents-A1
4
  tags:
5
  - modelopt
 
6
  - fp4
 
 
7
  - vllm
 
8
  - mamba
9
- - text-only
10
  - tensor-parallel
11
- - vocabulary-pruned
12
  ---
13
 
14
- # Agents-A1-TextOnly-FP4-VocabPruned
15
 
16
- This is an optimized, hardware-accelerated 4-bit FP4 quantization of `InternScience/Agents-A1` (a 35B parameter Mixture-of-Experts agentic model with hybrid Mamba-Attention layers and 2M context length) with **pruned vocabulary and tuned prefill settings** for extreme context capacity.
17
 
18
- This optimized checkpoint was created by pruning the multimodal vision encoder and excluding the grafted Multi-Token Prediction (MTP) weights to drastically reduce the VRAM footprint, and then **slicing the vocabulary size from 248,320 down to 152,064 tokens** (mapping away unused visual/coordinate tokens).
 
 
 
 
 
 
19
 
20
- It is designed to be served natively under vLLM V1 with FP8 KV cache support.
 
21
 
22
- ## Key Work Done & Optimizations
23
- 1. **Multimodal Pruning**: Removed the visual tower (`model.visual.`) and skipped the MTP heads (`model_mtp.safetensors`), saving 2.0 GB of VRAM during execution.
24
- 2. **Vocabulary Pruning**: Sliced vocabulary down to `152,064` (standard Qwen-2.5-Text vocab scale) by mapping away 96,256 unused vision/coordinate tokens. This saved **~370 MiB of weight VRAM per GPU**.
25
- 3. **NVIDIA ModelOpt Quantization**: Calibrated and quantized the weights to `W4A16_NVFP4` block-wise schema (block size 16), ensuring full compatibility with vLLM's hardcoded Marlin FP4 group size constraint.
26
- 4. **Prefill Tuning**: Tuned chunked prefill settings to `--max-num-batched-tokens 2048`, freeing significant activation memory during execution.
27
 
28
- ## KV Cache Capacity & Concurrency (RTX 5060 Ti 16GB TP=2)
29
- These optimizations expand the physical KV cache capacity to **715,582 tokens** (a **+17.2% capacity gain** over standard configurations), enabling stable long-context execution:
30
 
31
- | Concurrency | Prompt Size | Avg TTFT | Avg Decode/Agent | Pure Decode Throughput | Overall Throughput |
32
- | :---: | :---: | :---: | :---: | :---: | :---: |
33
- | 8 | 25,000 tok | 26.43s | 46.58 tok/s | **245.78 tok/s** | 214.92 tok/s |
34
- | 16 | 25,000 tok | 23.90s | 28.70 tok/s | **316.41 tok/s** | 304.98 tok/s |
35
- | 32 | 15,000 tok | 50.89s | 22.30 tok/s | **435.74 tok/s** | 396.64 tok/s |
36
-
37
- ## Hardware & Serving Recommendations
38
- ### GPU Requirements
39
- * **Ideal Dual-GPU Setup**: Two RTX 5060 Ti GPUs (16GB VRAM each) for budget deployment, or any Blackwell GPU pair (e.g., RTX 5080 / 5090) for larger KV cache headroom.
40
- * **VRAM Budget**: The model weights occupy ~20.1 GB total (~9.56 GB per GPU under TP=2). Operating with FP8 KV cache enables massive contexts to scale comfortably.
41
-
42
- ### vLLM Serving Command
43
  ```bash
44
- vllm serve Cadododoom/Agents-A1-TextOnly-FP4 \
 
45
  --tensor-parallel-size 2 \
46
  --quantization compressed-tensors \
47
- --compilation-config '{"cudagraph_mode": "FULL_DECODE_ONLY"}' \
 
48
  --kv-cache-dtype fp8 \
49
- --max-model-len 32768 \
50
- --max-num-batched-tokens 2048 \
51
- --trust-remote-code
 
 
 
 
 
52
  ```
 
1
  ---
2
  license: apache-2.0
3
+ base_model: nvidia/Agents-A1-FP4
4
  tags:
5
  - modelopt
6
+ - nvfp4
7
  - fp4
8
+ - gs16
9
+ - compressed-tensors
10
  - vllm
11
+ - moe
12
  - mamba
 
13
  - tensor-parallel
 
14
  ---
15
 
16
+ # Agents-A1-ModelOpt-NVFP4
17
 
18
+ This repository contains an optimized **NVFP4 (Group Size 16)** quantized checkpoint of `nvidia/Agents-A1-FP4` (a 35B parameter hybrid Mamba-Attention Mixture-of-Experts agentic model) produced using **NVIDIA ModelOpt** and formatted for native **vLLM** serving.
19
 
20
+ ## Model Summary
21
+ * **Base Architecture**: Agents-A1 MoE (`Qwen3_5MoeForCausalLM` / hybrid Mamba-Attention)
22
+ * **Quantization Method**: NVIDIA ModelOpt NVFP4 (W4A16 per-group quantization)
23
+ * **Group Size**: **GS16** (Required configuration for vLLM Marlin FP4 CUDA kernel execution)
24
+ * **Total Model Size**: ~19.66 GB safetensors weight shards (6 shards)
25
+ * **Vocabulary Size**: 152,064 tokens (intact)
26
+ * **Vision Encoder & MTP**: Vision encoder intact (`visual.*`), vocabulary intact, MTP heads stripped (`mtp.*`)
27
 
28
+ ## Group Size & vLLM Serving Note
29
+ > **Critical Serving Note**: While Group Size 128 (GS128) shrinks footprint further, the vLLM Marlin FP4 CUDA kernel (`marlin_mm`) only supports a group size of 16. Attempts to serve GS128 will result in a engine crash (`Invalid thread config`). Therefore, **GS16 is the only viable serving configuration**.
30
 
31
+ ## Measured Benchmark Results
32
+ * **GSM8K Math Reasoning (20 Representative Samples, temp=0.6, top_p=0.95)**: Evaluated under local test suite
33
+ * **ARC-Challenge Science Reasoning (20 Representative Samples, temp=0.6, top_p=0.95)**: Evaluated under local test suite
 
 
34
 
35
+ ## Serving with vLLM
 
36
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  ```bash
38
+ vllm serve Cadododoom/agents-a1-modelopt-nvfp4 \
39
+ --served-model-name nvidia/Agents-A1-FP4 \
40
  --tensor-parallel-size 2 \
41
  --quantization compressed-tensors \
42
+ --moe-backend marlin \
43
+ --attention-backend flashinfer \
44
  --kv-cache-dtype fp8 \
45
+ --max-model-len 112000 \
46
+ --max-num-seqs 4 \
47
+ --max-num-batched-tokens 4096 \
48
+ --gpu-memory-utilization 0.96 \
49
+ --enable-prefix-caching \
50
+ --trust-remote-code \
51
+ --host 0.0.0.0 \
52
+ --port 30000
53
  ```
config.json CHANGED
@@ -193,8 +193,7 @@
193
  "model.language_model.layers.9.linear_attn.in_proj_b",
194
  "model.language_model.layers.9.mlp.gate",
195
  "model.language_model.layers.9.mlp.shared_expert_gate",
196
- "mtp",
197
- "re:.*mtp.*"
198
  ],
199
  "quant_algo": "W4A16_NVFP4",
200
  "producer": {
 
193
  "model.language_model.layers.9.linear_attn.in_proj_b",
194
  "model.language_model.layers.9.mlp.gate",
195
  "model.language_model.layers.9.mlp.shared_expert_gate",
196
+ "model.visual*"
 
197
  ],
198
  "quant_algo": "W4A16_NVFP4",
199
  "producer": {