Langtrain Logo
Langtrain Docs
GuidesAPI referenceSDKs
GitHubOpen the app

Search documentation

Jump to any docs page

  • Run your model anywhere
  • Security and compliance
  • Best practices
GitHub

Best practices

What makes the difference between a fine-tune that works and one that doesn't, from data to shipping.

Start with the data

Most bad fine-tunes are bad data. Before training:
  • –Read 50 random examples yourself
  • –Remove duplicates and answers that contradict each other
  • –Make every answer exactly what you want back, in length, tone and format
  • –Run DatasetIntelligence.analyze to catch duplicates and outliers (Datasets)

Keep examples back

Set aside about 10% of your examples before training and never train on them. They are the only honest way to see whether the model learned the task or memorised the answers.

Change one thing at a time

Start from the defaults (QLoRA, rank 16, learning rate 2e-4, three epochs) and an instruct model. When results disappoint, change one thing, train again and compare on the same held-back examples. Better data usually beats any setting.

Watch the loss

Training loss should fall and level off. If it drops close to zero, the model is memorising: use fewer epochs or more data. If it jumps around, lower the learning rate.

Read the answers

Numbers help, but read the model's answers on the held-back examples, and on the tricky questions you know users will ask. Check that it still refuses what it should. See Evaluation.

Keep secrets out

A model can repeat what it was trained on. Strip API keys, passwords and personal data from training data, and keep your Langtrain API key in an environment variable, never in code or in a browser.

Ship the smallest model that works

Smaller models are cheaper and faster to serve. Try a 3B model before an 8B, and quantise to GGUF for llama.cpp when the quality holds up. See Run your model anywhere.
PreviousSecurity and complianceNextFAQ