Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,100 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: apache-2.0
|
| 3 |
-
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
---
|
| 4 |
+
# HRWKV7-Reka-Flash3.1-Preview
|
| 5 |
+
|
| 6 |
+
<div align="center">
|
| 7 |
+
<img src="./hxa079.png" style="border-radius: 15px; width: 60%; height: 60%; object-fit: cover; box-shadow: 10px 10px 20px rgba(0, 0, 0, 0.5); border: 2px solid white;" alt="PRWKV" />
|
| 8 |
+
</div>
|
| 9 |
+
|
| 10 |
+
### Model Description
|
| 11 |
+
|
| 12 |
+
HRWKV7-Reka-Flash3.1-Preview is an RNN hybrid architecture model that combines RWKV v7's linear attention mechanism with Group Query Attention (GQA) layers. Built upon the Reka-flash3.1 21B foundation, this model replaces most Transformer attention blocks with RWKV blocks while strategically maintaining some GQA layers to enhance performance on specific tasks.
|
| 13 |
+
|
| 14 |
+
- **Developed by:** OpenMOSE
|
| 15 |
+
- **Model type:** Hybrid Linear-Attention Language Model
|
| 16 |
+
- **Language(s):** Multilingual (inherited from Reka-flash3.1 21B)
|
| 17 |
+
- **License:** Apache-2.0
|
| 18 |
+
- **Base Model:** Reka-flash3 21B(https://huggingface.co/RekaAI/reka-flash-3.1)
|
| 19 |
+
- **Year:** 2025
|
| 20 |
+
|
| 21 |
+
### Architecture Specifications
|
| 22 |
+
|
| 23 |
+
- **Architecture:** RWKV v7 based "hxa079" Architecture + Group Query Attention Hybrid
|
| 24 |
+
- **Total Layers:** 44 layers (L44D6114)
|
| 25 |
+
- 38 RWKV layers (with Rope)
|
| 26 |
+
- 6 GQA layers (No Rope, No Position Embeddings)
|
| 27 |
+
- **Hidden Dimension:** 6144
|
| 28 |
+
- **Training Context Window:** 4096 tokens
|
| 29 |
+
- **Inference Context Window** 32768+
|
| 30 |
+
- **Training Strategy** Following RADLADS method based knowledge distillation
|
| 31 |
+
|
| 32 |
+
## Technical Innovation
|
| 33 |
+
|
| 34 |
+
### RWKV "hxa079" Architecture
|
| 35 |
+
|
| 36 |
+
The model implements several key improvements over original RWKV architectures:
|
| 37 |
+
|
| 38 |
+
1. **Token Shift Removal**: In order to effectively inherit the teacher model weights, we removed the residual connection one token ago.
|
| 39 |
+
2. **GroupNorm Removal**: Helps improve training stability issues
|
| 40 |
+
3. **k_first Introduction**: Experimentally adopted the approach of residually connecting k layers in layer 0.
|
| 41 |
+
|
| 42 |
+
### Hybrid Design Benefits
|
| 43 |
+
|
| 44 |
+
- **Linear Attention Inference**: RWKV blocks enable O(1) memory complexity during inference, and the hybrid approach reduces the KVCache to 1/7 of full GQA.
|
| 45 |
+
- **Enhanced Needle Tasks**: Strategic placement of GQA layers significantly improves performance on needle-in-haystack retrieval tasks, addressing a known limitation of pure linear attention models
|
| 46 |
+
- **Implicit Position Encoding**: Interestingly, the model achieves better performance when RoPE (Rotary Position Embedding) is not applied to GQA layers, suggesting that RWKV blocks provide implicit positional encoding capabilities
|
| 47 |
+
|
| 48 |
+
## Intended Use
|
| 49 |
+
|
| 50 |
+
This is an **experimental research model** designed to explore hybrid architectures combining linear and quadratic attention mechanisms. It is intended for:
|
| 51 |
+
|
| 52 |
+
- Research into efficient attention mechanisms
|
| 53 |
+
- Benchmarking hybrid architecture performance
|
| 54 |
+
- Exploring linear attention limitations and solutions
|
| 55 |
+
- Academic and industrial R&D purposes
|
| 56 |
+
|
| 57 |
+
## Limitations
|
| 58 |
+
|
| 59 |
+
- **Experimental Status**: This model is in experimental stages and may exhibit unexpected behaviors
|
| 60 |
+
- **Context Window**: Limited to 4096 tokens during training, though RWKV architecture theoretically supports longer sequences
|
| 61 |
+
- **Performance Variability**: As a hybrid model, performance may vary significantly across different task types
|
| 62 |
+
|
| 63 |
+
## Training Details
|
| 64 |
+
|
| 65 |
+
- **Training Context Window:** 4096 tokens
|
| 66 |
+
- **Training GPU** AMD MI300X x 1(takes 70hrs) AMD Developer Cloud.
|
| 67 |
+
- **Training Strategy** 8bit MLP Quant, frozen emb,mlp,head, Deepspeed Stage1, Stage1 100M, Stage2 360M
|
| 68 |
+
- **Base Model Initialization:** Weights initialized from Reka-flash3.1 21B
|
| 69 |
+
- **Architecture Conversion:** Transformer attention blocks systematically replaced with RWKV blocks, except for 6 strategically placed GQA layers
|
| 70 |
+
|
| 71 |
+
## Evaluation
|
| 72 |
+
|
| 73 |
+
Performance evaluation is ongoing. The model shows promising results in:
|
| 74 |
+
- Maintaining base model capabilities while achieving linear attention efficiency
|
| 75 |
+
- Significantly improved needle-in-haystack task performance compared to pure RWKV architectures
|
| 76 |
+
- Competitive performance on standard language modeling benchmarks
|
| 77 |
+
|
| 78 |
+
|
| 79 |
+
## Run
|
| 80 |
+
- RWKV-Infer now support hxa079
|
| 81 |
+
```bash
|
| 82 |
+
curl http://127.0.0.1:9000/loadmodel -X POST -H "Content-Type: application/json" -d '{"model_filename":"/home/client/Projects/llm/hxa079-reka-flash3-stage2-hybrid.pth","model_viewname":"RWKV HXA079 L38T6 Reka Flash3","model_strategy":"int8","adapter_filename":"","adapter_mode":"", "template":"rekaflash3", "endtoken":"\n <sep>","default_temperature":"0.2", "default_top_p":"0.3", "rope_theta":"8000000.0", "rms_norm_eps":"1e-5"}'
|
| 83 |
+
|
| 84 |
+
```
|
| 85 |
+
|
| 86 |
+
## Thank you for Big help :)
|
| 87 |
+
- SmerkyG Inspired by RADLADS (https://arxiv.org/abs/2505.03005)
|
| 88 |
+
- https://github.com/recursal/RADLADS-paper
|
| 89 |
+
|
| 90 |
+
## Training Code
|
| 91 |
+
- https://github.com/OpenMOSE/RWKVInside (still buggy)
|
| 92 |
+
|
| 93 |
+
|
| 94 |
+
## Model Card Contact
|
| 95 |
+
|
| 96 |
+
OpenMOSE - 2025
|
| 97 |
+
|
| 98 |
+
---
|
| 99 |
+
|
| 100 |
+
*Note: This is an experimental model. Performance characteristics and behaviors may differ from both pure RWKV and standard Transformer architectures. Users should thoroughly evaluate the model for their specific use cases.*
|