Add model card
Browse files
README.md
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: other
|
| 3 |
+
license_name: mrl
|
| 4 |
+
license_link: https://mistral.ai/licenses/MRL-0.1.md
|
| 5 |
+
base_model: TheDrummer/Behemoth-R1-123B-v2
|
| 6 |
+
base_model_relation: quantized
|
| 7 |
+
tags:
|
| 8 |
+
- qtip
|
| 9 |
+
- 2-bit
|
| 10 |
+
- quantized
|
| 11 |
+
- rocm
|
| 12 |
+
- mistral
|
| 13 |
+
pipeline_tag: text-generation
|
| 14 |
+
---
|
| 15 |
+
|
| 16 |
+
# Behemoth-R1-123B-v2 QTIP 2-bit
|
| 17 |
+
|
| 18 |
+
A 2-bit [QTIP](https://arxiv.org/abs/2406.11235) quantization of
|
| 19 |
+
[TheDrummer/Behemoth-R1-123B-v2](https://huggingface.co/TheDrummer/Behemoth-R1-123B-v2), which is a fine-tune of
|
| 20 |
+
Mistral-Large-Instruct-2411 (88 layers, hidden 12288, GQA 96/8). It is about 32 GB on disk and runs a 123B model on two
|
| 21 |
+
32 GB AMD Radeon AI PRO R9700 cards.
|
| 22 |
+
|
| 23 |
+
The quantizer and the inference runtime are in [c000507/Behemoth-qtip](https://github.com/c000507/Behemoth-qtip): a
|
| 24 |
+
C++/HIP reimplementation of the QTIP pipeline for ROCm (gfx1201), plus `behemoth_server`, an OpenAI-compatible server
|
| 25 |
+
with QTIP trellis-decode kernels and two-GPU tensor parallelism.
|
| 26 |
+
|
| 27 |
+
## Format
|
| 28 |
+
|
| 29 |
+
| | |
|
| 30 |
+
|---|---|
|
| 31 |
+
| q/o, gate/up/down projections | QTIP 2-bit HYB code: bitshift trellis L=16, K=2, V=2, `quantlut_sym` with a 2^9-entry LUT, 16x16 tiles |
|
| 32 |
+
| k/v projections | FP8 e4m3 with per-channel scale, kept from the source FP8 model (`kv_format: fp8`) |
|
| 33 |
+
| Embeddings, LM head, norms | bf16 |
|
| 34 |
+
| Layout | QTIP-hfized llama layout (`trellis`, `SU`, `SV`, `tlut`, `rcp`, `tp_rank` per linear); `quip_params` in `config.json` |
|
| 35 |
+
| Incoherence processing | random sign vectors + Hadamard transforms on both sides |
|
| 36 |
+
| Rounding | block LDLQ (16-blocks) with tail-biting Viterbi, sigma_reg 1e-2, scale override 0.9 |
|
| 37 |
+
|
| 38 |
+
The weights are not loadable with stock `transformers`. Use `behemoth_server` from the Behemoth-qtip repo. The 2-bit
|
| 39 |
+
tensors follow the reference QTIP (Cornell-RelaxML/qtip) hfized layout, but the mixed FP8 k/v projections are specific
|
| 40 |
+
to Behemoth-qtip (see its `docs/MIXED_FP8_RECONSTRUCTION.md`).
|
| 41 |
+
|
| 42 |
+
## Calibration
|
| 43 |
+
|
| 44 |
+
- 4.19M tokens: 512 sequences of 8192 tokens.
|
| 45 |
+
- 75% chat and roleplay conversations with chain-of-thought, in the model's chat template with the reasoning inlined.
|
| 46 |
+
25% general text: OpenWebText and SmolTalk.
|
| 47 |
+
- Hessians were collected layer by layer from the original FP8 model (FP8 weights used exactly, per-channel scale
|
| 48 |
+
applied in fp32), one Hessian group at a time: q, o, gate+up, down.
|
| 49 |
+
|
| 50 |
+
## Serving
|
| 51 |
+
|
| 52 |
+
Build `runtime/` from the Behemoth-qtip repository (ROCm, see its README), then:
|
| 53 |
+
|
| 54 |
+
```sh
|
| 55 |
+
runtime/build-rocm/behemoth_server --model /path/to/Behemoth-R1-123B-v2-QTIP-2bit \
|
| 56 |
+
--devices 0,1 --transport zerocopy --code-layout lane --memory-fraction 0.9 \
|
| 57 |
+
--token-budget 2048 --prefill-chunk 2048 --mixed-prefill-tokens 512 --prefill-interval 24 \
|
| 58 |
+
--host 0.0.0.0 --port 1337 --threads 4 --profile false
|
| 59 |
+
```
|
| 60 |
+
|
| 61 |
+
Single-request decode measures about 44 ms/token at short context and about 52 ms/token at 16k on 2x R9700.
|
| 62 |
+
|
| 63 |
+
## Chat template
|
| 64 |
+
|
| 65 |
+
Mistral `[INST]` format, the same as the base model (`chat_template.jinja`):
|
| 66 |
+
|
| 67 |
+
```
|
| 68 |
+
<s>[SYSTEM_PROMPT] ...[/SYSTEM_PROMPT][INST] ...[/INST] assistant reply</s>
|
| 69 |
+
```
|
| 70 |
+
|
| 71 |
+
## License
|
| 72 |
+
|
| 73 |
+
This is a derivative of Mistral-Large-Instruct-2411 and is distributed under the
|
| 74 |
+
[Mistral AI Research License](https://mistral.ai/licenses/MRL-0.1.md): research and non-commercial use only. See the
|
| 75 |
+
base models for their terms.
|