Scaling, Quantization, and Rank: A QLoRA Study for Local Python Code Generation with Qwen3
Abstract
Large Language Models (LLMs) have demonstrated exceptional capabilities in translating natural language into executable code. However, deploying these models in privacy-sensitive enterprise environments necessitates offline, locally hosted architectures with strict hardware limitations. While smaller foundation models meet these memory constraints, they frequently suffer from inconsistent reliability and functional incompleteness in domain-specific tasks, such as Python-based data analysis. To address this gap, this study investigates the application of Parameter-Efficient Fine-Tuning (PEFT), specifically Low-Rank Adaptation (LoRA) and Quantized LoRA (QLoRA), to specialize the Qwen3 model family for reliable Python code generation. We systematically evaluate fifteen experimental configurations across three analytical axes: model parameter scaling (0.6B to 14B), quantization precision (bfloat16, int8, nf4), and LoRA rank capacity $(\mathbf{r}=\mathbf{8}$ to 128), using perplexity as the primary evaluation metric. The results reveal a clear inverse relationship between model scale and quantization degradation, showing consistent trends in quantization sensitivity across model scales.