File size: 5,878 Bytes
029224a
 
 
 
 
608a98a
 
 
 
 
 
55bbe87
608a98a
 
 
 
 
029224a
 
5ee022e
029224a
608a98a
 
 
029224a
608a98a
971a0bb
 
 
 
 
 
5733fe6
971a0bb
 
 
 
 
608a98a
 
 
 
63e9452
608a98a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55bbe87
 
 
029224a
55bbe87
 
 
608a98a
 
55bbe87
608a98a
55bbe87
029224a
55bbe87
608a98a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55bbe87
029224a
608a98a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6935c63
 
 
 
 
 
 
608a98a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
492cc72
608a98a
 
 
 
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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
---
base_model: Qwen/Qwen2.5-Coder-1.5B-Instruct
library_name: peft
pipeline_tag: text-generation
tags:
  - lora
  - transformers
  - roblox
  - luau
  - code-generation
  - gaming
license: apache-2.0
language:
  - en
  - lua
metrics:
  - perplexity
---

# ๐ŸŽฎ Qwen2.5 Coder 1.5B Roblox

![Roblox](https://img.shields.io/badge/Roblox-Luau-00A2FF?style=for-the-badge&logo=roblox)
![LoRA](https://img.shields.io/badge/LoRA-Adapter-FF6B6B?style=for-the-badge)
![License](https://img.shields.io/badge/License-Apache%202.0-green?style=for-the-badge)

*A specialized code generation model fine-tuned for Roblox Luau programming*

---

### โšก Run in Google Colab (Recommended)
[![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1Sa3EvZOmmCsYQt7GWv1EcjLGcGJVVlUt?usp=sharing)

**No setup required** Click the badge above and run the chatbot instantly in your browser.
- ๐ŸŽฏ Pre-configured environment
- ๐Ÿ”ฅ GPU-accelerated inference
- ๐Ÿ’ฌ Interactive chat interface
- โฑ๏ธ Ready in ~3 minutes

---

## ๐Ÿ“– Overview

**Qwen2.5 Coder 1.5B Roblox** is a parameter-efficient fine-tuned model specifically designed for **Roblox Luau** development. Built on top of Qwen2.5-Coder-1.5B-Instruct, this model excels at generating, completing, and understanding Luau code patterns commonly used in Roblox game development.

### ๐ŸŽฏ What Makes This Special?

- ๐ŸŽฎ **Roblox-Native**: Trained exclusively on authentic Luau code from the official Roblox corpus
- ๐Ÿง  **Context-Aware**: Understands Roblox-specific APIs, patterns, and best practices

---

## ๐Ÿ—๏ธ Model Architecture

| Component | Details |
|-----------|---------|
| **Base Model** | [Qwen/Qwen2.5-Coder-1.5B-Instruct](https://huggingface.co/Qwen/Qwen2.5-Coder-1.5B-Instruct) |
| **Adapter Type** | LoRA (Low-Rank Adaptation) |
| **LoRA Rank** | 8 |
| **LoRA Alpha** | 32 |
| **Target Modules** | `q_proj`, `v_proj` |
| **Training Hardware** | TPU v5e-8 (Multi-core) |

---

## ๐Ÿ“š Training Details

### Dataset
- **Source**: [Roblox/luau_corpus](https://huggingface.co/datasets/Roblox/luau_corpus)
- **Filtering**: Quality-filtered for code length (20-5000 chars) and Luau keyword presence
- **Split**: 90% train / 10% validation

### Training Configuration
```python
{
    "max_length": 1024,
    "batch_size": 4,
    "gradient_accumulation_steps": 32,
    "learning_rate": 3e-5,
    "scheduler": "cosine_annealing",
    "epochs": 1,
    "optimizer": "AdamW"
}
```

---

## ๐Ÿš€ Quick Start

### Installation
```bash
pip install transformers peft torch
```

### Basic Usage
```python
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel

# Load base model
base_model = AutoModelForCausalLM.from_pretrained(
    "Qwen/Qwen2.5-Coder-1.5B-Instruct",
    torch_dtype="auto",
    device_map="auto"
)

tokenizer = AutoTokenizer.from_pretrained("Qwen/Qwen2.5-Coder-1.5B-Instruct")

# Load LoRA adapter
model = PeftModel.from_pretrained(base_model, "umjunsik1323/Qwen2.5-Coder-1.5B-roblox")

# Generate Luau code
messages = [
    {"role": "system", "content": "You are a Roblox Luau programming expert."},
    {"role": "user", "content": "Create a function to make a part glow"}
]

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=256, temperature=0.7)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
```

### Advanced: Merge and Export
```python
# Merge LoRA weights into base model
merged_model = model.merge_and_unload()
merged_model.save_pretrained("./qwen-luau-merged")
```

---

## ๐Ÿ’ก Features

### Supported Tasks
- โœจ **Code Completion**: Finish partial Luau scripts intelligently
- ๐Ÿ”ง **Function Generation**: Create Roblox-specific functions from descriptions
- ๐Ÿ“ **Code Explanation**: Understand and document existing Luau code
- ๐Ÿ› **Error Fixing**: Suggest corrections for common Luau mistakes
- ๐ŸŽฏ **API Usage**: Generate proper Roblox API calls

### Example Prompts
```lua
-- Completion
"local function teleportPlayer(player, position)"
โ†’ Generates complete teleportation logic

-- Generation
"Create a tween that smoothly moves a part to a new position"
โ†’ Generates TweenService implementation

-- Context-Aware
"Handle player damage with a cooldown system"
โ†’ Generates debounce pattern with Humanoid health management
```

---

## ๐ŸŽฏ Use Cases

### Game Development
- Quick prototyping of Roblox mechanics
- Learning Luau programming patterns
- Code review and suggestions

### Education
- Teaching Roblox development
- Demonstrating best practices
- Interactive coding assistance

### Productivity
- Accelerating development workflows
- Reducing boilerplate code
- Standardizing team coding styles

---

## โš ๏ธ Limitations

- **Scope**: Specialized for Luau only, not general-purpose programming
- **Context Window**: Limited to 1024 tokens
- **Recency**: Training data may not include latest Roblox API updates
- **Validation**: Always test generated code in Roblox Studio

---

## ๐Ÿ“„ Citation

```bibtex
@misc{youngseong_kim_2025,
	author       = { Youngseong Kim },
	title        = { Qwen2.5-Coder-1.5B-roblox (Revision 63e9452) },
	year         = 2025,
	url          = { https://huggingface.co/umjunsik1323/Qwen2.5-Coder-1.5B-roblox },
	doi          = { 10.57967/hf/7093 },
	publisher    = { Hugging Face }
}
```

---

## ๐Ÿ“œ License

This LoRA adapter is released under **Apache 2.0 License**, maintaining compatibility with the base Qwen2.5-Coder model.

---

## ๐Ÿค Acknowledgments

- **Qwen Team** at Alibaba Cloud for the base model
- **Roblox** for providing the Luau corpus dataset
- **Kaggle** for providing the computational resources

---

**Made with โค๏ธ for the Roblox Developer Community**