Papers
Topics
Authors
Recent
Search
2000 character limit reached

Techniques for Peak Memory Reduction for LoRA Fine-tuning of LLMs on Edge Devices

Published 17 Jun 2026 in cs.LG and cs.AI | (2606.19528v1)

Abstract: Fine-tuning of LLMs using Low-Rank Adaptation (LoRA) on an end-user's data offers personalized experiences while keeping data private, but faces severe memory constraints on consumer hardware. Peak memory during fine-tuning often exceeds device limits, especially for models with billions of parameters and long-context training data. This paper introduces a suite of complementary techniques to reduce memory footprint without sacrificing model quality: (1) base model quantization with on-the-fly dequantization, (2) memory-efficient checkpointing combining selective activation caching and disk offloading, (3) softmax approximation using semantically relevant token subsets, and (4) logits masking. Experiments on Llama-3.2 3B and Qwen-2.5 3B demonstrate up to 26Ă—26\times and 28Ă—28\times reduction in peak memory, enabling fine-tuning on resource-constrained devices.

Summary

  • The paper demonstrates a >28x peak memory reduction by integrating quantization, activation checkpointing/offloading, softmax approximation, and logits masking.
  • It employs aggressive INT4 quantization with on-the-fly dequantization and selective recomputation to minimize memory use while maintaining task performance.
  • Empirical results on Llama-3.2 3B show memory reductions from 53.1 GB to as low as 6.26 GB, enabling efficient fine-tuning on resource-constrained edge devices.

Memory-Efficient LoRA Fine-tuning of LLMs on Edge Devices: Techniques, Insights, and Implications

Introduction

The proliferation of LLMs has fueled interest in tight on-device personalization, particularly for edge scenarios characterized by strict privacy requirements, minimized latency, and offline operation. Low-Rank Adaptation (LoRA) is the default technique for parameter-efficient fine-tuning, but the associated peak memory footprint during backward passes is a severe bottleneck for resource-constrained hardware. This work, "Techniques for Peak Memory Reduction for LoRA Fine-tuning of LLMs on Edge Devices" (2606.19528), presents a comprehensive solution integrating quantization, disk-offloading checkpointing, vocabulary-reduced softmax, and logits masking to minimize peak memory without sacrificing adaptation quality.

Technical Contributions

Base Model Quantization with On-the-Fly Dequantization

The core architectural decision rests on aggressive post-training quantization of the frozen LLM weights. Most linear layers are compressed to INT4, with higher precisions selectively retained only where numerically necessary. To avoid persistent memory inflation from full-precision weights, all matrix-multiplications in the forward and backward passes operate on transiently dequantized weights, rematerialized on-demand and instantly freed thereafter. For Llama-3.2 3B, this compresses storage from 5.98 GB to 2.59 GB, reducing parameter memory to sub-3 GB even before further optimization.

Despite this, profiling reveals that activation storage, not parameters, remains the dominant memory consumer especially for long-context fine-tuning. Thus, quantization must be complemented by additional strategies.

Memory-Efficient Checkpointing and Disk Offloading

The methodology integrates activation recomputation and off-chip tensor offloading. Model layers are defined as computational nodes, with checkpoint boundaries demarcated to allow recomputation of subsequences of activations during the backward pass, while non-resident tensors are evicted to storage (e.g., SSD or NVM). Weight matrices are loaded on-demand and dropped after each use. This approach generalizes classical gradient checkpointing by constraining peak on-chip memory while incurring only modest recomputation overhead.

Empirical results demonstrate a >4x reduction in peak memory: for Llama-3.2 3B at 8K context, peak memory drops from 53.1 GB (quantized only) to 12.2 GB, making out-of-memory scenarios across context lengths up to 16K tokens tractable.

Softmax Approximation via Semantically Relevant Token Subsets

The architectural bottleneck for long-context scenarios shifts to the output layer, occupied by the full vocabulary embedding matrix (128k–256k tokens). The authors introduce softmax approximation by pre-computing per-token cosine similarity neighborhoods within the frozen embedding matrix and, for each context, loading only the union of top-k semantically proximate tokens required to compute training losses. This drastically constrains I/O and on-chip activation requirements for the LM-head.

Experiments establish that using k=100–1000 (typically <1% of the vocabulary) maintains validation loss and downstream task scores virtually identical to full softmax. For Llama-3.2 3B, at 8K context and with Top-100 approximation, memory is reduced from 12.2 GB to 6.26 GB, a 1.9x gain over standard checkpointing.

Logits Masking

Instruction fine-tuning typically involves sequences with a small fraction of trainable (labelled) tokens (e.g., only a 5.1% mean for XSum). During both forward and backward passes, logits and associated activations are only computed for trainable subsequences, with all others omitted. Logits masking (versus standard loss masking) further avoids all redundant softmax and loss computations for non-trainable positions, pushing peak memory even lower. At a typical 30% trainable token rate, memory drops by ~3x at 16K context (from 23.79 GB to 6.95 GB in Llama-3.2 3B).

Collectively, the synergy of these methods results in up to a 28x reduction in peak memory for 3B-class LLMs at context lengths infeasible for standard pipelines.

Empirical Evidence for Effectiveness

Strong experiments underpin all claims. Validation losses and task metrics (ROUGE-1 for summarization, F1 for SQuAD, normalized match for GSM8K/MATH) are nearly saturated by Top-500 or Top-1000 softmax approximations, with only minimal degradation at more aggressive (e.g., k=50) settings. Notably, instruction tuning tasks such as XSum and SQuAD, dominated by a low proportion of trainable tokens, derive the largest benefit from logits masking—the practical implication is that privacy-preserving personalized fine-tuning is now feasible within the DRAM budgets of commodity mobile hardware.

Explicit smartphone deployment—evaluated on a 2025 flagship device with 12 GB RAM—confirms transferability of profiling improvements: optimized configurations (all methods, k=200) reduce measured peak memory to 7.4% (32-token context) and 19.4% (2048-token context) of the baseline, with acceptable latency increases proportional to context and recomputation.

Discussion and Implications

This suite of orthogonal methods establishes a repeatable recipe for LLM fine-tuning on consumer edge platforms where local adaptation is required and server-based compute is not available. The independence of the four techniques (quantization, activation checkpointing/offloading, softmax reduction, and logits masking) allows flexible integration and tunability based on the memory/computation/latency trade-offs and task characteristics.

Practically, this unlocks high-quality on-device LLM personalization for applications such as mobile assistants, private dialog agents, and domain-specific model adaptation without lifting privacy-critical user data off-device. The approach is framework-agnostic and is compatible with Python ML stacks, allowing for rapid prototyping and deployment.

From a theory perspective, the result reinforces the orthogonality of activation memory and parameter storage as independent optimization axes, and emphasizes the continued efficacy of pre-trained LLM embedding geometries for semantic similarity-guided vocabulary reduction even after aggressive quantization.

Potential avenues for future work include generalizing softmax approximation heuristics for multimodal, speech, or retrieval-augmented LLM settings, improving scheduling for offloading under highly variable I/O bandwidth, and exploring the joint impact of LoRA with alternative PEFT techniques under extreme quantization and masking.

Conclusion

This paper end-to-end demonstrates that by integrating quantization, selective and offloaded activation checkpointing, semantically informed softmax approximation, and task-driven logits masking, LLM fine-tuning with LoRA can be realized within the strict memory budgets of edge devices. The empirical reductions—often greater than 25x in peak memory—are attained without significant task quality loss. These findings substantiate the feasibility of privacy-preserving, efficient, local adaptation for LLMs outside datacenter-scale compute, and serve as a prescriptive toolbox for researchers and practitioners targeting efficient edge AI.

Paper to Video (Beta)

No one has generated a video about this paper yet.

Whiteboard

No one has generated a whiteboard explanation for this paper yet.

Open Problems

We haven't generated a list of open problems mentioned in this paper yet.

Tweets

Sign up for free to view the 1 tweet with 3 likes about this paper.