arXiv:2611.23205cs.LGNov 2026

Manuscript Offprint

arXiv:2611.23205

Fine-Tuning Gemma 4 Edge Models for MATLAB Signal-Processing Code with SFT and QLoRA on a Laptop iGPU

Mehmet Altan Toksöz

Open access. PaperVantage converted this article to text, so layout and figures may differ from the original.

Abstract

Small language models that run on a laptop are attractive for writing signal-processing code offline, but they make systematic errors on digital signal processing (DSP) conventions. We apply supervised fine-tuning (SFT) to the Gemma 4 edge models E2B and E4B with 66 checked examples covering 11 signal-processing MATLAB subtasks, using low-rank adaptation (LoRA) and quantized LoRA (QLoRA) on the integrated GPU (iGPU) of a laptop, and deploy the 8-bit integer (int8) models with the adapters through OpenVINO. On held-out variants scored by deterministic checkers, the pass rate rises from 18/66 to 37/66 (LoRA) and 37/66 (QLoRA) for E2B and from 32/66 to 47/66 for E4B (QLoRA). Reading all 159 failing programs shows that the adapters remove most errors of convention, such as the sign of a lag, units and array shapes, but few errors in building signals and noise. Applied at run time, the adapter costs 17–19% of the generation speed.

1 Introduction

Signal-processing engineers write much of their code in MATLAB: they synthesise pulses and chirps, correlate channels, filter, take fast Fourier transforms (FFTs) and set detection thresholds. Language models can draft such code, and small models that run on a laptop can do so without sending anything off the machine, which matters where the work cannot leave it. The Gemma 4 edge models E2B and E4B Gemma Team (2026) are made for this kind of device. On our tasks, however, they often get the conventions of the field wrong: they read the delay with the wrong sign from xcorr, forget the gain NN of an unscaled FFT, write a chirp rate in the wrong unit or mix row and column vectors. Such code runs and prints a plausible number, which makes the errors hard to notice.

Low-rank adaptation (LoRA) Hu et al. (2022) and its quantized variant QLoRA Dettmers et al. (2023) make supervised fine-tuning (SFT) of such models possible with little memory. We ask how much a small set of checked examples, trained on the integrated GPU (iGPU) of the same laptop, improves the code these models write, and which errors it removes.

Answering this needs three things. First, tasks whose answers can be checked automatically. Following the practice of judging generated code by running it Chen et al. (2021), we wrote 11 parametric subtasks from signal-processing work, run every answer in an emulator of a MATLAB subset, and score it with checkers that also reject values copied from the prompt or computed from a formula instead of measured. Earlier work compared commercial and open models on generating MATLAB code for automated-driving scenarios Yang et al. (2025); here the models are small enough to run on a laptop and the domain is digital signal processing (DSP). Second, training data. Instead of collecting the model’s own correct answers, which were too rare, we let the small model write the reasoning for an expert’s solution and then the answer itself, close to the rationalization step of the Self-Taught Reasoner (STaR) Zelikman et al. (2022), and kept only answers that pass the checkers. Third, a way to train and deploy on a laptop: the Parameter-Efficient Fine-Tuning (PEFT) library Mangrulkar et al. (2022) on the integrated GPU for training, and OpenVINO GenAI OpenVINO toolkit (2026) with 8-bit integer (int8) weights for inference.

Our contributions are:

  • 11 parametric MATLAB signal-processing subtasks with deterministic checkers; the prompts of the held-out variants are listed in appendix A;
  • a procedure in which the small model itself writes 66 training examples from expert solutions, with automatic filters and a reading of every example;
  • LoRA and QLoRA adapters for E2B and E4B trained on a laptop GPU in under an hour each and run with int8 OpenVINO models;
  • an evaluation on held-out variants in which the adapters double the pass count of E2B and raise that of E4B from 32 to 47 of 66, and an analysis of all 159 failing programs that shows which errors the adapters remove and which they do not.

Section 2 describes the subtasks, the emulator and the checkers, section 3 the training data and section 4 the training and deployment. Section 5 gives the results, section 6 the error analysis and section 7 the limitations.