๐Ÿ” Code Reviewer

A fine-tuned Llama 3.2 3B for automated Python code review

QLoRA Unsloth LoRA Rank 16 Llama 3.2 3B

๐Ÿ“– About

This project fine-tunes Llama 3.2 3B using QLoRA to produce structured Python code reviews. The model identifies bugs, style issues, and improvements, and formats every response with severity levels: Critical, Warning, or Info.

Training was performed on a free Google Colab T4 GPU in 2.5 minutes using Unsloth. The final LoRA adapter is only 88 MB โ€” a 70x reduction compared to the full base model.

๐Ÿ“Š Training Metrics

500
Training examples
2.5 min
Training time (T4)
2.40 โ†’ 0.11
Loss (start โ†’ end)
24M
Trainable params (0.75%)
88 MB
LoRA adapter size

โšก Benchmark: Base vs. Fine-Tuned

The fine-tuned model produces concise, structured reviews with severity levels, while the base Llama 3.2 outputs generic, verbose explanations.

Test case: Off-by-one error

def calculate_average(numbers):
    total = 0
    for i in range(len(numbers) + 1):
        total += numbers[i]
    return total / len(numbers)

โŒ Base Llama 3.2 3B

#### Critical
The function `calculate_average` has a bug. It does not handle the case when the input list `numbers` is empty. In such a case, the function will raise a `ZeroDivisionError`...

#### Warning
The variable name `total` is not very descriptive...

#### Warning
The function uses a for loop with an index that goes up to `len(numbers) + 1`...

โœ… Fine-Tuned Code Reviewer

**Critical: Off-by-one error**
- `range(len(numbers) + 1)` goes one past the end, causing `IndexError`.
- **Fix:** Use `range(len(numbers))` or iterate directly.

๐Ÿ› ๏ธ Tech Stack

Llama 3.2 3B QLoRA Unsloth PEFT TRL HuggingFace Google Colab FastAPI

๐Ÿ”— Links

โš ๏ธ This is a static showcase page. The model runs on Google Colab or locally via the FastAPI service in the GitHub repo.