Soulfate24 commited on
Commit
204efac
Β·
verified Β·
1 Parent(s): cb4574f

Upload 3 files

Browse files
Files changed (2) hide show
  1. README.md +11 -0
  2. USAGE.md +150 -0
README.md CHANGED
@@ -70,6 +70,15 @@ All tiers maintain strict byte-budget percentages relative to the original unqua
70
 
71
  *Note: Models originating from an AutoRound int4 lineage cap their weight allocations at the Quality tier (`Q5_K`/`Q4_K` mix), as theoretical information saturation is fully realized.*
72
 
 
 
 
 
 
 
 
 
 
73
  ---
74
 
75
  ## πŸ› οΈ Suite Components
@@ -120,6 +129,8 @@ The AutoRound + ASHQ1 suite builds directly upon fundamental research and toolin
120
 
121
  * **ASHQ1 (Autonomous Selective Hybrid Quantization)** by **[wepiqx](https://huggingface.co/wepiqx/ASHQ1)**:
122
  Original mathematical formulation of the priority-queue-driven knapsack optimizer, tied-group detection using numerical activation hashes, and theoretical MSE reduction scheduling.
 
 
123
  * **Intel AutoRound**:
124
  Sign-gradient-based optimization framework for low-bit weight reorganization with Hessian compensation.
125
  * **llama.cpp** by **[Georgi Gerganov & ggml contributors](https://github.com/ggml-org/llama.cpp)**:
 
70
 
71
  *Note: Models originating from an AutoRound int4 lineage cap their weight allocations at the Quality tier (`Q5_K`/`Q4_K` mix), as theoretical information saturation is fully realized.*
72
 
73
+ ### 🎯 Recommended Minimum Tiers by Model Size
74
+
75
+ Smaller parameter architectures require higher relative bit precision to prevent degradation of core reasoning representations:
76
+
77
+ * **β‰₯ 9B Parameters**: **Mini** (27% ratio) β€” Large parameter capacity preserves semantic integrity at lower bit rates.
78
+ * **~ 4B Parameters**: **Compact** (30% ratio) β€” Optimal balance between memory footprint and dense layer preservation.
79
+ * **~ 3B Parameters**: **Quality** (39% ratio) β€” Higher baseline precision protects critical routing and attention projections.
80
+ * **≀ 1B Parameters**: **Fidelity** (48% ratio) β€” Compact architectures require maximum parameter density.
81
+
82
  ---
83
 
84
  ## πŸ› οΈ Suite Components
 
129
 
130
  * **ASHQ1 (Autonomous Selective Hybrid Quantization)** by **[wepiqx](https://huggingface.co/wepiqx/ASHQ1)**:
131
  Original mathematical formulation of the priority-queue-driven knapsack optimizer, tied-group detection using numerical activation hashes, and theoretical MSE reduction scheduling.
132
+ * **Empero AI ([Qwen3.8-27B-Ridge](https://huggingface.co/empero-ai/Qwen3.8-27B-Ridge-GGUF))**:
133
+ Pioneering architectural insights on Gated-DeltaNet (GDN) hybrid attention preservation β€” specifically locking recurrence states (`ssm_alpha`, `ssm_beta`) in `Q8_0` and preserving native Multi-Token Prediction (MTP) draft heads.
134
  * **Intel AutoRound**:
135
  Sign-gradient-based optimization framework for low-bit weight reorganization with Hessian compensation.
136
  * **llama.cpp** by **[Georgi Gerganov & ggml contributors](https://github.com/ggml-org/llama.cpp)**:
USAGE.md ADDED
@@ -0,0 +1,150 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ASHQ1 Suite User Manual & Workflow Guide
2
+
3
+ A step-by-step practical guide for processing unquantized checkpoints into production-ready ASHQ1 GGUF models.
4
+
5
+ ---
6
+
7
+ ## πŸ“ 1. Directory Structure Setup
8
+
9
+ Place the suite scripts in a unified working directory:
10
+
11
+ ```
12
+ workspace/
13
+ β”œβ”€β”€ 00_SAFETENSORS-to-AutoRound-BF16-GGUF.py
14
+ β”œβ”€β”€ 00b_BF16-GGUF-MTP-extract.py
15
+ β”œβ”€β”€ 01_create-calibration-dataset-and-imatrix.py
16
+ β”œβ”€β”€ 01b_BF16-GGUF-modules-fusion.py
17
+ β”œβ”€β”€ 02_BF16-GGUF-to-ASHQ1.py
18
+ β”œβ”€β”€ ASHQ1.py
19
+ β”œβ”€β”€ ASHQ1-mmproj.py
20
+ β”œβ”€β”€ llama-cpp/ # Cloned or linked llama.cpp repository
21
+ β”‚ β”œβ”€β”€ convert_hf_to_gguf.py
22
+ β”‚ β”œβ”€β”€ llama-quantize.exe
23
+ β”‚ └── llama-imatrix.exe
24
+ └── safetensors/ # HuggingFace model source files
25
+ β”œβ”€β”€ config.json
26
+ β”œβ”€β”€ model.safetensors.index.json
27
+ └── *.safetensors
28
+ ```
29
+
30
+ ---
31
+
32
+ ## πŸš€ 2. Step-by-Step Execution Workflow
33
+
34
+ ### Step 0: Optimize Weights & Build Pristine BF16 GGUF
35
+ Run script `00` to optimize the raw model via AutoRound W4A16 and produce initial GGUF files:
36
+
37
+ ```bash
38
+ # Standard execution (reads ./safetensors by default)
39
+ python 00_SAFETENSORS-to-AutoRound-BF16-GGUF.py
40
+
41
+ # Explicit path targeting
42
+ python 00_SAFETENSORS-to-AutoRound-BF16-GGUF.py /path/to/my-model
43
+
44
+ # Advanced flags
45
+ python 00_SAFETENSORS-to-AutoRound-BF16-GGUF.py --iters 50 --batch-size 4 --mtp-gguf
46
+ ```
47
+
48
+ **Generated Outputs**:
49
+ * `model-BF16.gguf`: Complete full model (including MTP head if present).
50
+ * `model-no-mtp-BF16.gguf`: Base model trunk (used for calibration calculation).
51
+ * `model-BF16.provenance.json`: Lineage record certifying AutoRound conditioning.
52
+ * `mmproj-BF16.gguf`: Vision projector (for multimodal checkpoints).
53
+
54
+ ---
55
+
56
+ ### Step 1: Compute Activation Importance Matrix (Imatrix)
57
+ Run script `01` to construct the multi-source calibration dataset and calculate activation statistics:
58
+
59
+ ```bash
60
+ # Standard workflow using default balanced calibration corpus
61
+ python 01_create-calibration-dataset-and-imatrix.py
62
+
63
+ # Use advanced reasoning corpus (experimental.txt)
64
+ python 01_create-calibration-dataset-and-imatrix.py --experimental
65
+
66
+ # Force execution on CPU for systems without dedicated GPU VRAM
67
+ python 01_create-calibration-dataset-and-imatrix.py --cpu-only
68
+ ```
69
+
70
+ **Generated Outputs**:
71
+ * `imatrix.dat`: Activation variance table for each layer.
72
+
73
+ ---
74
+
75
+ ### Step 2: Batch Quantization to ASHQ1 Tiers
76
+ Run script `02` to orchestrate multi-tier quantization:
77
+
78
+ ```bash
79
+ # Quantize all standard tiers (Nano, Mini, Compact, Quality) + mmproj
80
+ python 02_BF16-GGUF-to-ASHQ1.py
81
+ ```
82
+
83
+ **Targeted Tier Generation**:
84
+ To generate a single tier directly via `ASHQ1.py`:
85
+ ```bash
86
+ python ASHQ1.py --model model-BF16.gguf --imatrix imatrix.dat --tier quality --run
87
+ ```
88
+
89
+ ---
90
+
91
+ ## 🎯 3. Recommended Minimum Tiers by Model Size
92
+
93
+ Smaller parameter architectures require higher relative bit precision to prevent degradation of core reasoning representations:
94
+
95
+ * **β‰₯ 9B Models**: Select **Mini** (27% ratio) or higher. Large parameter capacity preserves semantic integrity at lower bit rates.
96
+ * **~ 4B Models**: Select **Compact** (30% ratio) or higher. Optimal balance between memory footprint and dense layer preservation.
97
+ * **~ 3B Models**: Select **Quality** (39% ratio) or higher. Higher baseline precision protects critical routing and attention projections.
98
+ * **≀ 1B Models**: Select **Fidelity** (48% ratio) or higher. Compact architectures require maximum parameter density.
99
+
100
+ ---
101
+
102
+ ## πŸŽ›οΈ 4. Environment Variables & Overrides
103
+
104
+ Configure runtime behavior via optional environment variables:
105
+
106
+ | Variable | Values | Purpose |
107
+ | :--- | :---: | :--- |
108
+ | `ASHQ1_LINEAGE` | `auto`, `autoround`, `plain` | Overrides the file naming lineage tag. |
109
+ | `ASHQ1_INCLUDE_FIDELITY` | `1`, `0` | Forces generation of the 48% Fidelity tier on int4 lineage models. |
110
+ | `GGML_CUDA_ENABLE_UNIFIED_MEMORY` | `1`, `0` | Enables CUDA unified memory for large activation processing in `llama-imatrix`. |
111
+ | `LLAMA_CPP_DIR` | `/path/to/llama.cpp` | Specifies custom path to `llama.cpp` binaries. |
112
+
113
+ ---
114
+
115
+ ## 🧩 5. Module Fusion & Specialized Utilities
116
+
117
+ ### Fusing Multimodal & Speculative Heads (`01b`)
118
+ Combine standalone models with vision projectors and speculative heads into a unified deployable GGUF:
119
+ ```bash
120
+ python 01b_BF16-GGUF-modules-fusion.py fused-model-Quality.gguf model-AutoRound-ASHQ1-Quality-39pc.gguf mmproj-ASHQ1-Balanced-72pc.gguf
121
+ ```
122
+
123
+ ### Standalone MTP Head Extraction (`00b`)
124
+ Extract the NextN speculative draft layer from any full GGUF:
125
+ ```bash
126
+ python 00b_BF16-GGUF-MTP-extract.py model-BF16.gguf model-no-mtp-BF16.gguf mtp-BF16.gguf --keep-index
127
+ ```
128
+
129
+ ### Standalone Vision Quantization (`ASHQ1-mmproj`)
130
+ Quantize vision projectors with customized preservation profiles:
131
+ ```bash
132
+ python ASHQ1-mmproj.py --model mmproj-BF16.gguf --profile balanced --deep-boost 3
133
+ ```
134
+
135
+ ---
136
+
137
+ ## πŸ’‘ 6. Best Practices for Deployment
138
+
139
+ 1. **Host-Side Embedding Offload**:
140
+ ASHQ1 places the input token embedding in `Q8_0` (or `Q5_K` on int4 lineage) outside the VRAM budget, leveraging system RAM bandwidth during prompt ingestion.
141
+ 2. **Context Cache Quantization**:
142
+ Pair ASHQ1 models with quantized key-value caches to preserve GPU memory headroom across long context windows:
143
+ ```bash
144
+ llama-server -m model-AutoRound-ASHQ1-Quality-39pc.gguf -c 32768 --cache-type-k q4_0 --cache-type-v q4_0 -ngl 99
145
+ ```
146
+ 3. **Speculative Decoding**:
147
+ Serve the extracted `mtp-*.gguf` alongside the main model to achieve high-speed speculative draft verification:
148
+ ```bash
149
+ llama-server -m model-AutoRound-ASHQ1-Quality-39pc.gguf --spec-type draft-mtp --spec-draft-n-max 6 -c 16384 -ngl 99
150
+ ```