This paper presents a systematic, cost-aware evaluation of large language models (LLMs) for receipt-item categorisation within a production-oriented classification framework. We compare four instruction-tuned models available through AWS Bedrock: Claude 3.7 Sonnet, Claude 4 Sonnet, Mixtral 8x7B Instruct, and Mistral 7B Instruct. The aim of the study was (1) to assess performance across accuracy, response stability, and token-level cost, and (2) to investigate what prompting methods, zero-shot or few-shot, are especially appropriate both in terms of accuracy and in terms of incurred costs. Results of our experiments demonstrated that Claude 3.7 Sonnet achieves the most favourable balance between classification accuracy and cost efficiency.
Figures & tables
Figure 1: Methodology of the conducted study (Disclaimer: The diagram was elaborated in collaboration with ChatGPT-5.2, based on a detailed textual description of the required diagram)
#
Category Name
Identifier
1
Fresh Produce
fresh_produce
2
Meat & Seafood
meat_seafood
3
Dairy & Eggs
dairy_eggs
4
Pantry & Snacks
pantry_snacks
5
Bakery
bakery
6
Coffee & Tea
coffee_tea
Table 1: Predefined Category Set used in Phase 1
Variant
Category set
Extra rules
Zero/few shot
Variant 1
Baseline
–
Zero-shot
Variant 2
Refined
–
Zero-shot
Variant 3
Refined
✓
Zero-shot
Variant 4
Refined
✓
Few-shot
Table 2: Comparison of the applied configurations
#
Category Name
Identifier
1
Fruits & Vegetables
fruits_vegetables
2
Meat & Seafood & Deli
meat_seafood_deli
3
Dairy & Eggs & Fridge
dairy_eggs_fridge
4
Frozen
frozen
5
Pantry & Snacks
pantry_snacks
6
Bakery
bakery
Table 3: Updated Predefined Category Set used in Phase 2’s Model Evaluation
Model
Precision
Recall
F1
Accuracy
Balanced Accuracy
Claude 3.7 Sonnet
0.907
0.902
0.905
0.902
0.773
Claude 4 Sonnet
0.853
0.848
0.851
0.848
0.748
Mixtral 8x7B
0.698
0.694
0.696
0.694
0.608
Mistral 7B
0.604
0.596
0.600
0.596
0.492
Table 4: Performance comparison of evaluated models
Category
Count
Claude 3.7
Claude 4
Mixtral 8x7B
Mistral 7B
fresh_produce
31
1.000
1.000
0.903
0.742
meat_seafood
22
0.864
0.727
0.773
0.636
dairy_eggs
30
0.867
0.867
0.800
0.700
pantry_snacks
90
0.967
0.878
0.678
0.567
bakery
17
0.882
0.882
0.765
0.706
coffee_tea
14
0.857
1.000
0.643
0.714
Table 5: Category-wise performance comparison across models
Model
Mean (ms)
Min (ms)
Max (ms)
Claude 3.7 Sonnet
1265
873
3078
Claude 4 Sonnet
1433
938
2852
Mixtral 8x7B
431
208
2144
Mistral 7B
912
172
15351
Table 6: Performance comparison of evaluated models
Metric
Claude 3.7
Claude 4
average number of input tokens
421
422
min. number of input tokens
336
337
max. number of input tokens
1083
1084
average number of output tokens
24
24
min. number of output tokens
6
6
max. number of output tokens
165
156
Table 7: Token usage and estimated cost per call by Claude Sonnet Models
Serving open-weight language models on premises forces a trade-off between accuracy and computational cost. Hosting models of different sizes lets easy queries go to a small, efficient model and hard ones to a large model. We present CRE-Router (Cluster, Route, Escalate), a two-stage method that decides which of these models answers each query. It clusters queries and routes each cluster to the model that best trades error against cost, under a budget on the time per output token (TPOT) or the end-to-end latency per request (E2EL). It then either accepts the answer or, when a quality estimator rejects it, escalates the query to the strong model. Routing decides before generation, so a hard query goes straight to the strong model; escalation decides after, so it can catch the errors routing cannot predict. It needs no annotation beyond task-correctness labels. We evaluate CRE-Router on TeleMath, TeleQnA and AIME, with pools of two to nine models served on A100 GPUs. CRE-Router is more accurate than the efficient models in its pool and comparable to the strong model it escalates to, at a lower cost per token. We also find that the choice of cost term decides which models serve the workload, that pricing each model per cluster shortens the wait per request, and that a change of hardware changes the best routing.
Businesses increasingly rely on large language models (LLMs) to automate simple repetitive tasks instead of developing custom machine learning models. LLMs require few, if any, training examples and can be utilized by users without expertise in model development. However, this comes at the cost of substantially higher resource and energy consumption compared to smaller models, which often achieve similar predictive performance for simple tasks. In this paper, we present our vision for just-in-time model replacement (JITR), where, upon identifying a recurring task in calls to an LLM, the model is replaced transparently with a cheaper alternative that performs well for this specific task. JITR retains the ease of use and low development effort of LLMs, while saving significant cost and energy. We discuss the main challenges in realizing our vision regarding the identification of recurring tasks and the creation of a custom model. Specifically, we argue that model search and transfer learning will play a crucial role in JITR to efficiently identify and fine-tune models for a recurring task. Using our JITR prototype Poodle, we reduce inference time by up to 7.5x compared to a self- hosted LLM and save more than $2,200 per 1M requests compared to a flagship hosted LLM, while achieving accuracy competitive with the LLM baseline.
Nils Strassenburg, Boris Glavic, Tilmann Rabl
Hasso Plattner Institute, Uni Potsdam · University of Illinois Chicago
Language models make it easy to build classifiers by simply prompting a model with the sample to classify. However, their predictions are neither deterministic nor uniformly reliable across samples. How can we combine predictions from different models to improve reliability? We view LLM classifiers as noisy measurement instruments of an underlying target label. Our goal is to maximize average classification accuracy at a given average query cost. To this end, we introduce circuits that organize LLM classifiers into an adaptive sequence of queries and decisions. We then characterize the optimal circuit, obtain the fundamental limits of achievable accuracy, and provide practical insights on realizing the optimal circuit. Across seven classification tasks spanning safety, health, political science, human preference, agent evaluation, decision-making and reasoning, our method improves the cost-accuracy frontier over routing and cascading baselines.
Hadi Khalaf, Sajani Vithana, Kunal Talreja +3
Harvard School of Engineering and Applied Science · Kempner Institute for the Study of Natural & Artificial Intelligence · School of Electrical and Computer Engineering, Georgia Institute of Technology +2