Skip to content
OPQAI.
Sourced beginner / 🏪 SME Operations

Evaluate AI Models for Cost-Effective Routing with Gemini Flash-Lite

Job to be done: Evaluate and select the most cost-effective AI model for a specific task (router classification)

🇳🇬 Ways to use this in Nigeria

Ideas to get you started, adapt to your situation.

  • Entrepreneur

    Compare Gemini Flash-Lite vs Jev to find the cheapest AI for sorting customer messages on WhatsApp.

  • Student

    Test Gemini Flash-Lite to see if it's cheaper than other AI for categorizing research paper abstracts.

  • 9-5 employee

    Evaluate Gemini Flash-Lite to find the most affordable AI for classifying incoming support emails.

What you’ll get

You will learn how to compare the cost and performance of different AI models for a specific task, like classifying text. This approach helps you choose the most budget-friendly yet accurate AI for your needs, especially when dealing with high volumes of simple tasks.

Tools you need

  • Gemini Flash-Lite (freemium): A fast and affordable AI model from Google, good for tasks like classification.
  • Jev (paid): A specialized AI model designed for making quick decisions based on text input.
  • benchspec (free): An open-source tool to help you test and evaluate AI models by running them against predefined checks.

Steps

  1. Understand the task: The goal is to pick an AI model that can read a piece of text and decide which category it belongs to, or which action to take. This is called a ‘router’ or ‘classifier’. The author used this to decide if a task could be handled by simple code or needed a more advanced AI.
  2. Set up your testing tool: The author used a tool called benchspec. You would need to install this tool. The exact steps for installation are not provided in the excerpt, but you can usually find installation instructions on the tool’s GitHub page.
  3. Define your checks: Create a list of checks that the AI model needs to perform. These checks should be clear and specific. For example, a check could be: “Does this text mention ‘urgent’?” or “Is this email about a billing issue?”. The author used markdown files for this.
  4. Prepare your AI models: You will need access to the AI models you want to test. For Gemini Flash-Lite, you can use its free tier via Google AI Studio or its website. For Jev, you would need to follow their specific access instructions, which likely involve signing up and potentially paying.
  5. Run the comparison: Use benchspec to run both Gemini Flash-Lite and Jev on your defined checks and data. The tool will record how accurate each model is and how long it takes. The author mentions running their models “a few thousand times”.
  6. Analyze the results: Compare the costs and accuracy of each model. The author found that Gemini Flash-Lite was much cheaper ($0.30 per million input tokens) than Jev ($0.042 per million input tokens, but output is free) for their specific task, even though Jev was also very fast. The key was that Gemini Flash-Lite’s cost per input token was lower for the type of classification they were doing.
  7. Make your decision: Based on the analysis, choose the AI model that best balances cost, speed, and accuracy for your specific needs. The author decided to stick with Gemini Flash-Lite because its overall cost for their high-volume classification task was lower.

Original source

This workflow is based on insights shared by theycallmeswift on DEV Community. The author explains their process of evaluating AI models, specifically comparing Jev and Gemini Flash-Lite for a classification task, to find the most cost-effective solution.

Notes & variations

  • Free tier focus: Gemini Flash-Lite has a very generous free tier that is excellent for many classification and high-volume tasks. Focus on using this first before considering paid models.
  • Common mistake: Don’t assume the cheapest model per token is always the most cost-effective. Consider the total cost based on your actual usage patterns (input vs. output tokens) and the model’s accuracy for your specific task.
  • Tip for better results: Clearly define what success looks like for your task. The more specific your checks are in benchspec (or any evaluation tool), the more accurate your comparison between AI models will be.

Keep going

More SME Operations workflows