File size: 3,021 Bytes
f2e0890
29f9089
 
 
 
 
 
 
 
 
 
 
f2e0890
29f9089
f2e0890
 
29f9089
f2e0890
29f9089
f2e0890
29f9089
f2e0890
29f9089
f2e0890
29f9089
 
f2e0890
29f9089
f2e0890
29f9089
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
license: apache-2.0
language:
- en
- it
tags:
- qwen3
- qlora
- fine-tuned
- instruction-tuning
- peft
- safetensors
library_name: peft
base_model: Qwen/Qwen3-4B-Base
---

# Nexus Plus v2

A **4.05B parameter** causal language model fine-tuned from [Qwen3-4B-Base](https://huggingface.co/Qwen/Qwen3-4B-Base) using QLoRA on ~50k instruction examples.

## Try it Online

Test the model directly in your browser:

[![Try Chat](https://img.shields.io/badge/Try%20Live-Streamlit-FF4B4B?logo=streamlit&logoColor=white)](https://try-nexus-ai.streamlit.app)
[![GitHub](https://img.shields.io/badge/View%20Source-181717?logo=github)](https://github.com/JustScriptzz/nexus-smAll-web)

## Model Details

| Parameter | Value |
|-----------|-------|
| Base model | Qwen/Qwen3-4B-Base |
| Total parameters | 4.05B |
| Trainable parameters | 33M (LoRA) |
| LoRA rank | 16 |
| LoRA alpha | 32 |
| Target modules | q_proj, v_proj |
| Quantization | 4-bit (QLoRA) |
| Precision | BF16 |

## How to Use

### With PEFT (adapters only)

```python
from peft import PeftModel
from transformers import AutoModelForCausalLM, AutoTokenizer

base_model = AutoModelForCausalLM.from_pretrained(
    "Qwen/Qwen3-4B-Base",
    torch_dtype="auto",
    device_map="auto"
)
model = PeftModel.from_pretrained(base_model, "JustScriptzz/nexus-plus-v2")
tokenizer = AutoTokenizer.from_pretrained("JustScriptzz/nexus-plus-v2")

messages = [
    {"role": "user", "content": "What is Python?"}
]
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(text, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=512)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
```

### Merged model (recommended)

This repo contains the fully merged model (LoRA weights baked into base). No PEFT needed:

```python
from transformers import AutoModelForCausalLM, AutoTokenizer

model = AutoModelForCausalLM.from_pretrained(
    "JustScriptzz/nexus-plus-v2",
    torch_dtype="auto",
    device_map="auto"
)
tokenizer = AutoTokenizer.from_pretrained("JustScriptzz/nexus-plus-v2")

messages = [
    {"role": "user", "content": "What is Python?"}
]
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(text, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=512)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
```

## Training

- **Base model**: Qwen3-4B-Base (4.05B params, 4-bit quantized)
- **Dataset**: ~50k instruction examples (Dolly-15k, synthetic QA, general instruction data)
- **Method**: QLoRA (rank 16, alpha 32, targeting q_proj and v_proj)
- **Hardware**: RTX 5060 Ti 16GB
- **Training time**: ~7 hours
- **Steps**: 5,634
- **Final loss**: 1.45

## Limitations

- Fine-tuned on a relatively small dataset
- May not generalize well to all domains
- Best used as a learning experiment or starting point for further fine-tuning

## License

Apache 2.0