jackcloudman commited on
Commit
02b06a3
·
verified ·
1 Parent(s): e162b08

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +84 -0
README.md ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ base_model: mistralai/Leanstral-2603
4
+ tags:
5
+ - gguf
6
+ - llama-cpp
7
+ - mistral
8
+ - moe
9
+ - lean4
10
+ - math
11
+ - deepseek2
12
+ quantized_by: jackcloudman
13
+ model_type: deepseek2
14
+ ---
15
+
16
+ # Leanstral 119B A6B - GGUF
17
+
18
+ GGUF quantizations of [mistralai/Leanstral-2603](https://huggingface.co/mistralai/Leanstral-2603) for use with [llama.cpp](https://github.com/ggml-org/llama.cpp).
19
+
20
+ Leanstral is the first open-source code agent designed for [Lean 4](https://github.com/leanprover/lean4), a proof assistant for formal mathematics and software verification. Built as part of the Mistral Small 4 family, it combines multimodal capabilities with an efficient MoE + MLA architecture.
21
+
22
+ ## Available Quantizations
23
+
24
+ | File | Quant | Size | Description |
25
+ |------|-------|------|-------------|
26
+ | `mistralai_Leanstral-128x3.9B-2603-Q4_K_M.gguf` | Q4_K_M | 68 GB | Best balance of quality and size. Runs on 2x RTX 4090 + RAM offload |
27
+ | `mistralai_Leanstral-128x3.9B-2603-Q8_0.gguf` | Q8_0 | 118 GB | Near-lossless. Good base for custom requantization |
28
+
29
+ ## Architecture
30
+
31
+ - **Type**: Mixture of Experts (MoE) + Multi-head Latent Attention (MLA)
32
+ - **GGUF arch**: `deepseek2` (Mistral 4 uses the same architecture as DeepSeek V3)
33
+ - **Total parameters**: 119B (6.5B active per token)
34
+ - **Experts**: 128 routed + 1 shared, 4 active per token
35
+ - **MLA**: q_lora_rank=1024, kv_lora_rank=256, qk_rope_head_dim=64
36
+ - **Context**: Up to 1M tokens (256k recommended)
37
+ - **RoPE**: YaRN scaling (factor=128, original_ctx=8192)
38
+ - **Vocab**: 131,072 tokens (Tekken tokenizer)
39
+
40
+ ## How to Run
41
+
42
+ ### llama-server (recommended)
43
+
44
+ ```bash
45
+ ./llama-server \
46
+ -m mistralai_Leanstral-128x3.9B-2603-Q4_K_M.gguf \
47
+ -fit on -fa on \
48
+ --host 0.0.0.0 \
49
+ --ctx-size 128000 \
50
+ --jinja \
51
+ --chat-template-file chat_template.jinja
52
+ ```
53
+
54
+ > **Note**: You need a chat template that supports `[THINK]` blocks for reasoning. Download the template from the [original model repo](https://huggingface.co/mistralai/Leanstral-2603).
55
+
56
+ ### Reasoning
57
+
58
+ The model supports `reasoning_effort` via the chat template:
59
+ - `"high"` - Enables thinking (recommended for Lean 4 proofs and complex tasks)
60
+ - `"none"` - Direct answers without reasoning
61
+
62
+ Pass `reasoning_effort` in your API request body, or modify the chat template default.
63
+
64
+ ### Performance
65
+
66
+ On 2x RTX 4090 (48GB VRAM) + 192GB RAM with Q4_K_M:
67
+ - ~34 tokens/s generation speed
68
+ - Model splits between GPU and system RAM automatically with `-fit on`
69
+
70
+ ## Conversion Details
71
+
72
+ - **Source**: FP8 (e4m3) consolidated weights from [mistralai/Leanstral-2603](https://huggingface.co/mistralai/Leanstral-2603)
73
+ - **Pipeline**: FP8 consolidated → dequant to BF16 → Q8_0 GGUF → Q4_K_M GGUF (with `--allow-requantize`)
74
+ - **Converter**: `convert_hf_to_gguf.py` with `--mistral-format` flag (llama.cpp)
75
+ - **Tokenizer**: Tekken v15 (requires `mistral-common >= 1.10.0` for conversion)
76
+
77
+ ## License
78
+
79
+ Apache 2.0 - same as the original model.
80
+
81
+ ## Credits
82
+
83
+ - Original model by [Mistral AI](https://huggingface.co/mistralai)
84
+ - Quantized by [jackcloudman](https://huggingface.co/jackcloudman)