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 20 |
-
|
| 21 |
-
An Ollama Modelfile is included for easy deployment.
|
| 22 |
-
This was trained 2x faster with [Unsloth](https://github.com/unslothai/unsloth)
|
| 23 |
-
[<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/unsloth%20made%20with%20love.png" width="200"/>](https://github.com/unslothai/unsloth)
|
|
|
|
| 1 |
---
|
| 2 |
+
language:
|
| 3 |
+
- en
|
| 4 |
+
license: other
|
| 5 |
+
license_name: qianwen
|
| 6 |
+
license_link: https://huggingface.co/Qwen/Qwen3-4B/blob/main/LICENSE
|
| 7 |
+
base_model:
|
| 8 |
+
- Qwen/Qwen3-4B
|
| 9 |
tags:
|
| 10 |
+
- fine-tuned
|
| 11 |
+
- education
|
| 12 |
+
- python
|
| 13 |
+
- socratic
|
| 14 |
+
- qlora
|
| 15 |
- unsloth
|
| 16 |
+
---
|
| 17 |
+
|
| 18 |
+
# Fyve-AI
|
| 19 |
+
|
| 20 |
+
**Fyve-AI** is a fine-tuned version of [Qwen3-4B](https://huggingface.co/Qwen/Qwen3-4B) trained for one specific task: reading a student's broken Python code and responding with a Socratic 3-sentence hint β not the answer.
|
| 21 |
+
|
| 22 |
+
It is the AI model powering [PyFyve](https://github.com/Macmill-340/PyFyve), a fully offline Python tutoring application.
|
| 23 |
+
|
| 24 |
+
---
|
| 25 |
+
|
| 26 |
+
## What It Does
|
| 27 |
+
|
| 28 |
+
Given a task description, the student's buggy code, and the Python error it produced, the model outputs a JSON object with two fields:
|
| 29 |
+
|
| 30 |
+
- `reasoning` β internal diagnosis of what went wrong and why
|
| 31 |
+
- `hint` β exactly 3 sentences following a fixed structure:
|
| 32 |
+
1. **Diagnosis** β names the specific variable, expression, or construct that caused the error
|
| 33 |
+
2. **Rule** β states the Python rule that was violated
|
| 34 |
+
3. **Directive** β starts with *"Think about..."* or *"Consider..."* and guides without giving the fix
|
| 35 |
+
|
| 36 |
+
The model never gives corrected code. It never gives more than 3 sentences. It does not know how to do anything outside this task.
|
| 37 |
+
|
| 38 |
+
---
|
| 39 |
+
|
| 40 |
+
## Input Format
|
| 41 |
+
|
| 42 |
+
```
|
| 43 |
+
Task:
|
| 44 |
+
<what the student was asked to do>
|
| 45 |
+
Code:
|
| 46 |
+
<the student's broken code>
|
| 47 |
+
Error:
|
| 48 |
+
<the Python error message>
|
| 49 |
+
```
|
| 50 |
+
|
| 51 |
+
---
|
| 52 |
+
|
| 53 |
+
## Output Format
|
| 54 |
+
|
| 55 |
+
```json
|
| 56 |
+
{
|
| 57 |
+
"reasoning": "...",
|
| 58 |
+
"hint": "Sentence 1.\nSentence 2.\nSentence 3."
|
| 59 |
+
}
|
| 60 |
+
```
|
| 61 |
+
|
| 62 |
+
---
|
| 63 |
+
|
| 64 |
+
## Example
|
| 65 |
+
|
| 66 |
+
**Input:**
|
| 67 |
+
```
|
| 68 |
+
Task:
|
| 69 |
+
Create a variable score = 95 and print its value.
|
| 70 |
+
Code:
|
| 71 |
+
score = 95
|
| 72 |
+
print(Score)
|
| 73 |
+
Error:
|
| 74 |
+
NameError: name 'Score' is not defined at line 2
|
| 75 |
+
```
|
| 76 |
+
|
| 77 |
+
**Output:**
|
| 78 |
+
```json
|
| 79 |
+
{
|
| 80 |
+
"reasoning": "score is defined lowercase but Score (capital S) is used in print. I name both spellings, explain case sensitivity, and direct toward comparing the two usages.",
|
| 81 |
+
"hint": "You defined a variable called score on line 1 but referenced Score on line 2.\nIn Python, variable names are case-sensitive, so score and Score are treated as two completely different identifiers.\nConsider whether the capitalisation of the variable name is consistent between where it was defined and where it is used."
|
| 82 |
+
}
|
| 83 |
+
```
|
| 84 |
|
| 85 |
---
|
| 86 |
|
| 87 |
+
## Training Details
|
| 88 |
|
| 89 |
+
| Detail | Value |
|
| 90 |
+
|--------|-------|
|
| 91 |
+
| Base model | Qwen3-4B |
|
| 92 |
+
| Method | QLoRA via [Unsloth](https://github.com/unslothai/unsloth) |
|
| 93 |
+
| Hardware | Google Colab T4 (free tier) |
|
| 94 |
+
| Dataset | 555 curated (task, code, error, hint) pairs |
|
| 95 |
+
| Dataset source | Synthetic β generated using Qwen3-30B-A3B as teacher model |
|
| 96 |
+
| Error types covered | SyntaxError, NameError, TypeError, IndexError, KeyError, ValueError, AttributeError, UnboundLocalError, RecursionError, ZeroDivisionError, and more |
|
| 97 |
|
| 98 |
+
The training data was generated by a 30B teacher model, manually reviewed for quality, and filtered through a validation pipeline that checks hint structure, sentence count, and semantic rules (e.g. AttributeError on strings must guide toward `+` or `+=`, not list conversion).
|
| 99 |
+
|
| 100 |
+
---
|
| 101 |
+
|
| 102 |
+
## Intended Use
|
| 103 |
+
|
| 104 |
+
This model is designed exclusively for use inside the PyFyve app. It is not a general-purpose assistant and will produce poor results for tasks outside its training distribution.
|
| 105 |
+
|
| 106 |
+
**It is not designed to:**
|
| 107 |
+
- Answer general Python questions
|
| 108 |
+
- Explain concepts freely
|
| 109 |
+
- Write or complete code
|
| 110 |
+
- Serve as a chatbot
|
| 111 |
+
|
| 112 |
+
---
|
| 113 |
+
|
| 114 |
+
## Limitations
|
| 115 |
+
|
| 116 |
+
- Trained on 555 examples β covers common beginner and intermediate Python errors well, but unusual or advanced errors may produce weaker hints
|
| 117 |
+
- No coverage of logic errors (code that runs but produces wrong output)
|
| 118 |
+
- Some uncommon syntax patterns (e.g. trailing comma creating a tuple) are outside the training distribution
|
| 119 |
+
- The 3-sentence format is enforced by the prompt at inference time β removing the few-shot examples from the prompt degrades output quality significantly
|
| 120 |
+
|
| 121 |
+
---
|
| 122 |
+
|
| 123 |
+
## Usage with Ollama
|
| 124 |
+
|
| 125 |
+
This model is distributed as a GGUF file for use with [Ollama](https://ollama.com). The `Modelfile` in this repository contains the Ollama model definition.
|
| 126 |
+
|
| 127 |
+
```bash
|
| 128 |
+
ollama create fyve-ai -f Modelfile
|
| 129 |
+
```
|
| 130 |
+
|
| 131 |
+
Or use the PyFyve app, which handles setup automatically.
|
| 132 |
+
|
| 133 |
+
---
|
| 134 |
+
|
| 135 |
+
## License
|
| 136 |
+
|
| 137 |
+
The fine-tuned weights are released under the same license as the base model: the [Qianwen License](https://huggingface.co/Qwen/Qwen3-4B/blob/main/LICENSE).
|
| 138 |
+
|
| 139 |
+
Please read it before redistributing β it permits research and personal use but has restrictions on commercial use above certain usage thresholds.
|
| 140 |
+
|
| 141 |
+
---
|
| 142 |
|
| 143 |
+
## Citation
|
|
|
|
| 144 |
|
| 145 |
+
If you use this model in research or build on it, please link back to the [PyFyve repository](https://github.com/Macmill-340/PyFyve).
|
|
|
|
|
|
|
|
|