liveBook · Manning

Data leakage

As explained in Vibe Engineering

Data contamination is the leakage of evaluation answers or related held-out information into model inputs or training-like context, invalidating an evaluation.

Data leakage occurs when held-out information reaches a model through its inputs or training-like context. In evaluation, giving the model an answer it is supposed to generate can inflate the result and make the measurement useless. section 6.4

A tempting shortcut is to draw few-shot examples from the same dataset used for evaluation. If the prompt includes the current test query’s expected SQL, the model can reproduce the answer rather than solve the task. Keep evaluation prompts and answers separate from the frozen pool used for examples. section 6.4 section 6.3.3

Guarding a SQL-generator benchmark

The benchmark loads evaluation prompts and expected SQL from dev.json and draws examples from a separate examples.json pool. It selects examples for the relevant database and filters out the current gold SQL after normalization. The filter adds protection if the pools accidentally overlap; it does not establish that every other form of leakage has been eliminated. section 6.4 section 6.3.3

Listing 6.19 Extracting example queries from a frozen pool
public static List<String> getExampleQueries(String dbId, int n, String sqlToExclude) {
    if (exampleEntries == null || exampleEntries.isEmpty() || n <= 0) {
      return new ArrayList<>();
    }
 
    String normalizedExclude = normalizeSql(sqlToExclude);
 
    return exampleEntries.stream()
        .filter(entry -> dbId.equals(entry.getDbId()))
        .map(DbInput::getSql)
        .filter(sql -> sql != null && !sql.trim().isEmpty())
        .filter(sql -> normalizedExclude == null || !normalizedExclude.equals(normalizeSql(sql)))
        .limit(n)
        .collect(Collectors.toList());
  }
 

The extractor shows the database filter, normalized gold-SQL exclusion, and limit on the number of examples. section 6.4

Strong metrics are a reason to check the evaluation pipeline, not proof that it is clean. For example, stable cross-validation accuracy and a high F1 score on medical text warrant a leakage sanity check, even when results look consistent across folds. section 4.6.5

How Vibe Engineering covers it

How deep it goes
Explains separate example pools and normalized gold-SQL exclusion, while treating unusually strong classification scores as a reason for a sanity check.
Examples
Uses a SQL-generator benchmark with separate JSON pools and a medical-text classifier with a high F1 score.
What you can do after
Diagnose potential leakage by checking example-pool separation and whether the current gold SQL can enter prompt history.
How it connects
Connects data leakage to few-shot prompting, cross-validation, precision, recall, and F1 score.

Also explained in

Compare how 12 books explain data leakage →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Vibe Engineering. The section links point to the parts of the book it draws on.