CoGenesis: A Framework Collaborating Large and Small Language Models for Secure Context-Aware Instruction Following

Kaiyan Zhang, Jianyu Wang, Ermo Hua, Biqing Qi, Ning Ding, Bowen Zhou

Abstract

With the advancement of language models (LMs), their exposure to private data is increasingly inevitable, and their deployment on personal devices has become a prevailing trend. In contexts laden with user information, enabling models to both safeguard user privacy and execute commands efficiently emerges as an essential research imperative. In this paper, we propose CoGenesis, a collaborative generation framework integrating large (hosted on cloud infrastructure) and small models (deployed on local devices) to address privacy concerns logically. Initially, we design a pipeline to create personalized writing instruction datasets enriched with extensive context details. Subsequently, we introduce two variants of CoGenesis based on sketch and logits respectively. Our experimental findings indicate that our CoGenesis framework, utilizing mixed-scale models, showcases competitive performance, providing a feasible solution to privacy issues.

Introduction: The Privacy Paradox in AI Assistants

We are currently facing a "privacy paradox" with AI assistants. To be truly useful, an AI needs access to "personal context"—writing styles, calendars, past emails, and specific preferences. However, the most capable models (like GPT-4) reside on cloud servers. Sending an entire digital life to a third-party API is a massive privacy risk. Conversely, running Small Language Models (SLMs) entirely on local devices is private but often lacks the complex reasoning capabilities of larger models.

The motivation for CoGenesis: balancing privacy and performance by splitting tasks between cloud LLMs and local SLMs.

CoGenesis addresses this challenge through "differential context exposure." The cloud-based LLM only sees general tasks, while the local SLM sees both the task and the private user context. This allows users to leverage LLM-level intelligence while keeping personal data strictly local.

Methodology: Collaborative Generation

The framework introduces two primary ways these models collaborate to bridge the performance gap:

  1. Sketch-based CoGenesis: This is a "sketch-then-fill" approach. The cloud LLM generates a high-level, logical outline (the "sketch") based on a general instruction. This sketch contains no private info. The local SLM then takes this outline and "fleshes it out" using private local data to produce the final, personalized response.
  2. Logit-based CoGenesis: This is a granular integration at the token level. For every word generated, the framework looks at the probability distributions (logits) from both models. A lightweight "CombModel" learns how to weight these inputs, allowing the LLM to provide logical structure while the SLM "nudges" word choice toward the user's specific style and facts.
The two variants of the CoGenesis framework: Sketch-based and Logit-based co-generation.

Experimental Results and Insights

To test this, the authors built a synthetic context-aware dataset of 1,500 fictitious user profiles and adapted benchmarks from the LaMP (Lab for Measuring Personalization) suite.

  • Performance: On the synthetic dataset, Logit-based CoGenesis achieved an overall score of 8.12, significantly higher than a standalone local SLM (7.44) and nearly matching the "Upper Bound" of an LLM with full context access (8.38).
  • The "Context Matters" Threshold: Researchers found that an SLM with access to personal context often outperforms a world-class LLM without it. This proves that for personal assistants, local data is often more valuable than raw model scale.
  • Security through Sparsity: In the logit-based approach, the system can be tuned to only upload the first few tokens of a response to the cloud for guidance, minimizing the data leaving the device.

Limitations and Future Work

While CoGenesis provides a feasible solution to privacy issues, several hurdles remain. Currently, the logit-based method requires the LLM and SLM to use the exact same tokenizer, limiting model pairing options. Future work will explore "tokenizer alignment" and testing on real-world, messy user logs. Additionally, the researchers aim to optimize inference overhead for lower-end mobile devices, as running multiple models simultaneously increases computational requirements.

Summary updated

BibTeX
@inproceedings{zhang2024cogenesis,
  author = {Kaiyan Zhang and Jianyu Wang and Ermo Hua and Biqing Qi and Ning Ding and Bowen Zhou},
  title = {{CoGenesis: A Framework Collaborating Large and Small Language Models for Secure Context-Aware Instruction Following}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2024},
  url = {https://openreview.net/forum?id=5vjuhU2bIi},
}
Figure