Concepts / Parameter-Efficient Finetuning

Parameter-Efficient Finetuning

Quantization and parameter-efficient finetuning are related ways to address resource limits, but they do different things. Quantization reduces the precision used to represent values. Parameter-efficient finetuning reduces how many parameters are trained.

  • Programming

The Smaller Model That May Not Run Faster

A natural first guess about quantization is that storing a model with fewer bits must make it faster. Smaller values mean less data to move and a smaller memory footprint, so this idea has a real basis. But it is not a guarantee: converting values between formats can add work, and changing their precision can change the values themselves. These same trade-offs matter when deciding how to finetune a model. This article follows both questions: what happens when model values use fewer bits, and what can be trained when updating every parameter is too costly?

Key point

Quantization and parameter-efficient finetuning are related ways to address resource limits, but they do different things. Quantization reduces the precision used to represent values. Parameter-efficient finetuning reduces how many parameters are trained.

What Quantization Changes

Inference quantization reduces the precision of a model's parameters and values while the model is being served. A value stored in a wider format can be converted to one of the fewer values representable in a narrower format. The converted value may differ slightly from the original. If a value lies outside the narrower format's range, it can become infinity or an arbitrary value. Quantization can therefore reduce the model's memory footprint, but quality must be checked after conversion.

Floating-pointparameterWider representationInteger parameterFewer representable valuesQuantization
How does reducing precision change the stored representation, and what is lost?

The diagram shows the representational change, not a particular numeric conversion rule. The source describes formats such as FP8 and FP4, which are floating-point formats, and INT8 and INT4, which are integer formats. The narrower representation uses fewer bits, but fewer bits also mean fewer possible values. That is why smaller storage and potentially faster computation come with a quality trade-off.

When Fewer Bits Help Inference

Reduced precision can help in two linked ways. A smaller model footprint can leave room for a larger batch, allowing more inputs to be processed in parallel. Reduced precision can also speed up computation itself. Either effect can contribute to lower inference latency, but the outcome depends on the work required by the actual serving path.

Low-precision weightsStored representationFormat conversionMay add overheadModel computationUses values for inferenceInference resultIf neededConverted valuesIf conversion is not neededProduces
Where can format conversion add work between storing low-precision weights and using them for computation?

The important question is not just how many bits the stored weights use. It is also whether the serving path can use that representation efficiently. If values must be converted to another format, that conversion adds time and can offset some of the speed benefit. So fewer bits can mean less data to move and faster computation, but they do not guarantee lower latency in every setup.

In the real world

Post-training quantization is one way to use a model trained at higher precision for lower-precision inference: train first, then reduce precision for serving. The source notes that major machine-learning frameworks offer post-training quantization, and that some edge devices support only quantized inference.

Three Ways to Handle Precision During Training

Training-related uses of reduced precision have different goals. Quantization-aware training aims to help a model retain quality when it later runs at low precision. Direct lower-precision training aims to perform training computations at lower precision, which can improve training efficiency but is harder because backpropagation is more sensitive to precision. Mixed precision assigns different precisions to different values or parts of training. These approaches should not be treated as interchangeable.

Quantization-awaretrainingSimulates low precision;computes in high precisionDirectlower-precisiontrainingTrains directly at lowerprecisionMixed precisionAssigns differentprecisions to values
At what point does each strategy use lower precision, and what remains in higher precision?

In quantization-aware training, the model simulates low-precision behavior while the computation is carried out in high precision. This can prepare the model for better low-precision inference, but it does not itself reduce training time. Direct lower-precision training is different: the training process uses lower precision, which can help with training efficiency, but the lower-precision learning signal can be disturbed during backpropagation.

Mixed precision does not require every value to use the same precision. For example, a higher-precision copy of weights can be kept while gradients and activations use lower precision. Precision can also vary according to sensitivity, with more-sensitive values kept at higher precision. The source gives LLM-QAT as an example: weights and activations are quantized to 4 bits while embeddings remain at 16 bits.

ApproachWhat it doesMain purpose or caution
Quantization-aware trainingSimulates low-precision behavior while computing in high precisionImproves low-precision inference quality; does not reduce training time
Direct lower-precision trainingTrains directly at lower precisionCan improve training efficiency; backpropagation is more sensitive to lower precision
Mixed precisionUses different precisions for different values or parts of trainingCan keep some values at higher precision while others use lower precision

The three approaches differ in where lower precision is used and what they are intended to achieve.

How Far Can Precision Shrink?

One bit is the lower limit for representing a value with bits, and research has explored 1-bit representations. In 2024, Microsoft researchers introduced BitNet b1.58, a transformer-based language model described as requiring 1.58 bits per parameter. The reported comparison found its performance comparable to 16-bit Llama 2 up to 3.9B parameters.

That result has boundaries. It is a comparison of benchmark performance, not a claim that BitNet b1.58 is faster. The reported gap also varies from benchmark to benchmark. The useful lesson is that very low-bit models are possible, not that the same performance or speed is guaranteed for every model size or task.

What Full Finetuning Keeps in Memory

Full finetuning updates every parameter in the model. Its memory cost is more than the model weights alone: a training run also needs memory for gradients, optimizer states, and activations. The source identifies these components but does not provide a separate numeric memory estimate for each one, so a weights-only calculation should not be mistaken for the total training requirement.

WeightsModel parametersGradientsOptimizer statesActivations
Which major components occupy memory while every model parameter is being finetuned?
Worked example

Estimate FP16 Weight Memory for a 7B Model

Estimate the memory for the weights alone of a 7 billion parameter model stored in FP16, where each value takes 2 bytes.

  1. 1
    Count the parameters

    The model has $7 \times 10^{9}$ parameters.

  2. 2
    Use the bytes per value

    Each FP16 value takes 2 bytes.

  3. 3
    Multiply parameters by bytes per value

    $7 \times 10^{9} \times 2 = 14 \times 10^{9}$ bytes, or about 14 GB.

Result

The weights alone take about 14 GB. This is not the total memory required for finetuning.

For the same 7B model in a 16-bit format, the source estimates about 56 GB for full finetuning before activations. That total is substantially more than the weights-only estimate because training includes other memory costs, such as gradients and optimizer states. Use the 14 GB calculation as a way to estimate just the stored weights; do not use it as a GPU-memory budget for a full finetuning run.

Freezing Parameters and Its Limits

Partial finetuning changes the number of parameters that are updated: some are trainable, while the rest are frozen and keep their values throughout training. This reduces the trainable parameter count, and therefore reduces memory use. The training-related memory burden associated with updating parameters is consequently smaller, although the source does not give a separate gradient or optimizer-state estimate for each frozen or trainable group.

Frozen layersValues stay fixedModelTrainable layersValues are updatedContainsContains
How does partial finetuning divide a model into parameters that stay fixed and parameters that can change?
Worked example

Freezing Nine of Ten Layers

Suppose a model has ten layers and the first nine are frozen while only the last layer is trained. What fraction of the model's layers is trainable?

  1. 1
    Count the trainable layers

    Only the last layer is trained, so 1 of the 10 layers is trainable.

  2. 2
    Compare with all layers

    One out of ten layers is about 10% of the layer count.

Result

About 10% of the layers are trainable in this illustration. This is a fraction of layers, not a guarantee that exactly 10% of the parameters are trainable in every model.

Freezing is not automatically parameter-efficient. It can reduce the number of trainable parameters while still requiring many of them to approach full-finetuning performance. The source reports a BERT large study in which roughly 25% of the parameters had to be updated to match full finetuning on the GLUE benchmark.

How Adapters Add Trainable Capacity

Parameter-efficient finetuning, or PEFT, aims to get close to full-finetuning performance while using several orders of magnitude fewer trainable parameters. There is no official cutoff that defines the label. The emphasis is on achieving strong performance with far fewer parameters being updated.

Adapters are one PEFT approach. Instead of updating the original model weights, adapter finetuning keeps those weights frozen and trains small modules inserted into the model. In the approach described by Houlsby and colleagues, two adapter modules were placed inside each transformer block of a BERT model. During finetuning, only the adapter parameters change.

InputFrozen base layerOriginal weights stay fixedCombined outputNext computationAdapter moduleTrainable weightsBase pathAdapter pathBase outputAdapter outputContinues
Where do the adapter weights sit in the forward pass, and how do the base and adapter paths contribute to the output?

The diagram traces the adapter's role: the input goes through the frozen base computation and the adapter path, and their outputs are combined before continuing. The adapter adds trainable parameters without requiring the original weights to be updated. In the reported GLUE result, the adapter arrangement came within 0.4% of full finetuning while using only 3% of the trainable parameters.

Edge case

Adapters trade fewer trainable parameters for extra computation. The added layers contribute additional steps on each forward pass, so they can increase inference latency for the finetuned model. A reduction in training memory does not mean inference becomes faster.

PEFT can also lower the hardware and data burden of finetuning. The source says full finetuning may require tens of thousands to millions of examples before quality improves noticeably, while some PEFT methods can produce strong results with only a few thousand examples. That is a general claim about some PEFT methods, not a guarantee that every adapter setup will need that amount of data.

Mistakes That Blur the Trade-Offs

  • Common mistake

    Assuming fewer bits always make inference faster.

    Why it fails

    Format conversion can add time and offset some of the benefit from reduced-precision computation.

    Do this instead

    Treat lower latency as a possible benefit, not a guarantee, and consider the serving path's conversion overhead.

  • Common mistake

    Treating quantization-aware training as a way to reduce training time.

    Why it fails

    It simulates low-precision behavior while computing in high precision, targeting low-precision inference quality.

    Do this instead

    Separate the goal of improving low-precision inference quality from the goal of reducing training cost.

  • Common mistake

    Using the weight-only memory estimate as the full finetuning budget.

    Why it fails

    Full finetuning also needs memory for gradients, optimizer states, and activations.

    Do this instead

    Label the weight calculation as weights only, then account for the additional training memory.

  • Common mistake

    Calling any method that freezes layers parameter-efficient.

    Why it fails

    Partial finetuning can still require many trainable parameters to approach full-finetuning performance.

    Do this instead

    Judge parameter efficiency by the relationship between performance and the number of trainable parameters.

  • Common mistake

    Expecting adapters to make inference faster.

    Why it fails

    Adapter modules add computation to the forward pass and can increase inference latency.

    Do this instead

    Treat adapters as a way to reduce the number of trainable parameters, with an inference-speed trade-off.

Practice the Memory Estimate

EASY

A model has 2 billion parameters stored in a format that uses 2 bytes per value. Estimate the memory for its weights alone. Then name two additional memory components a full finetuning run needs, and explain why the weights-only estimate is not the full training budget.

Hints
  • Multiply the parameter count by the number of bytes per value.
  • The source lists gradients, optimizer states, and activations as additional components.
MEDIUM

A team wants a model to run at lower precision during inference, but it has not established that its serving path can use the stored format without conversion. Which latency assumption should the team avoid? Name one training approach that targets low-precision inference quality without reducing training time.

Hints
  • Separate reduced storage and computation from conversion overhead.
  • Compare quantization-aware training with direct lower-precision training.

A Practical Decision Sequence

  1. 1
    For inference, decide what precision the model will use and check whether conversion overhead could offset speed gains.
  2. 2
    Check model quality after quantization because conversion can change values or produce problematic out-of-range results.
  3. 3
    For full finetuning, estimate weights from parameter count and bytes per value, then remember that gradients, optimizer states, and activations also occupy memory.
  4. 4
    If full finetuning is too costly, distinguish freezing existing parameters from adding trainable adapter modules.
  5. 5
    Compare a parameter-efficient method by both its trainable parameter count and its performance relative to full finetuning.
  6. 6
    Include inference latency in the adapter trade-off because added modules can increase computation during serving.

Key Takeaways

  • Quantization stores parameters and values with fewer representable levels. It can reduce memory use and speed computation, but conversion overhead and changes to values can limit the benefit.
  • Quantization-aware training simulates low-precision behavior while computing in high precision; direct lower-precision training uses lower precision for training; mixed precision assigns different precisions to different values or phases.
  • A weights-only estimate is parameter count multiplied by bytes per value. Full finetuning also requires memory for gradients, optimizer states, and activations.
  • Partial finetuning freezes some parameters but can still require many trainable parameters to approach full-finetuning performance.
  • Adapters train inserted modules while keeping original weights frozen. They can achieve performance close to full finetuning with far fewer trainable parameters, but added computation can increase inference latency.

Related concepts

More concepts starting with P