[{"data":1,"prerenderedAt":4},["ShallowReactive",2],{"readme:c2c":3},"\u003Cdiv align=\"center\">\n  \u003Cimg src=\"https:\u002F\u002Fraw.githubusercontent.com\u002Fthu-nics\u002Fc2c\u002FHEAD\u002Fresource\u002Flogo.png\" alt=\"Cache-to-Cache Logo\" width=\"100\" \u002F>  \u003Ch1>Cache-to-Cache\u003C\u002Fh1>\n  \u003Ch3>Direct Semantic Communication Between Large Language Models\u003C\u002Fh3>  \u003Cp>\n    \u003Ca href=\"https:\u002F\u002Ffuvty.github.io\u002Fthinking_yard_project_page\u002Fprojects\u002Fc2c\u002F\" rel=\"nofollow ugc noopener\">🌐 \u003Cb>Project Page\u003C\u002Fb>\u003C\u002Fa> •\n    \u003Ca href=\"https:\u002F\u002Farxiv.org\u002Fabs\u002F2510.03215\" rel=\"nofollow ugc noopener\">📑 \u003Cb>Paper\u003C\u002Fb>\u003C\u002Fa> •\n    \u003Ca href=\"https:\u002F\u002Fhuggingface.co\u002Fnics-efc\u002FC2C_Fuser\" rel=\"nofollow ugc noopener\">🤗 \u003Cb>HuggingFace\u003C\u002Fb>\u003C\u002Fa> •\n    \u003Ca href=\"https:\u002F\u002Fhuggingface.co\u002Fspaces\u002Fnics-efc\u002FC2C_demo\" rel=\"nofollow ugc noopener\">🚀 \u003Cb>Live Demo\u003C\u002Fb>\u003C\u002Fa>\n  \u003C\u002Fp>\u003C\u002Fdiv>\u003Cp>Cache-to-Cache (C2C) enables Large Language Models to communicate directly through their KV-Caches, bypassing text generation. By projecting and fusing KV-Caches between models, C2C achieves 8.5–10.5% higher accuracy than individual models and 3.0–5.0% better performance than text-based communication, with 2.0× speedup in latency.\u003C\u002Fp>\n\u003Cp>Feel free to star the repo or cite the paper if you find it interesting.\u003C\u002Fp>\n\u003Cpre>\u003Ccode class=\"language-bibtex\">@article{fu2025c2c,\n    title={Cache-to-Cache: Direct Semantic Communication Between Large Language Models}, \n    author={Tianyu Fu and Zihan Min and Hanling Zhang and Jichao Yan and Guohao Dai and Wanli Ouyang and Yu Wang},\n    journal={arXiv preprint arXiv:2510.03215},\n    year={2025},\n}\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cblockquote>\n\u003Cp>\u003Cstrong>Why \"Rosetta\"?\u003C\u002Fstrong> The Python package is named after the \u003Cstrong>Rosetta Stone\u003C\u002Fstrong>, the ancient artefact that unlocked the translation of Egyptian hieroglyphs by presenting the same text in multiple scripts. Likewise, C2C translates KV-cache representations between otherwise independent LLMs, allowing them to speak a common language in a richer and more direct way.\u003C\u002Fp>\n\u003C\u002Fblockquote>\n\u003Ch2>News\u003C\u002Fh2>\n\u003Cp>[2026\u002F09] 🤔 We will soon be releasing agent-managed KV-Cache in this repo, along with the corresponding serving system, as our next step forward. Stay tuned!\u003C\u002Fp>\n\u003Cp>[2026\u002F01] 🎉 Our paper is accepted by the ICLR'26 conference. Welcome to discuss more about it in Brazil.\u003C\u002Fp>\n\u003Cp>[2025\u002F12] 🧪 Multi-sharer support is now available! Fuse KV-caches from multiple sharer models to a single receiver. This feature is in preliminary stages and we are still actively working on it. See \u003Ccode>live_chat_example.py\u003C\u002Fcode> for usage.\u003C\u002Fp>\n\u003Cp>[2025\u002F11] 🚀 Thank you for the enthusiasm from the community! \u003Ca href=\"https:\u002F\u002Fhuggingface.co\u002Fspaces\u002Fnics-efc\u002FC2C_demo\" rel=\"nofollow ugc noopener\">Live demo\u003C\u002Fa> is now available! Try C2C in action with side-by-side model comparison.\u003C\u002Fp>\n\u003Cp>[2025\u002F10] 🤗 Our paper is featured as the \u003Cstrong>#1 Paper of the Day\u003C\u002Fstrong> on \u003Ca href=\"https:\u002F\u002Fhuggingface.co\u002Fpapers\u002F2510.03215\" rel=\"nofollow ugc noopener\">Hugging Face Daily Papers\u003C\u002Fa>\u003C\u002Fp>\n\u003Ch2>Demo\u003C\u002Fh2>\n\u003Cdetails open>\n\u003Csummary>\u003Cb>Combined Wisdom\u003C\u002Fb>\u003C\u002Fsummary>\u003Cblockquote>\n\u003Cp>Only by combining latent semantics from both Qwen2.5 and Qwen3 can this philosophical question be correctly answered.\u003C\u002Fp>\n\u003Cp>\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fuser-attachments\u002Fassets\u002Fc36ffaa1-0297-4ed8-b472-1fbbd9cc397f\" rel=\"nofollow ugc noopener\">https:\u002F\u002Fgithub.com\u002Fuser-attachments\u002Fassets\u002Fc36ffaa1-0297-4ed8-b472-1fbbd9cc397f\u003C\u002Fa>\u003C\u002Fp>\n\u003C\u002Fblockquote>\n\u003C\u002Fdetails>\u003Cp>The demo can be reproduced with \u003Ccode>script\u002Fplayground\u002Fgradio_demo.py\u003C\u002Fcode>.\u003C\u002Fp>\n\u003Ch2>Environment Setup\u003C\u002Fh2>\n\u003Cp>Create a new environment:\u003C\u002Fp>\n\u003Cpre>\u003Ccode class=\"language-bash\">conda create -n rosetta python=3.10\nconda activate rosetta\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>Install the package:\u003C\u002Fp>\n\u003Cpre>\u003Ccode class=\"language-bash\">pip install -e .\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Cp>For training and evaluation, install additional dependencies:\u003C\u002Fp>\n\u003Cpre>\u003Ccode class=\"language-bash\">pip install -e \".[training,evaluation]\"\n\u003C\u002Fcode>\u003C\u002Fpre>\n\u003Ch2>How to\u003C\u002Fh2>\n\u003Ch3>Use existing C2C Fusers\u003C\u002Fh3>\n\u003Cp>Minimal example to load published C2C Fuser weights from the Hugging Face collection and run the provided inference script. See the \u003Ca href=\"#supported-model-pairs\" rel=\"nofollow ugc noopener\">full list of available fuser pairs\u003C\u002Fa>. \u003C\u002Fp>\n\u003Cpre>\u003Ccode class=\"language-python\">import torch\nfrom huggingface_hub import snapshot_download\nfrom script.playground.inference_example import load_rosetta_model, run_inference_example\n\ncheckpoint_dir = snapshot_download(\n    repo_id=\"nics-efc\u002FC2C_Fuser\",\n    allow_patterns=[\"qwen3_0.6b+qwen2.5_0.5b_Fuser\u002F*\"],\n)\n\nmodel_config = {\n    \"rosetta_config\": {\n        \"base_model\": \"Qwen\u002FQwen3-0.6B\",\n        \"teacher_model\": \"Qwen\u002FQwen2.5-0.5B-Instruct\",\n        \"checkpoints_dir\": f\"{checkpoint_dir}\u002Fqwen3_0.6b+qwen2.5_0.5b_Fuser\u002Ffinal\",\n    }\n}\n\nrosetta_model, tokenizer = load_rosetta_model(model_config, eval_config={}, device=torch.device(\"cuda\"))\ndevice = r\n\u003C\u002Fcode>\u003C\u002Fpre>\n",1791762977048]