KatInterview

Vetting a Large Scraped Corpus Before Fine-Tuning a 7B Model

Machine LearningModel answer
MediumModel answerMachine Learningllm-post-trainingdata-curationsft

Last updated

Plan how to screen, score, and test a big low-trust dataset before mixing it into SFT and preference tuning, with ablations and clear release gates to avoid regressions.

Context

You own the post-training stage (supervised fine-tuning followed by preference optimization) for a 7B-parameter model that must follow instructions and reason well. The current checkpoint was trained on a trusted, human-reviewed set of 40,000 instruction-response pairs.

Another team offers an additional 500,000 prompt-response pairs. They were harvested from developer Q&A sites, user-contributed examples, and model-generated tasks, and carry only weak labels. The extra data would broaden domain coverage, but a first look shows serious problems:

  • reasoning chains containing invented or invalid steps
  • code that does not run or parse
  • uneven writing tone and formatting
  • leaked secrets and personal data (API keys, email addresses)
  • toxic or unsafe material

Your task

Propose a complete plan for deciding whether to use this data and how. Cover each of the following.

  1. Auditing and filtering

    • Cheap automated rules to discard junk early (length and ratio checks, reference-model perplexity, exact and near-duplicate removal, and similar).
    • A model-based way to judge correctness and reasoning quality (reward model, LLM judge, self-consistency, execution checks).
    • Screens for safety, toxicity, and personal or secret data.
  2. Fit to the target distribution and diversity

    • How you decide whether the new data complements the trusted set instead of pulling the model away from the intended distribution.
    • How you use embeddings, clustering, or nearest-neighbor search against validation prompts to find over-represented and under-represented task areas.
  3. Experiments and regression protection

    • An ablation design that compares different ratios of trusted to curated external data.
    • The set of benchmarks and checks that would reveal forgetting, style drift, an alignment tax, or safety regressions.
    • Explicit go/no-go criteria that a new checkpoint must satisfy before it ships.

Explain your reasoning and trade-offs, and give concrete numbers (thresholds, yields, sample sizes) where you can.

Hints

Hint 1

Treat the 500k set as a pool of candidates, not as training data. Order the filters from cheapest to most expensive so the costly judge models only see survivors.

Hint 2

Anchor 'distribution fit' to something concrete: embed trusted data, real traffic and external prompts together, cluster them, and compare densities and nearest-neighbor distances to separate redundant, gap-filling, and out-of-scope samples.

Hint 3

Fix compute and total token budget across ablation arms, include a random-unfiltered arm to prove the filter matters, run multiple seeds, and write numeric go/no-go thresholds before seeing any results.