Nlp Model Finetuning
ASecurityTrain and fine-tune NLP and language models in the project's stack, such as Hugging Face transformers, datasets and PEFT, sentence-transformers, spaCy, or provider fine-tuning APIs. Use when preparing labelled text or instruction data; tokenization and chat templates; text classification, named entity recognition or embedding models; LoRA or QLoRA fine-tuning of an LLM; choosing learning rate, epochs and sequence length; avoiding duplicate and near-duplicate leakage between splits; handling c...
- 19 stars
- 0 votes
- 0 copies
- 1 view
- Added November 29, 2026
Works with
Security analysis
100/100Pro scans all 2 files and shows the line behind each finding
npx -y skills add khoavd18/skills --skill nlp-model-finetuning --agent claude-codeAre you the author of Nlp Model Finetuning?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/khoavd18-nlp-model-finetuning)---
name: nlp-model-finetuning
description: Train and fine-tune NLP and language models in the project's stack, such as Hugging Face transformers, datasets and PEFT, sentence-transformers, spaCy, or provider fine-tuning APIs. Use when preparing labelled text or instruction data; tokenization and chat templates; text classification, named entity recognition or embedding models; LoRA or QLoRA fine-tuning of an LLM; choosing learning rate, epochs and sequence length; avoiding duplicate and near-duplicate leakage between splits; handling class imbalance and multilingual text; or diagnosing overfitting and catastrophic forgetting. Not for prompting without training (use llm-app-engineer) or for evaluating generative outputs (use llm-evaluation).
---
# NLP Model Fine-Tuning
Decides whether training is needed at all, then fine-tunes on clean, leak-free data and proves the result beats prompting.
## Inputs
- The task, label set or target behaviour, the data sources with their licences and consent, and compute limits.
- The baseline to beat: a prompt-only or off-the-shelf model, measured on the same test set. Targets are `UNKNOWN` until stated.
## Procedure
1. **Detect the stack**: libraries and versions, base models and their licences, hardware (GPU memory decides model size and LoRA settings), experiment tracking.
2. **Justify training**: measure a prompt-only or pretrained baseline first; fine-tune only if it falls short and enough labelled data exists.
3. **Prepare data**: deduplicate exact and near-duplicate texts, split by source or author when texts are related, keep a frozen test set, record label definitions and annotator agreement. Checklist in [finetuning-playbook.md](references/finetuning-playbook.md).
4. **Format correctly**: the base model's tokenizer and chat template; check truncation length against the token length distribution.
5. **Train a small run first**: overfit a tiny subset to verify the pipeline; then full training with a fixed seed and logged config.
6. **Tune deliberately**: learning rate, epochs and LoRA rank/alpha one change at a time on validation; early stopping on a validation metric.
7. **Check regressions**: performance on the general capabilities the product still needs (catastrophic forgetting) and on safety behaviour.
8. **Evaluate**: classification/NER metrics per class via **ml-model-evaluation**; generative behaviour via **llm-evaluation**; always against the baseline.
9. **Package**: adapter or merged weights, tokenizer, config, data version, licence notes and a model card.
## Rules
- Respect licences of base models and data; personal data needs a lawful basis and minimization.
- Never tune on the test set; never let near-duplicates cross splits.
- Ask before launching long or paid GPU jobs and before deleting checkpoints.
- Keep API keys and hub tokens in environment variables or a secret store.
- Reproducibility and model-card expectations come from the [ML quality contract](../ml-model-evaluation/references/ml-quality-contract.md).
## Outputs
Training script and config, data preparation report (dedup, splits, label stats), experiment records, the trained artifact with model card, and a comparison against the baseline.
## Hand-offs
Serving the model in an app → **llm-app-engineer**. Generative evaluation → **llm-evaluation**. Classifier metrics → **ml-model-evaluation**.
Files in this skill
- SKILL.md
- references/finetuning-playbook.md
Attribution
Related skills
View all in ai-agents →Comments
Loading comments…
Newsletter
Get the weekly list of safe new skills, and the ones we pulled.