I Cut My LLM Costs by 97% — Then Found Out My Filter Was Silently Dropping 1 in 3 Real Matches

· Source: AI on Medium · Field: Technology & Digital — Artificial Intelligence & Machine Learning, Software Development & Engineering · Depth: Intermediate, medium

Summary

An LLM-powered Telegram bot designed to match job postings to user resumes faced significant operational costs, prompting the implementation of a keyword-based filter to reduce LLM calls by 97%. Initially, this optimization appeared successful, projecting a reduction from millions of calls weekly to a 13-minute evaluation cycle. However, rigorous validation, including a 20-mock-user experiment, revealed the filter silently dropped 32.6% of real matches, achieving only 67.4% recall. Subsequent debugging addressed issues like regex failures with symbols (e.g., "c++"), incorrect SQLAlchemy `NULL` handling, brittle compound keywords, and a narrow keyword list. These fixes improved recall to 89.1% while maintaining an 85.4% LLM cost reduction, highlighting the critical importance of measuring actual performance over just cost savings.

Key takeaway

For MLOps Engineers implementing cost-saving optimizations in LLM applications, rigorously validate changes against core performance metrics like recall, not just API call reductions. Your 97% cost cut might silently drop 1 in 3 real matches, breaking the system's primary function. Prioritize comprehensive, real-world testing over initial headline numbers to ensure optimizations don't introduce critical regressions. Implement incremental checkpointing for expensive validation runs.

Key insights

Aggressive cost optimizations can silently degrade core functionality if not rigorously validated against key performance metrics.

Principles

Method

Implement a multi-stage validation process: free sanity checks, free recall checks using existing ground truth, then a full-scale experiment with LLM scoring both with and without the filter.

In practice

Topics

Best for: AI Engineer, Machine Learning Engineer, MLOps Engineer

Related on AIssential

Open in AIssential →

Editorial summary, takeaway, and curation by AIssential. Original article published by AI on Medium.