100 lines
4.6 KiB
Markdown
100 lines
4.6 KiB
Markdown
---
|
|
language:
|
|
- en
|
|
license: apache-2.0
|
|
base_model: unsloth/Qwen2.5-Coder-7B-Instruct-bnb-4bit
|
|
tags:
|
|
- fine-tuned
|
|
- unity
|
|
- game-development
|
|
- csharp
|
|
- debugging
|
|
- qlora
|
|
- lora
|
|
- unsloth
|
|
- gguf
|
|
datasets: []
|
|
pipeline_tag: text-generation
|
|
---
|
|
|
|
# Unity C# Debugging Coach
|
|
|
|
A fine-tuned language model that acts as a patient debugging coach for beginner and intermediate Unity game developers. Given a Unity/C# bug description, error message, or broken code snippet, the model responds with a structured four-part explanation: identify the problem, explain why it happens, provide a concrete fix, and add a prevention tip.
|
|
|
|
## What this model does
|
|
|
|
When given a Unity or C# debugging question, the model responds consistently in this structure:
|
|
|
|
1. **Problem** — briefly identifies what is likely wrong
|
|
2. **Why it happens** — explains the root cause in beginner-friendly language
|
|
3. **How to fix it** — provides a concrete, actionable solution (often with corrected code)
|
|
4. **Prevention tip** — gives a best-practice note to avoid the issue in future projects
|
|
|
|
The model stays encouraging and practical, avoiding overly academic explanations.
|
|
|
|
## Example usage
|
|
|
|
**System prompt (recommended):**
|
|
```
|
|
You are a Unity C# debugging coach. When a student describes a bug or error, respond in four parts: (1) identify the problem, (2) explain why it happens, (3) give a concrete fix, (4) add a prevention tip. Keep your tone encouraging and your explanations beginner-friendly.
|
|
```
|
|
|
|
**Example input:**
|
|
```
|
|
My player keeps falling through the floor in my 2D platformer. I have a Rigidbody2D and a BoxCollider2D on the player, and a BoxCollider2D on the ground. No errors in the console.
|
|
```
|
|
|
|
**Example output:**
|
|
```
|
|
Problem:
|
|
Your player is passing through the floor at runtime despite having the correct collider setup.
|
|
|
|
Why it happens:
|
|
This is almost always a collision detection issue. By default, Unity uses Discrete collision detection, which checks for collisions at each physics step. If your player moves fast enough (especially during a fall), it can teleport past a thin collider between steps — a problem called tunneling.
|
|
|
|
How to fix it:
|
|
Select your player's Rigidbody2D in the Inspector and change Collision Detection from "Discrete" to "Continuous". This tells Unity to check for collisions continuously along the movement path, preventing tunneling.
|
|
|
|
Also verify:
|
|
- Both colliders are active and not set as triggers
|
|
- The ground layer is not excluded in the Physics 2D settings
|
|
|
|
Prevention tip:
|
|
Always use Continuous collision detection for fast-moving objects like players and projectiles. Reserve Discrete for slow or stationary objects to keep performance costs low.
|
|
```
|
|
|
|
## Training details
|
|
|
|
| Detail | Value |
|
|
|---|---|
|
|
| Base model | `unsloth/Qwen2.5-Coder-7B-Instruct-bnb-4bit` |
|
|
| Fine-tuning method | QLoRA (LoRA r=16, alpha=32) |
|
|
| Training examples | 600 |
|
|
| Validation examples | 120 |
|
|
| Epochs | 3 |
|
|
| Max sequence length | 2048 tokens |
|
|
| Learning rate | 2e-4 (cosine schedule) |
|
|
| Batch size | 2 (grad accum 4, effective 8) |
|
|
| Hardware | Colab A100 |
|
|
| Framework | Unsloth + TRL SFTTrainer |
|
|
|
|
## Dataset
|
|
|
|
The training data was synthetically generated using GPT-5.2-chat via OpenRouter. Each example is a conversation pair where:
|
|
|
|
- **User message:** A Unity/C# debugging question — ranging from short error-only reports to multi-line code snippets. Questions vary across 20 issue categories (NullReferenceException, collision bugs, NavMesh issues, animation transitions, etc.), 11 project contexts (2D platformer, RPG, top-down shooter, etc.), and 3 difficulty levels (beginner, intermediate, advanced beginner).
|
|
- **Assistant message:** A structured response following the four-part format described above.
|
|
|
|
## GGUF / LM Studio
|
|
|
|
A Q4_K_M quantized GGUF is available in this repository for use in LM Studio, Ollama, or any llama.cpp-compatible runtime.
|
|
|
|
To use in LM Studio: search for this repository by username in the model search.
|
|
|
|
## Known limitations
|
|
|
|
- The model was trained on synthetic data only; it has not seen real student conversations. Responses are structured and reliable, but may occasionally feel slightly formal compared to human tutor replies.
|
|
- Coverage of very advanced Unity topics (custom render pipelines, DOTS/ECS, compute shaders) is limited — the training data focused on beginner/intermediate issues.
|
|
- The model does not have access to live Unity documentation. For up-to-date API details, cross-reference with the official Unity Manual. As the teacher noted, RAG over Unity docs would significantly improve accuracy for version-specific questions.
|
|
- Response quality may degrade on queries that mix multiple unrelated bugs in one message.
|