Fuzzy Match

Compares output against an expected answer using approximate text matching that tolerates minor wording, spelling, or formatting differences.

Fuzzy Match checks whether a response is close enough to an expected answer, even when the wording, spelling, or formatting differs slightly. Run it when you need approximate matching instead of an exact string comparison.

What it does

Fuzzy Match is an LLM-as-Judge eval. It reads the output and the expected content, then scores how closely they match while tolerating minor differences.

Input

Required InputTypeDescription
expectedstringThe expected content for comparison against the model generated output
outputstringThe output generated by the model to be evaluated for fuzzy match

Output

FieldTypeDescription
ResultscoreHigher values indicate better fuzzy match
ReasonstringA plain-language explanation of the fuzzy match assessment

Run it from code

Call evaluate() with the template name and the eval’s required inputs. It returns the score and the reason.

Note

Before running: install the SDK and set FI_API_KEY / FI_SECRET_KEY. The model argument in the snippets is the evaluator model Future AGI uses to run the eval; turing_flash is a fast default.

from fi.evals import evaluate

result = evaluate(
    "fuzzy_match",
    expected="The Eiffel Tower is a famous landmark in Paris, built in 1889 for the World's Fair. It stands 324 meters tall.",
    output="The Eiffel Tower, located in Paris, was built in 1889 and is 324 meters high.",
    model="turing_flash",
)

print(result.score)
print(result.reason)
import { evaluate } from "@future-agi/ai-evaluation";

const result = await evaluate(
  "fuzzy_match",
  {
    expected: "The Eiffel Tower is a famous landmark in Paris, built in 1889 for the World's Fair. It stands 324 meters tall.",
    output: "The Eiffel Tower, located in Paris, was built in 1889 and is 324 meters high."
  },
  { modelName: "turing_flash" }
);

console.log(result);

When to use

Run Fuzzy Match wherever an exact string comparison would be too strict for the kind of answer you expect.

  • Text and RAG & Retrieval outputs where the same fact can be phrased several valid ways
  • Answers pulled from different sources that may vary in spelling or formatting
  • Quick approximate checks before reaching for a stricter or semantic metric

What to do when Fuzzy Match fails

Ensure both input texts are properly formatted and contain meaningful content. This evaluation works best with texts that convey similar information but might have different wording.

For very short texts (one or two words), results may be less reliable. If you need more precise matching, consider using Levenshtein Similarity instead.

Was this page helpful?

Questions & Discussion