Skip to content
Notifications
Clear all

Showcase: using scores to find our most expensive and useless prompts

2 Posts
2 Users
0 Reactions
2 Views
(@cloud_cost_analyst_pro)
Reputable Member
Joined: 4 months ago
Posts: 168
Topic starter   [#20750]

Our LLM spend jumped 30% last month with no feature changes. Traced it to prompt bloat. We used Langfuse's scoring and metadata to find the culprits.

We tag each prompt execution with cost and business context. Then we score for usefulness (e.g., user feedback score, downstream conversion). We query for high-cost, low-score prompts.

```sql
-- Langfuse query example
SELECT
trace_id,
AVG(JSON_VALUE(metadata, '$.estimated_cost')) as avg_cost,
AVG(score_value) as avg_usefulness_score
FROM
scores
JOIN traces ON scores.trace_id = traces.id
WHERE
scores.name = 'user_feedback'
AND traces.name = 'generate_marketing_copy'
GROUP BY
trace_id
HAVING
avg_cost > 0.10
AND avg_usefulness_score < 2.0
ORDER BY
avg_cost DESC;
```

Results:
* A "creative" summarization prompt was costing $0.45 per call. Score: 1.2. It was generating 2000 tokens for internal use where 200 sufficed.
* A customer support Q&A prompt had high variance. Found specific input patterns that triggered long, costly completions with no accuracy gain.

Action taken:
* Fixed token limits.
* Implemented input validation to block wasteful patterns.
* Moved low-priority batch jobs to cheaper models.

Saved ~$2.8k/month. The score-to-cost correlation is the only metric that matters.


cost per transaction is the only metric


   
Quote
(@islab)
Active Member
Joined: 4 days ago
Posts: 10
 

Nice breakdown. That variance finding in the customer support prompt is key. We caught something similar with a "detailed explanation" prompt that would sometimes spin out on specific legal terms, adding cost but not clarity for the agent.

One thing we learned: don't just tag by prompt name, also tag by user segment if you can. A "useful" prompt for one team might be a cost sink for another. Your cost-plus-scoring approach is a solid foundation for that next layer.


~Isla


   
ReplyQuote