Urgent.News

What's breaking now, across thousands of outlets.

AI

Lesson 4 - Validation: A must-have cornerstone

In a traditional SDLC, validation was someone else's job and it came later. QA teams checked that the software did what it was supposed to. The behavior was repeatable, so eventually you automated the checks and moved on. So when building Slooster, I did the hard parts first: Building the prompts, tuning them, defining schemas for parameters and outputs. Building a system to pick the provider,…

Abstract editorial illustration

Validation was never the responsibility of a traditional software development life cycle (SDLC), coming after the fact that QA teams verified the software's functionality. In building Slooster, the hard parts were initially focused on creating prompts, tuning them, and defining schemas for parameters and outputs. The system was built locally, leading the author to postpone validation.

However, integrating large language models (LLMs) into the equation disrupts this traditional SDLC model, as LLMs produce outputs based on guessing rather than certainty. The same prompt can yield varying or incorrect results, necessitating validation as a fundamental aspect of the software from the outset.

After deploying Slooster Guide to staging, the author tested the system but encountered placeholder data instead of real vendor information. This inconsistency was due to the model's unpredictability, which could not be prevented by pre-deployment testing. To address this issue, the author introduced a validation layer with retries to catch and rectify bad outputs.

Validation, however, incurs costs and must be tailored to the specific use case, considering factors such as where it runs, the level of retries, and whether a human interacts with the results.

The validation process involves first applying deterministic checks using a schema validator to identify structurally invalid outputs. However, placeholder responses like "Vendor A" pass these checks but are semantically incorrect. A separate model checking mechanism is required to address semantic errors, involving a validation prompt that assesses the model's output against the same criteria used for the initial prompt.

This can be executed by the same model that generated the response or through a different provider and model for an independent verification.

The key takeaway is that not every response should be subjected to retries, nor should any response be trusted without verification. Providing users with confidence in the answer is crucial, clearly communicating the level of trust and allowing users to intervene if necessary. This feedback should be integrated back into the system for future improvements.

Due to the inherent unpredictability of LLMs, caching results is essential but must be done intelligently. Reusing good results when appropriate and allowing users to regenerate when needed strikes a balance between efficiency and validation. Lastly, selecting the appropriate model for each prompt type, based on the complexity and importance of the task, optimizes the overall system performance while ensuring robust validation.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in AI

More from Sunday 2 August →