Crayon: Customized On-Device LLM via Instant Adapter Blending and Edge-Server Hybrid Inference
Paper · 2024 · Jihwan Bang, Juntae Lee, Kyuhong Shim et al.
Summary
A language assistant on a personal device has to fit the device’s computing budget. It also needs to handle the subjects its user cares about, even when the user can supply only a few examples of the questions they want answered. Repeating those examples in every request makes each request longer. Training the system again takes time and data. Crayon explores a different arrangement for large language models. It learns a collection of reusable adaptations in advance and uses a small set of examples to decide how to combine them for a particular task.
The adaptations are LoRA adapters, which supply compact changes to a fixed language system. Crayon trains its adapters jointly on multiple-choice questions from social reasoning, medicine and open-book exams. During training, each adapter is associated with a region in a space of numerical features extracted from the questions. At customization time, the device represents the user’s examples in that same space and measures how close they are to each adapter’s representative point. It sends the similarity scores to a server, which blends the corresponding adapters and returns the result. The examples themselves stay on the device in this blending procedure, and the blend requires no further training.
The authors test customization by treating each of the 57 subjects in MMLU as a separate user interest and supplying 10 examples per subject. Crayon reaches 44.6% average accuracy with LLaMA-7B on the device. A single adapter trained on the same source datasets reaches 40.7%, and the authors’ adaptation of LoraHub, which searches for a way to combine separately trained adapters, reaches 42.4%. A component comparison reports customization times of 0.2 seconds for Crayon and 49.7 seconds for the LoraHub baseline. In a separate comparison, examples from the subject being tested consistently produce a blend among the best observed for that subject, sometimes tied with blends made from other subjects.
Crayon also tests a way to use a larger server system selectively. The device produces an answer and compares its output with reference outputs prepared in advance. A low similarity score sends the question to LLaMA-30B, whose response replaces the local one. Sending 20% of MMLU questions to the server raises average accuracy to 47.6%. The benchmark therefore offers evidence for quick task customization and selective server assistance on multiple-choice questions. It represents user interests through subject labels, and the study leaves actual device latency, energy use and the privacy implications of the full hybrid setup open.
Deep dive: Crayon: Customized On-Device LLM via Instant Adapter Blending and Edge-Server Hybrid Inference
Crayon blends reusable adapters to customize a language system on a device and sends selected questions to a larger server for answers. · about 34 minutes to read
The problem and its context
When a few examples are all the user has
Crayon starts with a practical definition of customization. A user provides examples that show the kind of question they are interested in and the kind of answer it calls for. The system is then evaluated on other questions from that task. The examples serve as a compact description of the user’s needs. The problem is to make them count when the system runs on a device with limited computing resources and the collection is too small to make a conventional training exercise attractive. The authors study this through question answering.
Consider what it means to adapt a system to a subject such as jurisprudence or anatomy. The examples give it clues about vocabulary, the kinds of distinctions the questions draw and the form of the requested answer. The desired effect is better performance on fresh questions from that subject. Producing a different answer to one of the original examples would say little about this goal. The paper puts that distinction into the benchmark by giving each subject its own small customization set and testing the resulting adaptation on questions from the subject.
The authors frame local execution partly as a response to the cost of hosting customized systems centrally. A service that maintains many user-specific variants takes on storage and computation. A service that directly ingests the examples also receives whatever information those examples contain. Local execution changes where those costs and disclosures occur, but it introduces a constraint of its own. The size of the system a device can host limits the range and difficulty of the questions it can answer. Crayon addresses adaptation and access to a larger system as separate problems because the user who benefits from a specialized local system may also ask something outside its specialty.
Putting examples in the prompt
One option is to put worked examples directly in the input. In few-shot learning, as described in the paper’s discussion of earlier work, the examples precede the new question and show how the task is normally answered. A general-purpose system can draw on that context during inference. The approach is attractive when a user can demonstrate a task more easily than they can describe it in instructions. Each new request that includes the examples carries the additional text again. The effectiveness of demonstrations in the prompt is part of the reason the authors treat those same examples as a valuable input to customization. Language Models are Few-Shot Learners
The paper situates few-shot prompting alongside other approaches that give the system more material to work with during inference. Chain-of-thought prompting encourages it to produce intermediate reasoning along with an answer. Retrieval-augmented generation adds material selected from a database to help answer the current question. The latter is particularly relevant to knowledge-intensive tasks. These approaches supply different kinds of help. For the authors’ deployment problem, their common drawback is the cost associated with longer or more complex inputs. Chain-of-Thought Prompting Elicits Reasoning in Large Language Models · Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks
The related-work discussion also describes systems built expressly to handle an unfamiliar task given a few examples. CrossFit uses task names as prefixes. In the paper’s account, ReCross removes that requirement by retrieving relevant training material and incurs the cost of that retrieval. Crayon’s setup asks what can be inferred from the examples when the ordinary question prompt carries no explicit task name. This choice affects the training procedure as well. A task name would give the researchers a ready-made way to divide the training data among adapters, whereas Crayon derives the division from numerical features of the inputs. CrossFit
Changing a small part of the system
Another option is fine-tuning. Instead of depending on extra text at answer time, a training procedure can change the parameters used to process a question. Parameter-efficient approaches narrow the set of parameters that need to be learned. The fixed base retains the capabilities it acquired before customization. A smaller trainable component adds a change that can be associated with a particular dataset or task. LoRA, the adapter technique used by Crayon, represents such changes with products of smaller matrices. Parameter-Efficient Transfer Learning for NLP · LoRA
Reducing the number of trainable parameters helps with the expense of adaptation. The examples still need to support the updates, and an optimization procedure still needs to run each time the user asks for a new specialization. Crayon moves learning to an earlier stage and uses the examples later to select a blend of changes that already exist. The important question is whether the earlier training can produce adapters that are different enough to make changes in the blend useful. If the pool learned essentially the same update in every component, the choice of mixture would have little meaning.
The closest comparison in the paper is LoraHub. It trains adapters for defined upstream tasks and searches for coefficients that combine them for a new task. This establishes composition as a plausible way to reuse earlier training. Crayon changes the setup on both sides of that composition. It learns the pool jointly from inputs without task labels guiding the mixtures, and it attaches an indicator to each adapter so that examples can be mapped to coefficients directly. Where LoraHub spends work searching at customization time, Crayon spends work organizing the pool during preparation. LoraHub
The authors also distinguish their design from mixtures of experts, where different components respond to different inputs. In the token-level designs they review, a gate selects or weights components as the system processes individual tokens. The device would need access to multiple adapters during inference. The related task-level approaches the paper discusses assume a task identifier. Crayon instead prepares a single blended update for the whole customization task, based on the user’s example set. The local system then uses that update across the questions it receives under that customization. Pushing Mixture of Experts to the Limit
Deciding when to use the server
The larger system creates a second choice. Calling it for every query would make it the regular inference service. Calling it selectively requires some way to judge a local answer before asking the server to produce its own. The point is especially clear once the local system is specialized. The current question may belong to another subject, or it may be a hard question within the intended subject. The paper designs a common decision rule for those cases. It scores an output already produced on the device and uses the score to decide whether a replacement answer is worth requesting.
In the related-work discussion, speculative decoding offers a related use of small and large systems. A smaller system proposes what a larger one might produce, and the larger one verifies the proposal. That verification still involves the larger system. Crayon’s requirement for the routing decision is that it can be made on the device, using information sent there beforehand. This changes what the decision can establish. It can estimate whether a local answer is a good candidate to keep, while direct verification for the current question would require the server to process that question. Fast Inference from Transformers via Speculative Decoding
The method, step by step
What is prepared in advance and what runs on demand
Crayon separates pool preparation, customization and answering. The server learns a reusable pool of adapters once. At the start of a particular customization, the device reduces the user’s examples to a set of scores and sends them to the server. The server uses them to construct an adapter, which the device can apply to its local LLaMA-7B. During answering, the device works with that one task-specific adapter. The hybrid option adds a local routing check after the device has produced an output. LLaMA
This division gives the system different objects to keep in different places. The server keeps the learned pool, whose members can be reused across users and tasks. The device keeps the indicators that describe the pool’s organization and the adapter associated with its current task. With hybrid inference, the device also needs the reference outputs used by its router. The paper’s claim of instant customization concerns forming the adapter from the prepared pool. The training that made the pool possible is a separate cost.
Pool preparation, task customization and hybrid answering
The steps in order.
Finding a representative point for each adapter
The local base is a decoder-only Transformer. It generates a sequence by predicting the next token from the input and what it has already generated. For the purpose of organizing the adapter pool, the authors use an internal feature from the first self-attention layer. A query representation in that layer is part of the numerical machinery through which the system relates elements of the input to one another. Crayon uses values from the layer as a representation of the input question. The same base needs to supply these features during preparation and later on the device.
qₓ = M¹_{Φ₀}(x)
Here x is an input from the pool’s training data. qₓ is the query embedding that represents that input. M denotes the base language system and Φ₀ its original, frozen weights. The superscript ¹ identifies the first layer used for feature extraction. The expression M¹_{Φ₀}(x) denotes taking those intermediate features as the base processes x. It is distinct from generating an answer to x. The paper suppresses the notation for a dimensionality reduction step in this and the subsequent similarity expressions.
The reduction uses principal component analysis, or PCA. It expresses the features in fewer dimensions, keeping directions intended to capture prominent variation in the inputs. The authors use it before clustering to reduce noise and make meaningful differences in the features more prominent. Next, k-means groups the resulting points. That algorithm repeatedly associates points with nearby cluster centers and updates those centers to represent their assigned points. The number of centers is set to the number of adapters. Each center becomes an indicator for one adapter.
k = N
k is the number of clusters requested from k-means, and N is the number of adapters in the pool. The center assigned to adapter n is called cₙ, where n indexes its position in the pool. The center is derived from the training inputs, so its role is to mark a location in the feature space. It can represent a group of examples even when the training process has no name for that group. The default pool has 32 base adapters.
The source datasets have recognizable subjects and formats, so a supervised division would have been possible. Crayon’s clustering procedure does not require those dataset identities as a signal for assigning each example to an adapter. Inputs from different sources can contribute to the same neighborhood. Conversely, inputs from a single source can be close to different indicators. The method gives itself room to learn distinctions that do not follow the dataset boundaries exactly.
Training a pool through mixtures
Each adapter adds a trainable change to fixed weights. To train the pool, Crayon constructs a different blend for each training input. It starts by comparing that input’s feature with each indicator using cosine similarity. Cosine similarity measures how closely two vectors point in the same direction. At this stage the paper shifts and rescales the score so that the coefficients used to train the mixture are non-negative. It does not require them to add up to a fixed total across the pool.
αₙ(qₓ) = (cos_sim(cₙ, qₓ) + 1) / 2
αₙ(qₓ) is the training mixture coefficient for adapter n on the input with embedding qₓ. The function cos_sim computes cosine similarity between the adapter indicator cₙ and that input embedding. The constant 1 shifts the cosine score upwards, and division by 2 rescales it. Because each coefficient is computed from its own similarity, the formula allows several adapters to receive substantial weight on the same input. A close indicator is an invitation for stronger participation. It is not a hard assignment to the cluster that supplied that indicator.
Θₓ = α₁(qₓ)θ₁ + α₂(qₓ)θ₂ + ⋯ + αₙ(qₓ)θₙ + ⋯ + αₙ₌ₙ(qₓ)θₙ₌ₙ
Θₓ is the combined adapter weight for input x. Each θ denotes a base adapter’s weights, and the subscript identifies which adapter contributes them. Each α is the coefficient for that adapter evaluated at qₓ. The ellipses indicate the other adapters in the same sequence. The final term represents the adapter indexed by the total pool size N. The mixture changes with the input because its coefficients change, while the base adapter weights are shared across all the training mixtures.
The pool is optimized through these mixtures. A training question is processed using the base plus the change supplied by its blend. Its reference answer provides a signal to update the trainable pool weights. Examples near a particular indicator can repeatedly contribute more strongly through the associated adapter. Other inputs can bring a different set of adapters into stronger participation. This is the mechanism by which the paper expects differences in the features to lead to different roles within the pool. The grouping stage gives the coefficients some structure before the answer training begins.
max_Θ ∑_{(x,y) ∈ D_tr} ∑_{t=1}^{|y|} log p_{Φ₀ + ΔΦ(Θₓ)}(yₜ | x, y_{<t})
max_Θ denotes maximizing the objective with respect to the combined adapter weights, which depend on the trainable pool. D_tr is the training collection and (x,y) is an input paired with its reference output. The outer ∑ covers those pairs. The inner ∑ covers the output positions, with t starting at 1 and ending at |y|, the length of the reference output. yₜ is the reference token at position t, and y_{<t} is the reference sequence before that position. The vertical bar means that the prediction is conditioned on the question and that preceding sequence. p is the probability the adapted system assigns to the reference token and log is its logarithm. Φ₀ denotes the original parameters. ΔΦ(Θₓ) is the change supplied by the adapter mixture for x, so the subscript on p gives the effective weights used for the prediction.
In training, the components of the pool are the parameters that can change. The base’s original weights stay fixed. A base adapter may learn from many inputs across the sources because the same component is reused in their mixtures. Joint training therefore means more than starting several independent jobs together. The training prediction is made with a blend, and the resulting objective acts on the components that contribute to it. Their intended use at deployment is also collaborative, because a user’s adapter is built from the same pool.
The implementation uses Hugging Face PEFT and PyTorch 2.0.1. The default LoRA rank and scaling factor are both 4. Rank determines the size of the factors through which LoRA represents its update. The authors use AdamW with a learning rate of 0.0001 and a cosine annealing schedule, which varies that rate during optimization. They report a batch size of 128, a maximum of 800 iterations and execution on a single NVIDIA A5000 GPU. These settings describe the authors’ experimental implementation and the preparation cost belongs to the training environment.
Turning the user’s examples into an adapter
When a user supplies customization examples, the device extracts their first-layer query features. It then averages them. The average is a representation of the task as a whole. For example, a set of questions about management can supply a common signal even when each question concerns a different scenario. Representing the set by one vector allows the device to compare that vector with every indicator and use the results for subsequent questions from the task.
q_c = (1 / |D_c|) ∑_{x ∈ D_c} M¹_{Φ₀}(x)
D_c is the set of examples associated with the user’s customization task, and |D_c| is the number of examples in it. The sum ranges over their inputs x. The first-layer feature extractor M¹_{Φ₀} is the same one denoted in the training equations. The 1 divided by |D_c| turns the sum into a mean. The result q_c is the device’s task embedding. The equation uses the inputs to obtain that embedding. It gives no separate role to the reference answers as optimization targets during blending.
The device compares this task embedding with the indicators. There is a small ambiguity in the paper’s specification of this step. Its customization algorithm gives cosine similarity directly as the coefficient. The accompanying prose refers back to the training equation, where the cosine is shifted and rescaled. The paper’s algorithm for customization can be written as follows.
αₙᶜ = cos_sim(cₙ, q_c)
αₙᶜ is the coefficient for adapter n in the current customization, with the superscript ᶜ distinguishing it from an input’s training coefficient. cₙ is the corresponding indicator and q_c is the task embedding. cos_sim again measures directional similarity. The distinction between the two specifications matters because a raw cosine can give a negative weight, while the training expression gives non-negative weights. Both descriptions make the decisive operation a direct comparison in the feature space, with no search over mixtures or gradient update on the examples.
The device transmits the coefficients to the server. At that point the server has the values it needs to assemble the adapter from its pool. The paper expresses assembly using the product of each pair of LoRA factors. Each product represents the change contributed by the corresponding base adapter, and the transmitted coefficient determines how much of that change enters the new update.
θ̂ = ∑_{i=1}^{N} αᵢᶜ AᵢBᵢ
θ̂ is the weight of the customized adapter. i indexes the adapters, from 1 through N, the size of the pool. αᵢᶜ is the coefficient supplied for adapter i. Aᵢ and Bᵢ are its learned low-rank factors, and their juxtaposition means matrix multiplication in the order used by the paper. The ∑ adds those products after weighting each one. This expression combines the updates represented by the factor pairs. It does not assume that separately averaging the factors would produce the same update.
The server returns the resulting adapter for the device to use with its base. The ordinary question prompt follows the paper’s common template, with the question and its answer choices and without a task description or worked demonstrations. The adaptation resides in the effective weights. The user’s examples thus affect the answers indirectly, by setting the coefficients once for that customization. The next question can be answered without redoing the example comparison or supplying the examples as extra context.
Scoring a local answer for server escalation
The larger server system in the experiments is LLaMA-30B. It acts as a general answerer when called. The customization recipe has already changed the device’s system for the task, and the server keeps its own original specialization status. To make the routing decision locally, the paper proposes sending the device a collection of server outputs prepared for the customization examples. These outputs function as reference points, which the authors call prototypes.
S = { M_{Φₛ}(x_c) | x_c ∈ D_c }
S is the set of prototypes. M_{Φₛ} is the server language system with its weights Φₛ. x_c is an input from the customization set D_c. The vertical bar in braces means the set includes the result of applying the server system to each such input. Each result is a prototype, later written s. The paper puts prototype delivery alongside delivery of the blended adapter. How the server obtains those example-specific outputs under the stated data boundary is a separate issue for the deployment design.
When a new question arrives, the device first runs its customized system. It compares the resulting output with every prototype, using the same kind of directional similarity as in adapter selection. The role of the comparison is different here. It asks how closely the local output resembles the reference outputs, so the result can inform a choice about that question. The paper averages the similarities across the prototype set.
rₓ = (1 / |S|) ∑_{s ∈ S} cos_sim(oₓ, s)
rₓ is the routing score for question x. oₓ is the output of the customized device system on that question. s is a member of the server prototype set S, and |S| is the size of the set. cos_sim(oₓ, s) is the cosine similarity between the device output and the prototype. ∑ adds the comparisons across the set and the factor 1 / |S| gives their arithmetic mean. The expression presupposes comparable numerical representations for the outputs. The paper mainly describes them in terms of their role as outputs and does not fully specify the representation used to obtain that compatibility.
rₓ < r_th
rₓ is the local routing score and r_th is the empirically chosen threshold. The less-than sign gives the condition under which the question is sent to the server. At or above the threshold, the device keeps its original answer. When the condition is met, the server answers the question and its result takes the place of the local one. The decision therefore operates before the current server answer is available, with reference information prepared from earlier examples. Since the local answer is already produced, the hybrid path includes local work as well as the work of the server.
Experiments and results
Training sources and the customization benchmark
The pool is trained on three public multiple-choice datasets, each contributing a different kind of question. Social Interaction QA, abbreviated SIQA, concerns actions and their social implications. MedMCQA, called MCQA in the paper, draws on medical entrance examination questions. Openbook QA, abbreviated OBQA, supplies questions in an open-book examination style. Their range creates a setting where it makes sense to ask whether inputs can lead different adapters to take different roles. The relevant training signal still takes the same broad form across the sources. Each question has an answer the system is meant to predict. MedMCQA
The target benchmark is built from MMLU. The authors wanted data in which examples for the same user could be grouped and customization could be assessed quantitatively. They describe existing dialogue collections as lacking the user identities their experiment would require. MMLU offers a substitute through its subject annotations. Each of its 57 subjects becomes a separate task and stands in for the interest of a distinct user. A set of 10 examples defines the customization for each subject. The accuracy measurements then concern the questions used to test that customization. Measuring Massive Multitask Language Understanding
The subject arrangement matters to the interpretation of the results. The pool learns from source collections, then the experiment asks whether it can be reused on MMLU subjects. The authors can hold the test questions for a subject fixed and vary the examples that describe the task. They can also add questions from a subject outside the current customization when studying routing. This makes the subject labels useful for constructing and assessing the experiment, even though the ordinary prompt does not give the system an explicit subject cue.
Accuracy, reported as Acc in the paper, measures the proportion of questions answered correctly. Alongside the overall average, the main table presents results for four subject groups: STEM, humanities, social sciences, and other subjects. The appendix lists results for individual subjects. Those different views help separate broad effects from local ones. A system can have the highest average of the local configurations while trailing a baseline on particular subjects. For grouped comparisons below, the figures come from the main results table, whose category summaries are the ones the authors discuss in the body of the paper.
What the baselines control for
The unadapted LLaMA comparisons establish how well the base can answer the questions with no adapter. The authors report LLaMA-7B and LLaMA-13B under a zero-shot prompt, meaning that no worked examples are supplied with the test question. They also include the reported few-shot scores for those sizes. The few-shot prompt supplies examples and names the subject. This gives context for the benefit of additional input and system size, while the zero-shot rows provide a closer match for Crayon’s short question format.
Single LoRA takes a different approach to the same training material. It trains one adapter on the combined source datasets and then uses that adapter for every subject. It can benefit from training on the sources, but it applies the same adaptation for any user interest. Comparing it with Crayon on the same local base asks whether composing an update for a specific task helps beyond the gain from a general adapter. The default comparison is made at rank 4. The main table reports the same on-device parameter size for both configurations, 7B + 14M.
The baseline named Single LoRA (few-shot) starts with that universal adapter and fine-tunes it further using the customization examples. In this row, “few-shot” refers to additional weight updates with a small example set. In the plain LLaMA rows it refers to putting examples in the prompt. This distinction is essential when reading the scores. The further-trained adapter tests a direct use of the examples as training data, while Crayon uses them as evidence for mixture coefficients.
The LoraHub baseline tests adapter composition through another procedure. In the authors’ adaptation of LoraHub, LLaMA-7B takes the place of FLAN-T5, and SIQA, MCQA and OBQA take the place of BBH as the upstream material. The baseline trains adapters for the source tasks separately and searches for coefficients using the customization examples. This is a comparison between implementations adapted to the same application. It gives evidence about the approach under the authors’ setup, including the cost of finding the coefficients, while the performance of LoraHub in its original experimental setting is a different question. LoraHub
Accuracy with the local system
The main table places unadapted LLaMA-7B at 31.0% average MMLU accuracy with the zero-shot prompt and at 35.1% with few-shot prompting. For LLaMA-13B the corresponding averages are 41.1% and 46.9%. Single LoRA reaches 40.7%, showing what one broadly trained adapter can do for the smaller base before tailoring the weights to a particular subject. Its variant further fine-tuned on the few examples reaches 33.5%. The authors attribute that decline to the limited customization data. The experiment establishes a decline under the recipe they tested and provides no broad ranking of few-example optimization recipes.
LoraHub reaches 42.4% average accuracy in the adapted comparison, and local Crayon reaches 44.6%. This makes Crayon the stronger of the adapter-based local configurations in the table. It also exceeds the zero-shot result of the larger LLaMA-13B. The few-shot LLaMA-13B result of 46.9% sets a higher average than local Crayon. The prompt condition is therefore essential to the comparison with that larger base. The authors’ case for customization is strongest when the question is how to use a 7B base locally under the short input format.
Local and hybrid configurations on MMLU average accuracy
Blending improves the small local system, and selective server help raises its accuracy further.
The numbers
| System or setting | accuracy % |
|---|---|
| LLaMA-7B zero-shot | 31.0 |
| LLaMA-7B few-shot | 35.1 |
| LLaMA-13B zero-shot | 41.1 |
| LLaMA-13B few-shot | 46.9 |
| Single LoRA | 40.7 |
| Single LoRA further fine-tuned | 33.5 |
| LoraHub | 42.4 |
| Crayon local | 44.6 |
| Crayon with hybrid routing (this paper) | 47.6 |
The subject groups show where the local gain over Single LoRA comes from. On STEM, the main table gives Crayon 36.1% and Single LoRA 33.2%. On humanities the scores are 50.0% and 44.6%. The social-sciences scores are 49.8% and 43.4%, and the other-subjects scores are 46.0% and 44.6%. All are accuracy figures for the corresponding MMLU groups. Comparing with LoraHub, the group results again favor Crayon across the main table, including 49.8% against 46.2% for social sciences and 36.1% against 35.1% for STEM.
The subject-level results put some boundaries around those averages. In the appendix, local Crayon scores 49.6% on Anatomy, compared with 52.6% for LoraHub. On Astronomy, the corresponding figures are 43.4% and 44.7%. There are also subjects where the comparison goes the other way. On Abstract Algebra, Crayon reaches 30.0% and LoraHub 32.0%, whereas College Biology produces 47.9% for Crayon and 46.5% for LoraHub. A user interest is represented by an individual subject in the benchmark, so that variation is part of the customization result. The average describes the whole collection of subjects.
What selective routing buys
For the hybrid experiment, the decision threshold is chosen empirically to send 20% of questions to LLaMA-30B. The resulting system reaches 47.6% average MMLU accuracy. Fully using LLaMA-30B reaches 53.2% on the benchmark as reported by the authors. Those results place the hybrid between the local path and the always-server setting on accuracy. The server fraction describes how frequently the larger system is called. It is a different quantity from the amount of computation or time consumed by those calls.
The hybrid average of 47.6% also exceeds the few-shot LLaMA-13B baseline of 46.9%. The device component of the hybrid is still the adapted 7B system. Its answers in the routed cases come from a larger server, so the result compares deployment arrangements with different computational resources. It shows how an intermittent call to a larger system can improve the local offering at the paper’s chosen routing level. The experiment does not establish that the hybrid has lower total execution cost than every baseline it exceeds on accuracy.
The main table reports higher hybrid accuracy for each of the broad subject groups than for local Crayon. For the hybrid, the group figures are 38.6% in STEM, 53.6% in humanities, 57.6% in social sciences and 48.6% in other subjects. The appendix also shows that individual subjects can behave differently. On Astronomy the hybrid result is 50.0% against 43.4% for local Crayon. On College Chemistry, it is 31.0% against 33.0% for local Crayon. Routing is an intervention on selected answers, and its overall benefit permits cases where replacing a local answer hurts subject-level accuracy.
What the ablations show
Whether the examples describe the right task
To test whether the adaptation is genuinely sensitive to the user’s examples, the authors select two subjects from each of the MMLU groups. They vary the subject used to customize the adapter and evaluate it on the selected test subjects. This creates a crossing of customization and test data. Each test subject can be evaluated with its own matching customization examples and with examples from the other subjects. The base and pool are shared, so the manipulation is what information the blend receives about the intended task.
Management gives a clear example. On Management test questions, the adapter configured with Management examples scores 58.3% accuracy. Configuring the adapter with Jurisprudence examples gives 50.5% on the same test subject. Examples from World Religion or High School Geography both lead to 57.3%. The spread shows that the adaptation can respond to the subject of the examples, with some unrelated example sets producing blends that remain competitive on the test subject.
MMLU Management accuracy by the subject of the customization examples
Management examples produce the strongest blend for Management questions among these example sets.
The numbers
| System or setting | accuracy % |
|---|---|
| Jurisprudence examples | 50.5 |
| High School Physics examples | 51.5 |
| World Religion examples | 57.3 |
| High School Geography examples | 57.3 |
| Management examples (this paper) | 58.3 |
The matched setting attains the best observed score, including ties, for each test subject in this analysis. The ties matter. For instance, Anatomy test accuracy is 49.6% with Anatomy examples, and the same score appears with High School Physics and Jurisprudence examples. On World Religion, matched examples give 70.2%, a score also achieved by other example sets in the comparison. High School Geography gives a clearer peak at the matched setting, at 60.1%. The study supports subject-sensitive composition without requiring every subject to have a uniquely identifiable optimal blend.
This control is useful because a gain over Single LoRA could, in principle, come solely from having trained the pool jointly and could persist with almost any sensible choice of user examples. Holding the test subject fixed and changing the customization subject makes the dependence on the examples visible. It is evidence that the user-side calculation contributes information beyond the pool’s general usefulness. The selected subjects and their ties also show why the result is best read as evidence of useful task information at benchmark scale.
Which part of composition improves accuracy and time
The component comparison replaces parts of Crayon with the corresponding choices from LoraHub. The first configuration is the adapted LoraHub baseline. It trains adapters individually on defined source tasks and uses learning-based search for the coefficients. The intermediate configuration uses Crayon’s joint pool training and retains the search. The final configuration is complete Crayon, using the joint pool and cosine-based coefficient selection. This sequence tests the pool change with the search procedure in place and then tests removing search within the jointly trained pool.
The accuracy sequence on MMLU is 42.4%, 44.5% and 44.6% across those configurations. Moving to joint training while retaining search accounts for the large accuracy change in this sequence. Replacing search with the similarity rule then gives an average close to that already obtained with the jointly trained pool. That last comparison supports the intended role of the indicators. The pool trained with indicator-dependent weights can be composed effectively using the same feature space when a new task arrives.
Customization time for the configurations in the MMLU component comparison
Similarity-based blending removes most of the customization time observed with coefficient search.
The numbers
| System or setting | seconds |
|---|---|
| Task-wise training with coefficient search | 49.7 |
| Joint training with coefficient search | 51.0 |
| Crayon joint training with cosine blending (this paper) | 0.2 |
The timing comparison shows that joint training alone leaves the customization delay associated with search. The authors report 49.7 seconds for the task-wise training and search configuration and 51.0 seconds for joint training with search. The complete Crayon configuration takes 0.2 seconds. These are reported customization times in the component comparison. They should be read alongside the accuracy sequence because the central practical result is that the faster rule retains the accuracy obtained with search in the jointly trained pool.
There are limits to what this sequence isolates. The change from task-wise training to Crayon’s pool changes both how the training examples contribute to the adapters and how the adapters are organized for later use. The table does not display a configuration with task-wise training paired with Crayon’s cosine rule. It supports the particular sequence of choices tested. In particular, it shows that the indicators work as an efficient selector for the pool whose training was designed to give those indicators meaning.
Evidence that adapters acquire different roles
The authors inspect the training coefficients associated with selected adapters. For each selected adapter, they plot how frequently examples from each source receive weights in different ranges. An adapter whose coefficient distribution favors one source participates more strongly in mixtures for that source. This provides an interpretable signal about the kind of division the pool has developed. It is a view of how the adapters are used during training, independent of the headline benchmark comparison.
The paper illustrates four adapters from the pool of 32. The adapter indexed 0th is more strongly associated with SIQA, the 24th with MCQA, and the 28th with OBQA. The 11th has a more even distribution across the sources. The coexistence of a broadly used adapter and ones showing a preference is consistent with the fact that every input can weight multiple components. The pool is free to assign a role shared across sources as well as roles that align more closely with particular collections.
Those source labels are used to interpret the plotted distributions after training. They were not supplied as instructions to the mixture. This makes the association informative about the features and indicators. It also leaves open how to interpret an individual adapter’s knowledge. The plot shows differences in coefficient distributions. Testing each adapter independently on each source would answer a further question about which distinctions it could handle on its own, and the illustrated distributions are evidence about participation in the joint system.
The appendix examines PCA by comparing the coefficients for one training point with and without dimensionality reduction. It plots how each coefficient deviates from the mean across adapters for that point. With PCA, the paper reports a deviation 100 times as large. The example illustrates the intended effect of PCA, which is to give the weighting more contrast across the pool. It is an example-level diagnostic. The authors use it to motivate an ingredient that encourages diverse use of the adapters, and the comparison does not directly measure the ingredient’s effect on average held-out accuracy.
Pool size, example count and rank
The authors vary the number of customization examples and compare pools with 16 and 32 adapters. For the example-set sizes they test, they report that Crayon remains capable of customization with either pool size. The larger pool shows a notable performance advantage when the example count is held fixed. In that range, the supply of reusable adapters matters alongside how much evidence the user gives about the task. Additional examples can represent the task more fully, while additional adapters give the blending procedure more learned updates to draw from. Those are different ways of adding capacity to the procedure.
The rank study compares blended customization with a single universal adapter as the available rank changes. At rank 2, the reported gap is marginal, with the blend still slightly ahead. At rank 4 and above, the authors describe a much wider difference. Their interpretation is that very low rank restricts the adapters’ ability to express the distinctions between tasks. Since the comparison varies rank for the approaches being tested, it connects the benefit of blending to the capacity of the updates available to blend. The figure establishes a trend for the ranks and data in the study.
These experiments give different information from the component ablation. The latter asks how results change when the pool construction or coefficient selection procedure changes. The sensitivity figures ask whether the benefits depend on the amount of material presented by the user or on the pool’s representational capacity. Together they explain why shortcutting coefficient search can work while still leaving meaningful choices about pool preparation.
Whether the router selects useful questions
The router is compared with a rule based on the maximum softmax score. That baseline uses the largest probability from the system’s output distribution as a signal of confidence. It gives the experiment a direct alternative with the same broad objective, which is to identify answers worth passing to the server. By varying the routing fraction and comparing methods at shared fractions, the authors ask which criterion makes better use of a given level of server involvement.
On customized tasks, the prototype-based rule gives higher accuracy at all the routing fractions shown. The authors also test a mixture of questions from the customized subject and from a non-customized subject. They report a similar advantage there. This supports the rule as a way of selecting questions whose server answers improve final accuracy under the experimental conditions. Including questions outside the customized subject also reflects the authors’ motivating case, where users may turn from a topic they prepared their device for to another kind of request.
The comparison is an evaluation of final answer accuracy, with routing fraction as the constraint. Success can arise because a rule escalates difficult in-subject questions, unfamiliar questions, or both, when the server can answer them correctly. The reported advantage does not identify how well the score distinguishes those reasons. It establishes that the prototype comparisons make better routing choices than the softmax baseline for these test mixtures.
Limitations
Limits the authors state
The authors describe their demonstration as customization for unseen target tasks in question answering. They anticipate that the method could extend to other language tasks with sequential outputs. Such an extension would require evidence from those tasks. For example, generating an extended answer would create new questions about how to evaluate the adaptation and about what output representation should drive the router. The paper’s measured accuracy concerns multiple-choice questions, where answers can be scored against a supplied reference choice.
The authors also suggest that larger training collections and a pool with more adapters could support a wider range of target tasks. The tested comparison between pool sizes is consistent with an advantage from additional adapters in the studied setting. The larger claim remains a proposal because the diversity available in a pool also depends on the data and how well the features organize it. An increase in the number of learned components is only one part of that question.
The paper identifies biases in training data as a possible source of biased output. It also flags the energy demands of running demanding workloads on personal hardware, especially when battery life matters. The experiments answer questions about accuracy and customization time in the reported setup. They leave the magnitude of those potential effects open. The resulting deployment claims should be read at the level of the operations and measurements the paper actually describes.
What the experimental setup leaves open
The benchmark uses subject membership as a substitute for user identity. This yields a clear experimental task and an available correctness metric. A subject such as Anatomy provides a common topic across questions, while real customization may concern style, recurring entities, preferred levels of detail or the user’s way of asking for help. Users can also have overlapping interests and change them during use. The MMLU construction supports conclusions about adapting to a supplied subject from a small sample. Its design leaves performance on those other forms of personalization unmeasured.
The sources and targets also share the multiple-choice setting. The pool can learn something reusable across collections while still benefiting from common properties of the questions and answers. The average accuracy across MMLU subjects does not by itself isolate generalization across answer formats, modes of interaction or kinds of instruction. Similarly, the benchmark treats the customization set as available for each target subject. It gives little information about what happens when users provide conflicting examples or a collection that covers several tasks at once.
Averaging example features makes the task representation easy to send through the indicator calculation. The average also compresses away distinctions among examples within the set. If a set contains questions in several different feature regions, its mean may describe a point with weak resemblance to some of them. The paper tests changes in example-set size under its subject setup. It leaves the effects of mixed, atypical or mislabeled customization examples uncertain. The train-time and deployment-time formulas also leave an implementation ambiguity about the scaling of cosine coefficients at customization, which matters for exact reproduction.
The component timings come from the authors’ experiment using an NVIDIA A5000 GPU. The paper reports a size for the device configuration and presents a division of work suitable for its intended architecture. It gives no measured end-to-end customization latency on a handset, including transmission and installation of the adapter, and no local answer latency or battery measurements. The reported 0.2 seconds thus quantifies customization in the component experiment. The routing ratio likewise quantifies the share of questions referred to the server, independent of network behavior, server workload and the time the device already spent on the first answer.
There is also a difference between the compactness of the individual factors and the representation needed for their sum. A product of two low-rank factors describes one compact update. Adding several such products can produce a matrix whose rank exceeds that of an individual update. The paper reports the same on-device size of 7B + 14M for Single LoRA and Crayon, but its blending equation alone leaves open how the combined update is represented at that size. The parameter figure is the reported setup. Deriving the exact storage or per-query inference implications from the formula would require details of the representation used for deployment.
What the data boundary covers
The blending exchange has a clear data boundary in the design. After extracting and averaging features locally, the device sends a vector of adapter coefficients. The server produces an adapter from that vector. This reduces direct exposure of the customization examples during the blending step. The coefficients still depend on the examples. The paper offers no measurement or formal bound on what a recipient could infer about the examples or the user’s subject interests from those values.
The full hybrid procedure raises another question. The prototypes are defined as outputs of the server system on inputs from the customization set, and the server is described as deploying those prototypes to the device. The paper leaves open how those outputs are obtained while keeping the example inputs local. The coefficient vector, as specified, provides the information needed to blend adapters. The prototype definition instead calls for server processing of example inputs. This unresolved setup detail limits how far the privacy argument for blending can be extended to the hybrid procedure as a whole.
Finally, the hybrid design sends the current question to the server when the local score falls below the threshold. Some queries therefore cross a different boundary from the one governing customization examples. The accuracy results do not reveal which queries contain personal details or what could be inferred from the pattern of escalations. They show a routing benefit at an empirically chosen threshold. The evidence for operating that threshold under changing user behavior, a different server or a different mix of subjects remains open.
What came after
The later paper linked to Crayon is a survey of personalized generation. Its citation places Crayon in a broader discussion of how language systems can adapt to particular users or tasks. Crayon supplies a specific example within that scope. A small example set determines a blend of previously learned adapters, and the resulting on-device system can refer selected questions to a larger server. The citation establishes a connection to the survey literature. It gives no basis for attributing an implementation, modification or new evaluation of Crayon to the survey. Personalized Generation In Large Model Era: A Survey
Cite
Cite as Jihwan Bang, Juntae Lee, Kyuhong Shim, Seunghan Yang and Simyung Chang. 2024. Crayon: Customized On-Device LLM via Instant Adapter Blending and Edge-Server Hybrid Inference. Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers).
@inproceedings{bang2024crayon,
title = {{Crayon: Customized On-Device LLM via Instant Adapter Blending and Edge-Server Hybrid Inference}},
author = {Jihwan Bang, Juntae Lee, Kyuhong Shim, Seunghan Yang and Simyung Chang},
booktitle = {Proceedings of the 62nd Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)},
year = {2024},
doi = {10.18653/v1/2024.acl-long.204},
url = {https://doi.org/10.18653/v1/2024.acl-long.204}
}This page in Markdown https://md.research.elamur.ai/free/en/papers/bang-2024-crayon-customized-device-llm-instant/