Add comprehensive README for GGUF models
Browse files
README.md
CHANGED
|
@@ -1,167 +1,120 @@
|
|
| 1 |
---
|
| 2 |
-
license:
|
| 3 |
-
license_name: iquestcoder
|
| 4 |
-
license_link: https://huggingface.co/IQuestLab/IQuest-Coder-V1-40B-Loop-Instruct
|
| 5 |
-
base_model: IQuestLab/IQuest-Coder-V1-40B-Loop-Instruct
|
| 6 |
tags:
|
| 7 |
-
-
|
| 8 |
-
-
|
| 9 |
- loop-attention
|
| 10 |
-
-
|
| 11 |
-
-
|
| 12 |
-
- iquest
|
| 13 |
language:
|
| 14 |
- en
|
| 15 |
pipeline_tag: text-generation
|
| 16 |
---
|
| 17 |
|
| 18 |
-
# IQuest-Coder-V1-40B-Loop-Instruct
|
| 19 |
|
| 20 |
-
|
|
|
|
| 21 |
|
| 22 |
-
## Model
|
| 23 |
-
|
| 24 |
-
- **Base Model**: [IQuestLab/IQuest-Coder-V1-40B-Loop-Instruct](https://huggingface.co/IQuestLab/IQuest-Coder-V1-40B-Loop-Instruct)
|
| 25 |
-
- **Architecture**: Llama with Loop Attention (recurrent transformer, 2 iterations)
|
| 26 |
-
- **Parameters**: 40B
|
| 27 |
-
- **Context Length**: 131,072 tokens
|
| 28 |
-
- **Vocabulary**: 76,800 tokens
|
| 29 |
-
- **Conversion Date**: 2026-01-07
|
| 30 |
-
- **Converted By**: Avarok (Dual NVIDIA DGX Spark with GB10 GPUs)
|
| 31 |
|
| 32 |
-
|
| 33 |
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
| `IQuest-Coder-V1-40B-Loop-Instruct-q8_0.gguf` | 40GB | Q8_0 | Excellent quality, minimal loss |
|
| 38 |
-
| `IQuest-Coder-V1-40B-Loop-Instruct-q5_k_m.gguf` | 27GB | Q5_K_M | Good quality balance |
|
| 39 |
-
| `IQuest-Coder-V1-40B-Loop-Instruct-q4_k_m.gguf` | 23GB | Q4_K_M | **RECOMMENDED** - Best size/quality balance |
|
| 40 |
|
| 41 |
-
##
|
| 42 |
|
| 43 |
```
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
a15814998038c8c6334f69bc11b776bce785350c933ce95fe9c41c4c7ec708ba IQuest-Coder-V1-40B-Loop-Instruct-q5_k_m.gguf
|
| 47 |
-
b665999c8d6660ba0ea29cbbb072056052ef965a233ef65661ec16a16b39a9e3 IQuest-Coder-V1-40B-Loop-Instruct-q4_k_m.gguf
|
| 48 |
```
|
| 49 |
|
| 50 |
-
##
|
| 51 |
-
|
| 52 |
-
⚠️ **IMPORTANT**: These GGUF files contain all loop attention tensors and metadata, but **runtime support is pending** in llama.cpp.
|
| 53 |
-
|
| 54 |
-
**What Works**:
|
| 55 |
-
- ✅ GGUF files load correctly
|
| 56 |
-
- ✅ All 883 tensors preserved (721 standard + 160 loop gates + 2 embeddings)
|
| 57 |
-
- ✅ Loop parameters stored in metadata (loop_num=2, loop_window_size=64)
|
| 58 |
-
- ✅ Quantization tested and verified
|
| 59 |
-
|
| 60 |
-
**What's Pending**:
|
| 61 |
-
- ⏳ Loop attention runtime implementation in llama.cpp
|
| 62 |
-
- ⏳ Inference will fail until runtime support added
|
| 63 |
-
|
| 64 |
-
## Technical Details
|
| 65 |
-
|
| 66 |
-
### Loop Architecture
|
| 67 |
|
| 68 |
-
|
| 69 |
-
- **loop_num**: 2 iterations of attention per layer
|
| 70 |
-
- **loop_window_size**: 64 token attention window
|
| 71 |
-
- **Gate Projections**: 160 additional tensors for gating mechanism
|
| 72 |
-
- `blk.-79.loop_gate.weight`: [128, 40] per layer
|
| 73 |
-
- `blk.-79.loop_gate.bias`: [40] per layer
|
| 74 |
|
| 75 |
-
|
| 76 |
|
| 77 |
-
|
| 78 |
-
- Inherits from LlamaModel (compatible base architecture)
|
| 79 |
-
- Maps gate_projections to GGUF tensor names
|
| 80 |
-
- Preserves loop parameters in metadata
|
| 81 |
-
- Tested with all quantization levels
|
| 82 |
|
| 83 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
|
| 85 |
-
#
|
|
|
|
|
|
|
|
|
|
| 86 |
|
| 87 |
-
#
|
|
|
|
| 88 |
|
| 89 |
-
|
| 90 |
-
|
| 91 |
-
cat > Modelfile <<EOF
|
| 92 |
-
FROM IQuest-Coder-V1-40B-Loop-Instruct-q4_k_m.gguf
|
| 93 |
-
PARAMETER temperature 0.7
|
| 94 |
-
PARAMETER top_p 0.9
|
| 95 |
-
EOF
|
| 96 |
-
|
| 97 |
-
# Create model
|
| 98 |
-
ollama create iquest-loop:q4 -f Modelfile
|
| 99 |
-
|
| 100 |
-
# Run
|
| 101 |
-
ollama run iquest-loop:q4 "Write a Python function for fibonacci"
|
| 102 |
```
|
| 103 |
|
| 104 |
-
##
|
| 105 |
-
|
| 106 |
-
```bash
|
| 107 |
-
./llama-cli \
|
| 108 |
-
--model IQuest-Coder-V1-40B-Loop-Instruct-q4_k_m.gguf \
|
| 109 |
-
--prompt "def fibonacci(n):" \
|
| 110 |
-
--n-predict 100
|
| 111 |
-
```
|
| 112 |
|
| 113 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
|
| 115 |
-
##
|
| 116 |
|
| 117 |
-
|
| 118 |
|
| 119 |
-
|
| 120 |
-
-
|
| 121 |
-
-
|
| 122 |
-
- Tested with 40B parameter model
|
| 123 |
-
- All quantization levels verified
|
| 124 |
|
| 125 |
-
|
|
|
|
|
|
|
| 126 |
|
| 127 |
-
|
| 128 |
-
1. C++ implementation of loop attention mechanism
|
| 129 |
-
2. CUDA kernels for GPU acceleration
|
| 130 |
-
3. Integration into llama.cpp forward pass
|
| 131 |
-
4. Testing against PyTorch reference
|
| 132 |
|
| 133 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 134 |
|
| 135 |
-
##
|
| 136 |
|
| 137 |
-
|
| 138 |
-
- **Runtime Development**: Community contribution welcome
|
| 139 |
-
- **Technical Documentation**: Included in this repository
|
| 140 |
|
| 141 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 142 |
|
| 143 |
-
|
| 144 |
-
- **Conversion Guide**: See `CONVERSION_SUMMARY.md`
|
| 145 |
-
- **Runtime Guide**: See `RUNTIME_IMPLEMENTATION_GUIDE.md`
|
| 146 |
-
- **llama.cpp Issue**: [#18517](https://github.com/ggerganov/llama.cpp/issues/18517)
|
| 147 |
-
- **vLLM Support**: [PR #31575](https://github.com/vllm-project/vllm/pull/31575)
|
| 148 |
|
| 149 |
-
|
| 150 |
|
| 151 |
-
|
| 152 |
-
- **Conversion**: Avarok (Dual DGX Spark hardware)
|
| 153 |
-
- **Tools**: llama.cpp (ggerganov), vLLM project
|
| 154 |
-
- **Achievement**: First Loop-Instruct variant in GGUF format
|
| 155 |
|
| 156 |
-
|
| 157 |
|
| 158 |
-
|
| 159 |
-
|
|
|
|
| 160 |
|
| 161 |
-
##
|
| 162 |
|
| 163 |
-
This is the first
|
| 164 |
|
| 165 |
---
|
| 166 |
|
| 167 |
-
**
|
|
|
|
| 1 |
---
|
| 2 |
+
license: apache-2.0
|
|
|
|
|
|
|
|
|
|
| 3 |
tags:
|
| 4 |
+
- code
|
| 5 |
+
- llama
|
| 6 |
- loop-attention
|
| 7 |
+
- gguf
|
| 8 |
+
- llama.cpp
|
|
|
|
| 9 |
language:
|
| 10 |
- en
|
| 11 |
pipeline_tag: text-generation
|
| 12 |
---
|
| 13 |
|
| 14 |
+
# IQuest-Coder-V1-40B-Loop-Instruct GGUF
|
| 15 |
|
| 16 |
+
This repository contains GGUF format models for [IQuestLab/IQuest-Coder-V1-40B-Loop-Instruct](https://huggingface.co/IQuestLab/IQuest-Coder-V1-40B-Loop-Instruct),
|
| 17 |
+
optimized for use with llama.cpp.
|
| 18 |
|
| 19 |
+
## Model Architecture
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
+
This model implements **Loop Attention**, a novel recurrent attention mechanism that processes all layers multiple times:
|
| 22 |
|
| 23 |
+
- **loop_num=2**: All 80 transformer layers are processed twice (160 total operations)
|
| 24 |
+
- **Loop 0**: Standard attention with global K/V caching
|
| 25 |
+
- **Loop 1**: Dual attention (local + global) with learned per-head gating
|
|
|
|
|
|
|
|
|
|
| 26 |
|
| 27 |
+
### Loop Attention Formula
|
| 28 |
|
| 29 |
```
|
| 30 |
+
gate = sigmoid(sum(Q * gate_weight) + gate_bias)
|
| 31 |
+
output = local_attn + gate * (global_attn - local_attn)
|
|
|
|
|
|
|
| 32 |
```
|
| 33 |
|
| 34 |
+
## llama.cpp Support
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
|
| 36 |
+
**IMPORTANT**: Loop attention support requires a custom branch of llama.cpp.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
|
| 38 |
+
See PR: https://github.com/ggml-org/llama.cpp/pull/18680
|
| 39 |
|
| 40 |
+
### Quick Start
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
|
| 42 |
+
```bash
|
| 43 |
+
# Clone llama.cpp with loop attention support
|
| 44 |
+
git clone https://github.com/tbraun96/llama.cpp
|
| 45 |
+
cd llama.cpp
|
| 46 |
+
git checkout feature/iquest-loop-attention
|
| 47 |
|
| 48 |
+
# Build
|
| 49 |
+
mkdir build && cd build
|
| 50 |
+
cmake .. -DGGML_CUDA=ON
|
| 51 |
+
cmake --build . --config Release -j$(nproc)
|
| 52 |
|
| 53 |
+
# Download a quantized model
|
| 54 |
+
huggingface-cli download Avarok/IQuest-Coder-V1-40B-Loop-Instruct-GGUF IQuest-Coder-V1-40B-Loop-Instruct-Q4_K_M.gguf --local-dir .
|
| 55 |
|
| 56 |
+
# Run inference
|
| 57 |
+
./bin/llama-cli -m IQuest-Coder-V1-40B-Loop-Instruct-Q4_K_M.gguf -p "def fibonacci(n):" -n 200
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
```
|
| 59 |
|
| 60 |
+
## Available Models
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 61 |
|
| 62 |
+
| Filename | Quantization | Size | Description | Use Case |
|
| 63 |
+
|----------|-------------|------|-------------|----------|
|
| 64 |
+
| IQuest-Coder-V1-40B-Loop-Instruct-F16.gguf | F16 | 75GB | Unquantized, highest quality | Maximum accuracy |
|
| 65 |
+
| IQuest-Coder-V1-40B-Loop-Instruct-Q8_0.gguf | Q8_0 | 40GB | Very high quality | Near-F16 quality |
|
| 66 |
+
| IQuest-Coder-V1-40B-Loop-Instruct-Q5_K_M.gguf | Q5_K_M | 27GB | High quality | Balanced quality/size |
|
| 67 |
+
| IQuest-Coder-V1-40B-Loop-Instruct-Q4_K_M.gguf | Q4_K_M | 23GB | Good quality | **Recommended** |
|
| 68 |
|
| 69 |
+
## Performance Benchmarks
|
| 70 |
|
| 71 |
+
Tested on NVIDIA GB10 (Blackwell), compute 12.1:
|
| 72 |
|
| 73 |
+
**Q4_K_M (23GB)**:
|
| 74 |
+
- Prompt processing: 106.2 tokens/second
|
| 75 |
+
- Text generation: 4.2 tokens/second
|
|
|
|
|
|
|
| 76 |
|
| 77 |
+
**F16 (75GB)**:
|
| 78 |
+
- Prompt processing: 3.4 tokens/second
|
| 79 |
+
- Text generation: 0.8 tokens/second
|
| 80 |
|
| 81 |
+
## Model Details
|
|
|
|
|
|
|
|
|
|
|
|
|
| 82 |
|
| 83 |
+
- **Base Model**: Llama architecture with loop attention extension
|
| 84 |
+
- **Parameters**: 40B
|
| 85 |
+
- **Context Length**: 32,768 tokens
|
| 86 |
+
- **Training**: Fine-tuned for code generation and instruction following
|
| 87 |
+
- **License**: Apache 2.0
|
| 88 |
|
| 89 |
+
## Citation
|
| 90 |
|
| 91 |
+
If you use this model, please cite:
|
|
|
|
|
|
|
| 92 |
|
| 93 |
+
```bibtex
|
| 94 |
+
@software{iquest_loop_instruct_gguf_2025,
|
| 95 |
+
title={IQuest-Coder-V1-40B-Loop-Instruct GGUF},
|
| 96 |
+
author={IQuestLab and Community Contributors},
|
| 97 |
+
year={2025},
|
| 98 |
+
url={https://huggingface.co/Avarok/IQuest-Coder-V1-40B-Loop-Instruct-GGUF}
|
| 99 |
+
}
|
| 100 |
+
```
|
| 101 |
|
| 102 |
+
## Original Model
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
|
| 104 |
+
Original PyTorch model: [IQuestLab/IQuest-Coder-V1-40B-Loop-Instruct](https://huggingface.co/IQuestLab/IQuest-Coder-V1-40B-Loop-Instruct)
|
| 105 |
|
| 106 |
+
## Conversion
|
|
|
|
|
|
|
|
|
|
| 107 |
|
| 108 |
+
These models were converted using the custom GGUF converter available in the llama.cpp branch above.
|
| 109 |
|
| 110 |
+
```bash
|
| 111 |
+
python convert_hf_to_gguf.py /path/to/IQuest-Coder-V1-40B-Loop-Instruct --outtype f16
|
| 112 |
+
```
|
| 113 |
|
| 114 |
+
## World's First
|
| 115 |
|
| 116 |
+
This is the **world's first implementation** of loop attention in GGUF format, bringing recurrent attention mechanisms to llama.cpp!
|
| 117 |
|
| 118 |
---
|
| 119 |
|
| 120 |
+
**Questions or Issues?** Please open an issue on the [llama.cpp PR](https://github.com/ggml-org/llama.cpp/pull/18680) or the original model repository.
|