File size: 7,295 Bytes
34715b1
 
 
 
 
 
 
 
 
 
cd111f6
 
 
34715b1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6a86cc6
34715b1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
cd111f6
34715b1
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
---
license: agpl-3.0
base_model:
- meta-llama/Llama-3.1-8B-Instruct
---

# 🧠 Lumo-8B-Instruct Model

![Lumo](https://i.ibb.co/nwzzD4B/logo.png)

[![Lumo-8B-DS-Instruct](https://img.shields.io/badge/Lumo-8B--Instruct-blueviolet?style=flat-square&logo=openai&logoColor=white)](https://huggingface.co/datasets/lumolabs-ai/Lumo-8B-DS-Instruct)
[![License](https://img.shields.io/badge/license-AGPL%20v3-blue?style=flat-square)](https://www.gnu.org/licenses/agpl-3.0.html)
[![HF](https://img.shields.io/badge/HuggingFace-Lumo--8B--Instruct-orange?style=flat-square&logo=huggingface)](https://huggingface.co/lumolabs-ai/Lumo-8B-Instruct)

## **Overview**

The **Lumo-8B-Instruct** model is a fine-tuned version of Meta's LLaMa 3.1 8B model designed to provide highly accurate and contextual assistance for developers working on Solana and its associated ecosystems. This model is capable of answering complex questions, generating code snippets, debugging, and explaining technical concepts using state-of-the-art **instruction tuning** techniques.

### 🎯 **Key Features**
- Optimized for **Solana-specific queries** across ecosystems like Raydium, Helius, Jito, and more.
- Instruction fine-tuned for **developer-centric workflows**.
- Lightweight parameter-efficient fine-tuning via **LoRA (Low-Rank Adaptation)**.
- **Supports multi-turn conversations** with context retention.
- Outputs complete code snippets and **real-world usage examples**.

---

## πŸš€ **Model Card**

| **Parameter**              | **Details**                                                                                  |
|----------------------------|----------------------------------------------------------------------------------------------|
| **Base Model**             | Meta LLaMa 3.1 8B                                                                            |
| **Fine-Tuning Framework**  | HuggingFace Transformers, LoRA                                                               |
| **Dataset Size**           | 5,502 high-quality Q&A pairs                                                               |
| **Context Length**         | 4,096 tokens                                                                                 |
| **Training Steps**         | 10,000                                                                                       |
| **Learning Rate**          | 3e-4                                                                                        |
| **Batch Size**             | 1 per GPU with gradient accumulation                                                         |
| **Epochs**                 | 2                                                                                           |
| **Model Size**             | 8 billion parameters (adapter size ~10 MB)                                                  |
| **Pre-trained Tasks**      | Instruction following, Code generation, Debugging, Multi-turn Q&A                            |

---

## πŸ“Š **Model Architecture**

### **Training Workflow**
The model was fine-tuned using parameter-efficient methods with **LoRA** to adapt to the Solana-specific domain. Below is a visualization of the training process:

```
+---------------------------+               +-------------------------+
|       Base Model          |  --- LoRA -->|  Fine-Tuned Adapter     |
|    LLaMa 3.1 8B           |               | Lumo-8B-Instruct        |
+---------------------------+               +-------------------------+
```

### **Dataset Sources**
The dataset comprises curated documentation, cookbooks, and API references from the following sources:

| Source             | Links                                                                          |
|--------------------|--------------------------------------------------------------------------------|
| **Solana Docs**    | [Documentation](https://solana.com/docs), [Cookbook](https://solana.com/developers/cookbook) |
| **Raydium Docs**   | [Documentation](https://docs.raydium.io/raydium)                              |
| **Helius**         | [Docs](https://docs.helius.dev)                                               |
| **QuickNode**      | [Docs](https://www.quicknode.com/docs/solana)                                 |
| **Magic Eden**     | [Docs](https://docs.magiceden.io)                                             |

---

## πŸ› οΈ **Installation and Usage**

### **1. Installation**

```bash
pip install transformers datasets peft wandb
```

### **2. Load the Model**

```python
from transformers import LlamaForCausalLM, AutoTokenizer

model_name = "lumolabs-ai/Lumo-8B-Instruct"

model = LlamaForCausalLM.from_pretrained(model_name)
tokenizer = AutoTokenizer.from_pretrained(model_name)
```

### **3. Run Inference**

```python
def complete_chat(model, tokenizer, messages, max_new_tokens=128):
    inputs = tokenizer.apply_chat_template(messages, return_tensors="pt", return_dict=True, add_generation_prompt=True).to(model.device)
    with torch.no_grad():
        outputs = model.generate(**inputs, max_new_tokens=max_new_tokens)
    return tokenizer.decode(outputs[0], skip_special_tokens=True)

response = complete_chat(model, tokenizer, [
    {"role": "system", "content": "You are Lumo, a helpful assistant."},
    {"role": "user", "content": "Explain how to interact with Raydium API for token swaps."}
])
print(response)
```

---

## πŸ“ˆ **Performance**

| **Metric**          | **Value**             |
|---------------------|-----------------------|
| **Validation Loss** | 1.73                 |
| **BLEU Score**      | 89%                  |
| **Code Accuracy**   | 92%                  |
| **Token Efficiency**| ~4,096 tokens max    |

### **Fine-Tuning Loss Graph**
![Loss Graph](https://i.ibb.co/PM6rKtc/Screenshot-2025-01-15-at-10-55-08-PM.png)

---

## πŸ“‚ **Dataset**

| Split   | Count  | Description                    |
|---------|--------|--------------------------------|
| **Train** | 5,502 | High-quality Q&A pairs        |
| **Test**  | 276   | Evaluation dataset for testing|

**Dataset Format (JSONL):**
```json
{
  "question": "How to use the Helius API for transaction indexing?",
  "answer": "To index transactions, use Helius's Webhooks API ...",
  "chunk": "Helius API allows you to set up ..."
}
```

---

## πŸ” **Technical Insights**

### **LoRA Configuration**
- Rank: 8
- Alpha: 32
- Dropout: 0.01
- Adapter Size: ~10 MB

### **Optimization**
- Mixed Precision (FP16) for faster inference.
- Gradient Accumulation for memory efficiency.
- Parameter-efficient tuning to preserve base model knowledge.

---

## 🌟 **Try the model**

πŸš€ [Lumo-8B-Instruct Inferencing](https://www.lumolabs.ai/using-the-model/how-to-inference)

---

## πŸ™Œ **Contributing**

We welcome contributions to enhance the Lumo-8B-Instruct model. Feel free to:
- Share your feedback on the HuggingFace Model Hub.

---

## πŸ“œ **License**

This model is licensed under the **GNU Affero General Public License v3.0 (AGPLv3).**

---

## πŸ“ž **Community**

For questions or support, reach out via:
- **Twitter**: [Lumo Labs](https://x.com/lumolabsdotai)

---

## 🀝 **Acknowledgments**

Special thanks to the Solana ecosystem developers and the open-source community for their invaluable contributions and support.