Model-based Large Language Model Customization as Service

Zhaomin Wu, Jizhou Guo, Junyi Hou, Bingsheng He, Lixin Fan, Qiang Yang

Abstract

Prominent Large Language Model (LLM) services from providers like OpenAI and Google excel at general tasks but often underperform on domain-specific applications. Current customization services for these LLMs typically require users to upload data for fine-tuning, posing significant privacy risks. While differentially private (DP) data synthesis presents a potential alternative, its application commonly results in low effectiveness due to the introduction of excessive noise on data for DP. To overcome this, we introduce Llamdex, a novel framework that facilitates LLM customization as a service, where the client uploads pre-trained domain-specific models rather than data. This client-uploaded model, optionally protected by DP with much lower noise, is inserted into the base LLM via connection modules. Significantly, these connecting modules are trained without requiring sensitive domain data, enabling clients to customize LLM services while preserving data privacy. Experiments demonstrate that Llamdex improves domain-specific accuracy by up to 26% over state-of-the-art private data synthesis methods under identical privacy constraints and, by obviating the need for users to provide domain context within queries, maintains inference efficiency comparable to the original LLM service.

Introduction: The Privacy-Utility Deadlock

When specialized institutions like banks or hospitals seek to leverage Large Language Models (LLMs) for domain-specific tasks—such as loan approval or medical diagnosis—they encounter a significant "privacy-utility" deadlock. Standard customization workflows typically require uploading sensitive private datasets to a service provider for fine-tuning, which constitutes a major security and regulatory risk.

Existing workarounds, such as Differentially Private (DP) data synthesis, attempt to mitigate this by generating synthetic data that mimics the original distribution. However, ensuring true privacy often requires adding substantial statistical noise, which leads to a sharp decline in model performance—a phenomenon known as "disparate impact." Llamdex addresses this challenge by enabling LLMs to gain domain expertise without the server ever accessing the client's raw data.

The Llamdex Framework: Shifting to Model-Sharing

Llamdex (Large language model with domain expert) introduces a paradigm shift from data-sharing to model-sharing. Instead of fine-tuning the entire LLM on private data, Llamdex inserts specialized, lightweight modules between the LLM's internal layers.

Overview of the Llamdex framework, illustrating the interaction between the Client (bank) providing an expert model and the LLM Server providing the base service.

Architecture and Training

The architecture consists of three primary components:

  1. Llamdex Encoder: This module translates the LLM's internal hidden states into a structured feature vector. It utilizes a token mapping module and a small, encoder-only language model (e.g., RoBERTa) to extract precise values from user queries.
  2. Expert Model: A small, efficient model (such as an MLP or XGBoost) trained by the client on their private data. By using DP-SGD (gradient perturbation) during training, the client can provide strong privacy guarantees with significantly less noise than required for full dataset synthesis.
  3. Llamdex Decoder: This component maps the expert model's predictions back into the LLM's embedding space, allowing the LLM to integrate the "expert opinion" into its final natural language response.

A key innovation is the training of these connecting modules without sensitive data. The client provides only a public schema (e.g., defining age as an integer between 0-100). The server then generates synthetic questions based on random data distributions fitting that schema, teaching the encoder to extract features based on linguistic patterns rather than specific data distributions.

Experimental Evaluation and Results

The framework was evaluated across five tabular datasets representing sensitive scenarios in finance, sociology, and healthcare: Titanic, Wine, Bank Marketing, Nursery, and Adult.

Accuracy comparison across datasets (Titanic, Wine, Bank, Nursery) under varying privacy budgets (epsilon). Llamdex consistently outperforms state-of-the-art private synthesis methods.

Key Performance Metrics

  • Accuracy Gains: Llamdex demonstrated superior performance, improving accuracy by up to 26% over state-of-the-art private synthesis methods (like PromptPATE) on the Wine dataset and 14% over LoRA fine-tuning on the Nursery dataset.
  • Inference Efficiency: Llamdex is approximately 29x faster than "Expert API" baselines. By embedding the expert logic directly into the LLM's internal layers, it avoids the overhead of structured external tool calls and multiple generation rounds.
  • Privacy Robustness: Under a privacy budget of $\epsilon = 1.0$, the success rate of Membership Inference Attacks (MIA) dropped from 0.130 to 0.059, confirming that Llamdex maintains high utility while providing robust privacy protection.

Conclusion and Future Directions

Llamdex successfully decouples general reasoning from domain-specific problem solving. While currently optimized for tabular data, future work will explore supporting multi-modal inputs (such as medical imaging) and multi-expert architectures using gating mechanisms similar to Mixture-of-Experts. By allowing clients to "plug in" their own private expertise, Llamdex paves the way for secure, high-performance LLM customization as a service.

Summary updated

BibTeX
@inproceedings{wu2025model,
  author = {Zhaomin Wu and Jizhou Guo and Junyi Hou and Bingsheng He and Lixin Fan and Qiang Yang},
  title = {{Model-based Large Language Model Customization as Service}},
  booktitle = {Conference on Empirical Methods in Natural Language Processing},
  year = {2025},
  url = {https://openreview.net/forum?id=dGHZ6VeD6R},
}
Figure