On-Device Adaptation and Personalization › The Budget and Trust Envelope

Michael BrenndoerferDecember 1, 20265 min read
Language AI HandbookAll chapters
Part 43 of 67Small and On-Device Language Models
Chapter 329On-Device Adaptation and Personalization › The Budget and Trust Envelope
Reading section 2 of 11 · The Budget and Trust Envelope · 5 minSection 2 of 11 · 5 min

Section 2 of 11 · 5 min read

Reading settings

Definitions

Choose how many terms have tooltips.

Article links

Make inline references clickable

Notes & comments

Write down both where the data may go and how much work the device can sustain. A design can fit the hardware while exporting data the user expected to stay local.

The privacy constraint

In this chapter, a local-only personalization path keeps raw examples, derived records and personalized weights on the device. That is a design boundary. Check backups, sync, logs, diagnostics and any cloud fallback as separate flows. A local-only path removes the server copy for those flows only when they are disabled or keep the same boundary. It does not protect data from access on a compromised device.

Keep private evaluation examples local as well. You can still use public or synthetic cases in a shared test suite. An explicit opt-in research or sync flow is a different data path. Give it its own purpose, permissions and retention policy.

Show users which editable records the app stores, and give them a way to disable and reset the parts that are not represented as individual records. A settings screen is one control. The deletion and export paths must enforce the same policy.

The compute and memory budget

Separate disk storage, peak runtime memory, update compute and energy, and time spent answering requests. An adapter checkpoint may fit on disk even when its backward pass does not fit in RAM. Retrieval can add lookup time and prefill tokens without changing how the model decodes one token at an unchanged prefix length.

The example below isolates trainable-state memory for an FP32 Adam accounting model. It counts the parameter, its gradient and two Adam moment arrays, each at four bytes per trainable parameter. Kingma and Ba, Algorithm 1 describes the two moments. It does not count frozen weights, saved activations, allocator overhead or temporary buffers. Mixed-precision layouts vary. The QLoRA paper illustrates backpropagation through a frozen quantized base to trainable adapters, so freezing the base does not eliminate the backward pass.

A 100-million-parameter update costs 1,600 decimal MB under this accounting. An illustrative adapter with 0.5% as many trainable entries costs 8 MB for the same parts. The ratio is 200 to 1 for the counted arrays. It is not a measured peak-memory ratio.

PythonIn [3]
CollapseExpand
import numpy as np

base_params = 100_000_000  # frozen 100M-parameter base model
bytes_fp32 = 4  # full-precision training copy
adapter_fraction = 0.005  # 0.5% trainable, LoRA-style


# Memory per parameter in fp32 Adam full fine-tuning:
# parameter + gradient + first moment + second moment = 4 copies.
def training_bytes(n_trainable):
    return 4 * bytes_fp32 * n_trainable


full_trainable = base_params
lora_trainable = int(base_params * adapter_fraction)

memory_mb = {
    "Full fine-tuning": training_bytes(full_trainable) / 1e6,
    "LoRA adapter": training_bytes(lora_trainable) / 1e6,
}
print({k: round(v, 1) for k, v in memory_mb.items()})
VisualizationOut [4]
CollapseExpand
Bar chart comparing full fine-tuning memory to LoRA adapter memory.
Counted FP32 Adam weights, gradients and moments for 100 million versus 500,000 trainable entries. The plot omits frozen weights, activations and other memory.

Set a separate ceiling for peak memory and time per update. Schedule heavier work when foreground responsiveness and power are acceptable. Measure on the supported hardware. A memory figure by itself does not tell you whether an update will finish before the app loses its opportunity to run.

Check where your stack performs training. Apple’s Core ML personalization sample updates an updatable drawing classifier on the user’s device. Apple lists an Apple silicon Mac with at least 32 GB of memory or a Linux GPU machine for its Foundation Models adapter training toolkit 26.0.0. That final toolkit release targets macOS, iOS, iPadOS and visionOS 26. The hardware you train on and the devices that load the finished adapter can differ.

The data you actually get

Separate deliberate instructions from observed actions. A person who asks the app to remember a name provides a different signal from someone who happens to leave a suggested name unchanged. An unedited suggestion may be correct, or the user may have chosen not to check it.

Collect examples for a stated purpose. Store user-editable facts and explicit preferences where they can be changed. If you train on examples of a style, remove identifiers and other unnecessary content before fitting. This reduces what enters training. It is not a privacy guarantee.

Comments

Add to the conversation

A question, a correction, or an example from your own work.

No comments yet. Be the first to share your thoughts!

Newsletter

Stay up to date

Get new articles, book updates, and notes on AI and technology.

Unsubscribe at any time. Privacy policy