DEV Community

Cover image for LLMs work best when the user defines their acceptance criteria first
Aman Shekhar
Aman Shekhar

Posted on

LLMs work best when the user defines their acceptance criteria first

Ever had that moment when you’re about to dive into a new tech project, and you think, “What the heck am I even trying to achieve here?” I’ve been there, trust me. Recently, I’ve been exploring the world of large language models (LLMs), and one thing keeps popping up: they work best when you clearly define your acceptance criteria first. It’s like trying to navigate a city without a map—sure, you might get somewhere, but it likely won’t be where you intended.

The Power of Acceptance Criteria

Let’s kick things off with why acceptance criteria are so crucial. In my experience, defining what success looks like for an AI project can dramatically affect its outcome. Ever wondered why some projects seem to “click” while others go off the rails? It’s often because the teams involved had a clear vision of their success metrics from day one. It’s like a GPS for your project; without it, you’re just wandering around.

I remember a time when I jumped into a generative AI project without setting clear goals. I wanted to create a chatbot that could hold realistic conversations. Sounds easy enough, right? Well, after pouring countless hours into it, I realized that while my bot could produce witty one-liners, it often veered off into nonsensical territory. It was only when I sat down and defined specific criteria—like maintaining context for at least three exchanges—that my project started to show real promise.

A Real-World Example: Chatbot Development

Let’s dig into a more detailed example. I had a project where I wanted to develop a customer support chatbot using OpenAI’s GPT-3. Initially, I was just thrilled to have it generate responses. But I quickly learned that excitement alone wouldn’t cut it.

I defined my acceptance criteria: the bot should accurately address at least 80% of user queries, maintain a friendly tone, and resolve queries without straying off-topic. With these criteria in place, I utilized a combination of few-shot prompting and reinforcement learning from human feedback (RLHF). By continually testing against my criteria, I could iteratively improve its performance.

from openai import OpenAI

# Sample function to interact with the OpenAI API
def get_response(prompt):
    response = OpenAI.Completion.create(
        engine="text-davinci-003",
        prompt=prompt,
        max_tokens=150,
        n=1,
        stop=None,
        temperature=0.7,
    )
    return response.choices[0].text.strip()

# Example usage
user_query = "How can I track my order?"
bot_response = get_response(user_query)
print(f"Bot: {bot_response}")
Enter fullscreen mode Exit fullscreen mode

This process taught me the importance of iteration and feedback. Every time the bot failed to meet my criteria, I tweaked the prompts or added more training data. It was a grind, but oh, the satisfaction when it finally started to nail those responses!

The Lessons Learned

Through this journey, I’ve learned that your criteria should be flexible but grounded in reality. I’ve seen projects where teams became so rigid in their acceptance criteria that they suddenly found themselves in a nitpicking contest rather than a productive workflow. Striking the right balance is critical.

Sometimes, I think about the software development lifecycle—anyone else ever felt overwhelmed by all those stages? If you treat acceptance criteria as a living document that evolves with your project, it can make the entire process smoother. Your criteria should grow as your model learns, much like a child learning to walk.

Embracing the Failures

Let’s talk about failure for a second. It’s something I’ve faced head-on in my AI/ML explorations. In one particular project, I aimed to design a sentiment analysis tool. I set a high bar for accuracy but neglected to account for the nuanced language used in customer feedback. Long story short, my model couldn’t differentiate between sarcasm and genuine praise. It was a disheartening moment but also an “aha!”—I realized that acceptance criteria need to consider edge cases.

Taking It to the Next Level

Now, if you’re thinking about using LLMs in your projects, here’s my two cents: always draft out your acceptance criteria before you even write a line of code. It’s this initial groundwork that lays the foundation for success. Use your criteria as a reference point to decide if your model is ready for deployment.

I’ve also found that tools like Figma or Miro can help visually map out those criteria. Sometimes seeing it laid out in front of you makes it all click. Also, don’t forget to loop in your team! Diverse perspectives can really enrich your criteria and provide insights you might’ve otherwise overlooked.

The Future of LLMs

Looking ahead, I’m genuinely excited about the potential of LLMs as they evolve. I believe we’re on the brink of a new era in AI where models will become even more contextual and adaptive. However, with great power comes great responsibility. Ethical considerations are paramount, and defining acceptance criteria that encompass fairness and transparency will be crucial moving forward.

As I wrap up this caffeine-fueled rant, I hope you walk away with a clearer understanding of how critical acceptance criteria are for LLM projects. And hey, if you’ve got your own stories or tips, I’d love to hear them! Let’s keep this conversation going and help each other navigate this wild world of tech together.

Until next time, keep coding, keep questioning, and never forget the power of clarity in your projects!


Connect with Me

If you enjoyed this article, let's connect! I'd love to hear your thoughts and continue the conversation.

Practice LeetCode with Me

I also solve daily LeetCode problems and share solutions on my GitHub repository. My repository includes solutions for:

  • Blind 75 problems
  • NeetCode 150 problems
  • Striver's 450 questions

Do you solve daily LeetCode problems? If you do, please contribute! If you're stuck on a problem, feel free to check out my solutions. Let's learn and grow together! 💪

Love Reading?

If you're a fan of reading books, I've written a fantasy fiction series that you might enjoy:

📚 The Manas Saga: Mysteries of the Ancients - An epic trilogy blending Indian mythology with modern adventure, featuring immortal warriors, ancient secrets, and a quest that spans millennia.

The series follows Manas, a young man who discovers his extraordinary destiny tied to the Mahabharata, as he embarks on a journey to restore the sacred Saraswati River and confront dark forces threatening the world.

You can find it on Amazon Kindle, and it's also available with Kindle Unlimited!


Thanks for reading! Feel free to reach out if you have any questions or want to discuss tech, books, or anything in between.

Top comments (0)