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.
Architecture and Training
The architecture consists of three primary components:
- 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.
- 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.
- 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.
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