﻿# Granite LoRA versus QLoRA: matched demos, parser rules and memory units

Read the Granite RTX 4060 tutorial through its actual notebook: matched demo runs, unequal full runs, parse coverage, split implementation and GiB counters.

Author: Retrivium editorial team
Updated: 2026-11-05
Canonical URL: https://retrivium.ai/journal/granite-lora-qlora-demo-evaluation-memory-units/
Language: en

A small classification experiment can make the LoRA–QLoRA memory trade-off concrete without establishing a universal ranking of the methods. The Granite tutorial examined here reports both approaches on a laptop GPU, but its full and demonstration runs use different training and evaluation sizes. Those distinctions determine which comparisons are actually controlled.

## Identify the model path being compared

The [project README](https://github.com/pypi-ahmad/granite-lora-qlora-text-classification/blob/4aa274f4a686eaf0e48424bb4c90edf10cfff6bd/README.md) adapts a Granite base model for AG News classification by generating a category label. LoRA freezes the base weights and trains adapters; the QLoRA path additionally loads a quantized base while retaining adapter training. A compact stored base does not imply that every arithmetic operation uses the same low-bit format.

The case uses an RTX 4060 Laptop GPU with 8GB of VRAM. That identifies a particular machine class and workflow, rather than demonstrating that any model of the same nominal size fits every similarly labeled GPU. Sequence length, checkpointing, adapter targets and live objects remain part of the resource requirement.

## Compare demonstration runs with demonstration runs

The [reviewed notebook](https://github.com/pypi-ahmad/granite-lora-qlora-text-classification/blob/4aa274f4a686eaf0e48424bb4c90edf10cfff6bd/granite41_lora_qlora_text_finetuning.ipynb) defines a full training path and a smaller demonstration path. Its demonstration data uses 20,000 training examples and 500 generation-evaluation examples. The full path uses 110,000 training examples and an evaluation prefix of 2,000 examples.

Consequently, comparing full LoRA with demonstration QLoRA changes both training data and evaluation coverage. The matched demonstration runs are more informative about the method difference in that setup. Even there, equal aggregate accuracy does not prove identical predictions, statistical equivalence or equal behavior on another task.

## Read the split and parser implementations

The README describes a stratified training split, while the reviewed notebook calls a shuffled train/test split without the stratification argument. The generation-evaluation subsets are prefix slices. We preserve the implemented selection rather than assuming that every prose description is an exact execution trace.

The evaluator also distinguishes strict accuracy from macro-F1 on parseable predictions. An unrecognized label counts as wrong for strict accuracy, while the known-only F1 calculation excludes it. Parse coverage is therefore necessary context. A changing parser or unknown-output rate can change the meaning of a score even when the model weights stay fixed.

## Keep memory units and observation boundaries explicit

The notebook's memory helper divides byte counts by powers of 1024, producing GiB even though variable names and several tables use GB. It records allocated, reserved and maximum values separately. Those are different measurements and should not be collapsed into a single unqualified VRAM number.

The README also contains approximate summary values and a more detailed memory table. We treat them as author-reported observations rather than independent measurements. A reproduction should identify peak-reset boundaries and account for objects retained across notebook stages; clearing a cache does not release a model that is still referenced.

## Separate a useful tutorial from a general quality claim

The full QLoRA run is reported as incomplete, while the smaller matched runs provide the available comparison. That does not establish that quantization is lossless for arbitrary instructions, languages or long-context workloads. The task is category generation with a specific prompt and short output.

We read the pinned README and relevant notebook configuration, split, evaluator and memory helpers without executing cells or downloading weights. The [reproducible-stack guide](/journal/software-stack-reproducibility/) covers revision records, and the [document-split guide](/journal/document-level-data-split-leakage/) covers source separation. The case is useful when the actual run sizes, parser rules and memory counters stay attached to its conclusions.

## Sources

- [Pinned Granite LoRA/QLoRA tutorial README](https://github.com/pypi-ahmad/granite-lora-qlora-text-classification/blob/4aa274f4a686eaf0e48424bb4c90edf10cfff6bd/README.md).
- [Pinned notebook configuration and evaluation implementation](https://github.com/pypi-ahmad/granite-lora-qlora-text-classification/blob/4aa274f4a686eaf0e48424bb4c90edf10cfff6bd/granite41_lora_qlora_text_finetuning.ipynb).
