Skip to content
Back to skills

Nlp Model Finetuning

ASecurity

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 c...

  • 19 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 29, 2026
ai-agentsapiperformance

Works with

  • api

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned November 29, 2026

npx -y skills add khoavd18/skills --skill nlp-model-finetuning --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Nlp Model Finetuning?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Nlp Model Finetuning
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/khoavd18-nlp-model-finetuning/badge)](https://www.skillsdirectory.com/skills/khoavd18-nlp-model-finetuning)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
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.md3.3 KB
  • references/finetuning-playbook.md1.8 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.