Cache & Distil: Optimising API Calls to Large Language Models
Guillem Ramírez, Matthias Lindemann, Alexandra Birch, Ivan Titov
Abstract
Large-scale deployment of generative AI tools often depends on costly API calls to a Large Language Model (LLM) to fulfil user queries, a process that also exposes the request stream to external providers. To curtail the frequency of these calls, one can employ a local smaller language model -a student- which is continuously trained on the responses of the LLM. This student gradually gains proficiency in independently handling an increasing number of user requests, a process we term neural caching. The crucial element in neural caching is a policy that decides which requests should be processed by the student alone and which should be redirected to the LLM, subsequently aiding the student’s learning. In this study, we focus on classification tasks, and we consider a range of classic Active Learning-based selection criteria as the policy. Our experiments suggest that Margin Sampling and Query by Committee bring consistent benefits over other policies and baselines across tasks and budgets.- Anthology ID:
- 2024.findings-acl.704
- Volume:
- Findings of the Association for Computational Linguistics: ACL 2024
- Month:
- August
- Year:
- 2024
- Address:
- Bangkok, Thailand
- Editors:
- Lun-Wei Ku, Andre Martins, Vivek Srikumar
- Venue:
- Findings
- SIG:
- Publisher:
- Association for Computational Linguistics
- Note:
- Pages:
- 11838–11853
- Language:
- URL:
- https://preview.aclanthology.org/build-pipeline-with-new-library/2024.findings-acl.704/
- DOI:
- 10.18653/v1/2024.findings-acl.704
- Cite (ACL):
- Guillem Ramírez, Matthias Lindemann, Alexandra Birch, and Ivan Titov. 2024. Cache & Distil: Optimising API Calls to Large Language Models. In Findings of the Association for Computational Linguistics: ACL 2024, pages 11838–11853, Bangkok, Thailand. Association for Computational Linguistics.
- Cite (Informal):
- Cache & Distil: Optimising API Calls to Large Language Models (Ramírez et al., Findings 2024)
- PDF:
- https://preview.aclanthology.org/build-pipeline-with-new-library/2024.findings-acl.704.pdf