Towards Optimizing the Costs of LLM Usage

Fuente: arXiv
Gespeichert in:
Bibliographische Detailangaben
Hauptverfasser: Shekhar, Shivanshu, Dubey, Tanishq, Mukherjee, Koyel, Saxena, Apoorv, Tyagi, Atharv, Kotla, Nishanth
Format: Preprint
Veröffentlicht: 2024
Schlagworte:
Online-Zugang:
Tags: Tag hinzufügen
Keine Tags, Fügen Sie den ersten Tag hinzu!
_version_ 1866911770040336384
author Shekhar, Shivanshu
Dubey, Tanishq
Mukherjee, Koyel
Saxena, Apoorv
Tyagi, Atharv
Kotla, Nishanth
author_facet Shekhar, Shivanshu
Dubey, Tanishq
Mukherjee, Koyel
Saxena, Apoorv
Tyagi, Atharv
Kotla, Nishanth
contents Generative AI and LLMs in particular are heavily used nowadays for various document processing tasks such as question answering and summarization. However, different LLMs come with different capabilities for different tasks as well as with different costs, tokenization, and latency. In fact, enterprises are already incurring huge costs of operating or using LLMs for their respective use cases. In this work, we propose optimizing the usage costs of LLMs by estimating their output quality (without actually invoking the LLMs), and then solving an optimization routine for the LLM selection to either keep costs under a budget, or minimize the costs, in a quality and latency aware manner. We propose a model to predict the output quality of LLMs on document processing tasks like summarization, followed by an LP rounding algorithm to optimize the selection of LLMs. We study optimization problems trading off the quality and costs, both theoretically and empirically. We further propose a sentence simplification model for reducing the number of tokens in a controlled manner. Additionally, we propose several deterministic heuristics for reducing tokens in a quality aware manner, and study the related optimization problem of applying the heuristics optimizing the quality and cost trade-off. We perform extensive empirical validation of our methods on not only enterprise datasets but also on open-source datasets, annotated by us, and show that we perform much better compared to closest baselines. Our methods reduce costs by 40%- 90% while improving quality by 4%-7%. We will release the annotated open source datasets to the community for further research and exploration.
format Preprint
id arxiv_https___arxiv_org_abs_2402_01742
institution arXiv
publishDate 2024
record_format arxiv
spellingShingle Towards Optimizing the Costs of LLM Usage
Shekhar, Shivanshu
Dubey, Tanishq
Mukherjee, Koyel
Saxena, Apoorv
Tyagi, Atharv
Kotla, Nishanth
Computation and Language
Artificial Intelligence
Machine Learning
Generative AI and LLMs in particular are heavily used nowadays for various document processing tasks such as question answering and summarization. However, different LLMs come with different capabilities for different tasks as well as with different costs, tokenization, and latency. In fact, enterprises are already incurring huge costs of operating or using LLMs for their respective use cases. In this work, we propose optimizing the usage costs of LLMs by estimating their output quality (without actually invoking the LLMs), and then solving an optimization routine for the LLM selection to either keep costs under a budget, or minimize the costs, in a quality and latency aware manner. We propose a model to predict the output quality of LLMs on document processing tasks like summarization, followed by an LP rounding algorithm to optimize the selection of LLMs. We study optimization problems trading off the quality and costs, both theoretically and empirically. We further propose a sentence simplification model for reducing the number of tokens in a controlled manner. Additionally, we propose several deterministic heuristics for reducing tokens in a quality aware manner, and study the related optimization problem of applying the heuristics optimizing the quality and cost trade-off. We perform extensive empirical validation of our methods on not only enterprise datasets but also on open-source datasets, annotated by us, and show that we perform much better compared to closest baselines. Our methods reduce costs by 40%- 90% while improving quality by 4%-7%. We will release the annotated open source datasets to the community for further research and exploration.
title Towards Optimizing the Costs of LLM Usage
topic Computation and Language
Artificial Intelligence
Machine Learning
url https://arxiv.org/abs/2402.01742