{"status":"ok","message-type":"work","message-version":"1.0.0","message":{"indexed":{"date-parts":[[2026,11,20]],"date-time":"2026-11-20T20:00:58Z","timestamp":1795204858949,"version":"4.10.3"},"reference-count":44,"publisher":"Association for Computing Machinery (ACM)","issue":"6","content-domain":{"domain":[],"crossmark-restriction":false},"short-container-title":["Proc. ACM Manag. Data"],"published-print":{"date-parts":[[2025,12,4]]},"abstract":"<jats:p>Large Language Models (LLMs) are being increasingly used as a building block in data systems to process large text datasets. To do so, LLM model providers offer multiple LLMs with different sizes, spanning various cost-quality trade-offs when processing text at scale. Top-of-the-line LLMs (e.g., GPT-4o, Claude Sonnet) operate with high accuracy but are prohibitively expensive when processing many records. To avoid high costs, more affordable but lower quality LLMs (e.g., GPT-4o-mini, Claude Haiku) can be used to process records, but we need to ensure that the overall accuracy does not deviate substantially from that of the top-of-the-line LLMs. The model cascade framework provides a blueprint to manage this trade-off, by using the confidence of LLMs in their output (e.g., log-probabilities) to decide on which records to use the affordable LLM. However, existing solutions following this framework provide only marginal cost savings and weak theoretical guarantees because of poor estimation of the quality of the affordable LLM's outputs. We present BARGAIN, a method that judiciously uses affordable LLMs in data processing to significantly reduce cost while providing strong theoretical guarantees on the solution quality. BARGAIN employs a novel adaptive sampling strategy and statistical estimation procedure that uses data and task characteristics and builds on recent statistical tools to make accurate estimations with tight theoretical guarantees. Variants of BARGAIN can support guarantees on accuracy, precision, or recall of the output. Experimental results across 8 real-world datasets show that BARGAIN reduces cost, on average, by up to 86% more than state-of-the-art, while providing stronger theoretical guarantees on accuracy of output, with similar gains when guaranteeing a desired level of precision or recall.<\/jats:p>","DOI":"10.1145\/3769776","type":"journal-article","created":{"date-parts":[[2025,12,6]],"date-time":"2025-12-06T04:32:13Z","timestamp":1764995533000},"page":"1-26","source":"Crossref","is-referenced-by-count":4,"title":["Cut Costs, Not Accuracy: LLM-Powered Data Processing with Guarantees"],"prefix":"10.1145","volume":"3","author":[{"ORCID":"https:\/\/orcid.org\/0000-0002-9789-7197","authenticated-orcid":false,"given":"Sepanta","family":"Zeighami","sequence":"first","affiliation":[{"name":"UC Berkeley, Berkeley, CA, USA"}],"role":[{"vocabulary":"crossref","role":"author"}]},{"ORCID":"https:\/\/orcid.org\/0000-0002-0919-9672","authenticated-orcid":false,"given":"Shreya","family":"Shankar","sequence":"additional","affiliation":[{"name":"UC Berkeley, Berkeley, CA, USA"}],"role":[{"vocabulary":"crossref","role":"author"}]},{"ORCID":"https:\/\/orcid.org\/0000-0002-4538-4752","authenticated-orcid":false,"given":"Aditya","family":"Parameswaran","sequence":"additional","affiliation":[{"name":"UC Berkeley, Berkeley, CA, USA"}],"role":[{"vocabulary":"crossref","role":"author"}]}],"member":"320","published-online":{"date-parts":[[2025,12,5]]},"reference":[{"key":"e_1_2_1_1_1","volume-title":"Bohou Li, Mark Lindblad, Henry Lindeman, Alex Meyer, Parth Parmar, Tanvi Ranade, Mehul A Shah, et al.","author":"Anderson Eric","year":"2024","unstructured":"Eric Anderson, Jonathan Fritz, Austin Lee, Bohou Li, Mark Lindblad, Henry Lindeman, Alex Meyer, Parth Parmar, Tanvi Ranade, Mehul A Shah, et al., 2024. The Design of an LLM-powered Unstructured Analytics System. arXiv preprint arXiv:2409.00847 (2024)."},{"key":"e_1_2_1_2_1","doi-asserted-by":"publisher","DOI":"10.1109\/ICDE.2019.00132"},{"key":"e_1_2_1_3_1","volume-title":"Language models enable simple systems for generating structured views of heterogeneous data lakes. arXiv preprint arXiv:2304.09433","author":"Arora Simran","year":"2023","unstructured":"Simran Arora, Brandon Yang, Sabri Eyuboglu, Avanika Narayan, Andrew Hojel, Immanuel Trummer, and Christopher R\u00e9. 2023. Language models enable simple systems for generating structured views of heterogeneous data lakes. arXiv preprint arXiv:2304.09433 (2023)."},{"key":"e_1_2_1_4_1","doi-asserted-by":"publisher","DOI":"10.1145\/3514221.3517835"},{"key":"e_1_2_1_5_1","doi-asserted-by":"publisher","DOI":"10.1145\/3514221.3517857"},{"key":"e_1_2_1_6_1","doi-asserted-by":"publisher","DOI":"10.18653\/v1\/2020.sigdial-1.8"},{"key":"e_1_2_1_7_1","volume-title":"Frugalgpt: How to use large language models while reducing cost and improving performance. arXiv preprint arXiv:2305.05176","author":"Chen Lingjiao","year":"2023","unstructured":"Lingjiao Chen, Matei Zaharia, and James Zou. 2023. Frugalgpt: How to use large language models while reducing cost and improving performance. arXiv preprint arXiv:2305.05176 (2023)."},{"key":"e_1_2_1_8_1","volume-title":"courtlistener.com Retrieved","author":"Opinion Court","year":"2025","unstructured":"courtlistener. [n.d.]. Court Opinion. courtlistener.com Retrieved April, 2025 from"},{"key":"e_1_2_1_9_1","doi-asserted-by":"publisher","DOI":"10.14778\/3574245.3574273"},{"key":"e_1_2_1_10_1","doi-asserted-by":"publisher","DOI":"10.14778\/3611479.3611527"},{"key":"e_1_2_1_11_1","unstructured":"Juliana Freire Grace Fan Benjamin Feuer Christos Koutras Yurong Liu Eduardo Pena A\u00e9cio Santos Cl\u00e1udio Silva and Eden Wu. [n.d.]. Large Language Models for Data Discovery and Integration: Challenges and Opportunities. Data Engineering ([n.d.]) 3."},{"key":"e_1_2_1_12_1","doi-asserted-by":"publisher","DOI":"10.1007\/978-1-4612-0865-5_26"},{"key":"e_1_2_1_13_1","volume-title":"ThriftLLM: On Cost-Effective Selection of Large Language Models for Classification Queries. arXiv preprint arXiv:2501.04901","author":"Huang Keke","year":"2025","unstructured":"Keke Huang, Yimin Shi, Dujian Ding, Yifei Li, Yang Fei, Laks Lakshmanan, and Xiaokui Xiao. 2025. ThriftLLM: On Cost-Effective Selection of Large Language Models for Classification Queries. arXiv preprint arXiv:2501.04901 (2025)."},{"key":"e_1_2_1_14_1","doi-asserted-by":"publisher","DOI":"10.1162\/tacl_a_00407"},{"key":"e_1_2_1_15_1","volume-title":"SMART: Automatically Scaling Down Language Models with Accuracy Guarantees for Reduced Processing Fees. arXiv preprint arXiv:2403.13835","author":"Jo Saehan","year":"2024","unstructured":"Saehan Jo and Immanuel Trummer. 2024. SMART: Automatically Scaling Down Language Models with Accuracy Guarantees for Reduced Processing Fees. arXiv preprint arXiv:2403.13835 (2024)."},{"key":"e_1_2_1_16_1","volume-title":"https:\/\/www.kaggle.com\/datasets\/gufukuro\/movie-scripts-corpus Retrieved","year":"2025","unstructured":"Kaggle. [n.d.] a. Screenplay. https:\/\/www.kaggle.com\/datasets\/gufukuro\/movie-scripts-corpus Retrieved April, 2025 from"},{"key":"e_1_2_1_17_1","volume-title":"Steam game reviews. https:\/\/www.kaggle.com\/datasets\/najzeko\/steam-reviews-2021 Retrieved","year":"2025","unstructured":"Kaggle. [n.d.] b. Steam game reviews. https:\/\/www.kaggle.com\/datasets\/najzeko\/steam-reviews-2021 Retrieved April, 2025 from"},{"key":"e_1_2_1_18_1","doi-asserted-by":"publisher","DOI":"10.14778\/3372716.3372725"},{"key":"e_1_2_1_19_1","doi-asserted-by":"publisher","DOI":"10.14778\/3137628.3137664"},{"key":"e_1_2_1_20_1","volume-title":"SUPG code and datasets. https:\/\/github.com\/stanford-futuredata\/supg Retrieved","author":"Kang Daniel","year":"2025","unstructured":"Daniel Kang, Edward Gan, Peter Bailis, Tatsunori Hashimoto, and Matei Zaharia. [n.d.] b. SUPG code and datasets. https:\/\/github.com\/stanford-futuredata\/supg Retrieved Mar, 2025 from"},{"key":"e_1_2_1_21_1","doi-asserted-by":"publisher","DOI":"10.14778\/3407790.3407804"},{"key":"e_1_2_1_22_1","doi-asserted-by":"publisher","DOI":"10.14778\/3476249.3476285"},{"key":"e_1_2_1_23_1","doi-asserted-by":"publisher","DOI":"10.1145\/3514221.3517897"},{"key":"e_1_2_1_24_1","doi-asserted-by":"publisher","DOI":"10.18653\/v1\/2024.uncertainlp-1.1"},{"key":"e_1_2_1_25_1","volume-title":"Semantic Integrity Constraints: Declarative Guardrails for AI-Augmented Data Processing Systems. arXiv preprint arXiv:2503.00600","author":"Lee Alexander W","year":"2025","unstructured":"Alexander W Lee, Justin Chan, Michael Fu, Nicolas Kim, Akshay Mehta, Deepti Raghavan, and Ugur Cetintemel. 2025. Semantic Integrity Constraints: Declarative Guardrails for AI-Augmented Data Processing Systems. arXiv preprint arXiv:2503.00600 (2025)."},{"key":"e_1_2_1_26_1","volume-title":"Towards accurate and efficient document analytics with large language models. arXiv preprint arXiv:2405.04674","author":"Lin Yiming","year":"2024","unstructured":"Yiming Lin, Madelon Hulsebos, Ruiying Ma, Shreya Shankar, Sepanta Zeigham, Aditya G Parameswaran, and Eugene Wu. 2024. Towards accurate and efficient document analytics with large language models. arXiv preprint arXiv:2405.04674 (2024)."},{"key":"e_1_2_1_27_1","volume-title":"Zui Chen, Michael Franklin, Tim Kraska, Samuel Madden, and Gerardo Vitagliano.","author":"Liu Chunwei","year":"2024","unstructured":"Chunwei Liu, Matthew Russo, Michael Cafarella, Lei Cao, Peter Baille Chen, Zui Chen, Michael Franklin, Tim Kraska, Samuel Madden, and Gerardo Vitagliano. 2024. A declarative system for optimizing ai workloads. arXiv preprint arXiv:2405.14696 (2024)."},{"key":"e_1_2_1_28_1","doi-asserted-by":"publisher","DOI":"10.1145\/3183713.3183751"},{"key":"e_1_2_1_29_1","doi-asserted-by":"publisher","DOI":"10.14778\/3685800.3685890"},{"key":"e_1_2_1_30_1","volume-title":"Can foundation models wrangle your data? arXiv preprint arXiv:2205.09911","author":"Narayan Avanika","year":"2022","unstructured":"Avanika Narayan, Ines Chami, Laurel Orr, Simran Arora, and Christopher R\u00e9. 2022. Can foundation models wrangle your data? arXiv preprint arXiv:2205.09911 (2022)."},{"key":"e_1_2_1_31_1","volume-title":"OpenAI pricing. https:\/\/openai.com\/api\/pricing\/ Retrieved","year":"2025","unstructured":"openai. 2025. OpenAI pricing. https:\/\/openai.com\/api\/pricing\/ Retrieved Mar, 2025 from"},{"key":"e_1_2_1_32_1","volume-title":"Lotus: Enabling semantic queries with llms over tables of unstructured and structured data. arXiv preprint arXiv:2407.11418","author":"Patel Liana","year":"2024","unstructured":"Liana Patel, Siddharth Jha, Carlos Guestrin, and Matei Zaharia. 2024. Lotus: Enabling semantic queries with llms over tables of unstructured and structured data. arXiv preprint arXiv:2407.11418 (2024)."},{"key":"e_1_2_1_33_1","volume-title":"Yu Gan, Amin Saberi, Fatma Ozcan, and Sercan O Arik.","author":"Pourreza Mohammadreza","year":"2024","unstructured":"Mohammadreza Pourreza, Hailong Li, Ruoxi Sun, Yeounoh Chung, Shayan Talaei, Gaurav Tarlok Kakkar, Yu Gan, Amin Saberi, Fatma Ozcan, and Sercan O Arik. 2024. Chase-sql: Multi-path reasoning and preference optimized candidate selection in text-to-sql. arXiv preprint arXiv:2410.01943 (2024)."},{"key":"e_1_2_1_34_1","doi-asserted-by":"publisher","DOI":"10.14778\/3611479.3611496"},{"key":"e_1_2_1_35_1","volume-title":"DocETL: Agentic Query Rewriting and Evaluation for Complex Document Processing. arXiv preprint arXiv:2410.12189","author":"Shankar Shreya","year":"2024","unstructured":"Shreya Shankar, Tristan Chambers, Tarak Shah, Aditya G Parameswaran, and Eugene Wu. 2024. DocETL: Agentic Query Rewriting and Evaluation for Complex Document Processing. arXiv preprint arXiv:2410.12189 (2024)."},{"key":"e_1_2_1_36_1","doi-asserted-by":"publisher","DOI":"10.1145\/3626246.3654732"},{"key":"e_1_2_1_37_1","doi-asserted-by":"publisher","DOI":"10.14778\/3704965.3704989"},{"key":"e_1_2_1_38_1","volume-title":"NeurIPS 2022 First Table Representation Workshop.","author":"Vos David","year":"2022","unstructured":"David Vos, Till D\u00f6hmen, and Sebastian Schelter. 2022. Towards parameter-efficient automation of data wrangling tasks with prefix-tuning. In NeurIPS 2022 First Table Representation Workshop."},{"key":"e_1_2_1_39_1","volume-title":"Calibration in deep learning: A survey of the state-of-the-art. arXiv preprint arXiv:2308.01222","author":"Wang Cheng","year":"2023","unstructured":"Cheng Wang. 2023. Calibration in deep learning: A survey of the state-of-the-art. arXiv preprint arXiv:2308.01222 (2023)."},{"key":"e_1_2_1_40_1","volume-title":"Aop: Automated and interactive llm pipeline orchestration for answering complex queries. CIDR.","author":"Wang Jiayi","year":"2025","unstructured":"Jiayi Wang and Guoliang Li. 2025. Aop: Automated and interactive llm pipeline orchestration for answering complex queries. CIDR."},{"key":"e_1_2_1_41_1","doi-asserted-by":"publisher","DOI":"10.1145\/3626756"},{"key":"e_1_2_1_42_1","doi-asserted-by":"publisher","DOI":"10.1093\/jrsssb\/qkad009"},{"key":"e_1_2_1_43_1","volume-title":"LLM-Powered Proactive Data Systems. arXiv preprint arXiv:2502.13016","author":"Zeighami Sepanta","year":"2025","unstructured":"Sepanta Zeighami, Yiming Lin, Shreya Shankar, and Aditya Parameswaran. 2025a. LLM-Powered Proactive Data Systems. arXiv preprint arXiv:2502.13016 (2025)."},{"key":"e_1_2_1_44_1","doi-asserted-by":"crossref","unstructured":"Sepanta Zeighami Shreya Shankar and Aditya Parameswaran. 2025b. Cut Costs Not Accuracy: LLM-Powered Data Processing with Guarantees (Technical Report). arXiv preprint arXiv:2509.02896 (2025).","DOI":"10.1145\/3769776"}],"container-title":["Proceedings of the ACM on Management of Data"],"original-title":[],"language":"en","link":[{"URL":"https:\/\/dl.acm.org\/doi\/pdf\/10.1145\/3769776","content-type":"unspecified","content-version":"vor","intended-application":"similarity-checking"}],"deposited":{"date-parts":[[2026,6,13]],"date-time":"2026-06-13T04:56:08Z","timestamp":1781326568000},"score":1,"resource":{"primary":{"URL":"https:\/\/dl.acm.org\/doi\/10.1145\/3769776"}},"subtitle":[],"short-title":[],"issued":{"date-parts":[[2025,12,4]]},"references-count":44,"journal-issue":{"issue":"6","published-print":{"date-parts":[[2025,12,4]]}},"alternative-id":["10.1145\/3769776"],"URL":"https:\/\/doi.org\/10.1145\/3769776","relation":{},"ISSN":["2836-6573"],"issn-type":[{"value":"2836-6573","type":"electronic"}],"subject":[],"published":{"date-parts":[[2025,12,4]]}}}