Definition

The edit distance test measures the minimum number of single-character insertions, deletions, or substitutions required to transform one string into another, serving as a measure of their similarity.

Taxonomy

  • Task types: LLM.
  • Availability: and .

Why it matters

  • Edit distance provides a character-level measure of how different two strings are, which is useful for evaluating text generation quality.
  • This metric is particularly valuable when you need to measure fine-grained differences between generated and expected text.
  • Lower edit distances indicate higher similarity between the generated output and the reference text.

Required columns

To compute this metric, your dataset must contain the following columns:
  • Outputs: The generated text from your LLM
  • Ground truths: The reference/expected text to compare against

Test configuration examples

If you are writing a tests.json, here are a few valid configurations for the edit distance test:
[
  {
    "name": "Mean edit distance below 10",
    "description": "Ensure that the mean edit distance between generated and reference text is below 10 characters",
    "type": "performance",
    "subtype": "metricThreshold",
    "thresholds": [
      {
        "insightName": "metrics",
        "insightParameters": null,
        "measurement": "meanEditDistance",
        "operator": "<",
        "value": 10
      }
    ],
    "subpopulationFilters": null,
    "mode": "development",
    "usesValidationDataset": true,
    "usesTrainingDataset": false,
    "usesMlModel": false,
    "syncId": "b4dee7dc-4f15-48ca-a282-63e2c04e0689"
  }
]