tinycodinglm / ai /ai-004.jsonl
winapiadmin's picture
Upload folder using huggingface_hub
1f3a244 verified
|
Raw History Blame Contribute Delete
3.08 kB
opencode trace
System You're a helpful assistant

You're a helpful assistant

User

preparing good training dataset for training LLMs

Assistant

If you're preparing a good training dataset for an LLM, the biggest gains usually come from data quality and structure, not just throwing more text into the furnace and hoping intelligence emerges.

A solid dataset pipeline

  1. Collect

    • High-quality source material
    • Code + documentation
    • Math/problem-solving examples
    • Conversations
    • Reasoning traces where legally and practically usable
  2. Normalize

    • Unicode normalization
    • Consistent formatting
    • Remove malformed JSON/HTML/markup
    • Normalize whitespace
    • Preserve meaningful structure
  3. Filter

    • Language identification
    • Minimum/maximum length
    • Toxicity/spam filtering where appropriate
    • Broken/incoherent samples
    • Boilerplate
    • Generated garbage
  4. Deduplicate
    Use multiple levels:

    • Exact document deduplication
    • Normalized-text hashing
    • Near-duplicate detection with MinHash/SimHash
    • Semantic deduplication for especially repetitive corpora
  5. Quality-score

    Keep metadata such as:

    {
      "text": "...",
      "source": "math",
      "quality": 0.92,
      "language": "en",
      "tokens": 847
    }
    

    This lets you later experiment with filtering instead of permanently deleting data.

  6. Structure training examples

    For instruction data, something like:

    {
      "messages": [
        {"role": "user", "content": "Solve x² - 5x + 6 = 0."},
        {"role": "assistant", "content": "..."}
      ]
    }
    

    For coding/agent traces, preserve the sequence of actions and observations, rather than flattening everything into one answer:

    {
      "task": "...",
      "steps": [
        {"type": "analysis", "content": "..."},
        {"type": "tool_call", "tool": "python", "input": "..."},
        {"type": "tool_result", "content": "..."},
        {"type": "analysis", "content": "..."},
        {"type": "final", "content": "..."}
      ]
    }
    
  7. Split correctly

    Create train/validation/test splits after deduplication. Otherwise nearly identical examples can leak between splits and make your validation score look wonderfully intelligent. Humanity has invented many ways to fool itself.

For coding specifically, I'd also retain failed attempts followed by corrections. A model needs to learn that segfault → inspect pointer → find bug → patch → test is a normal workflow, rather than developing the charming belief that programmers simply emit correct code on their first try.