← All content

Train Your SLM with the distil CLI Claude Skill

Train a specialized small language model for text-to-SQL conversion — entirely from within Claude Code using the distil labs CLI skill.

View on GitHub

Train Your SLM with the distil CLI Claude Skill

Train a specialized small language model for text-to-SQL conversion — entirely from within Claude Code using the distil labs CLI skill.


What is distil labs?

distil labs is a platform for training task-specific small language models. We use knowledge distillation to compress what large models know into tiny, specialized models — 50-400x smaller than current state-of-the-art LLMs — that maintain comparable accuracy and run entirely on your machine.


Getting Started

Install the CLI

curl -fsSL https://cli-assets.distillabs.ai/install.sh | sh
distil login  # or distil signup if you're new

Add the Claude Code Skill

/plugin marketplace add https://github.com/distil-labs/distil-cli-skill
/plugin install distil@distil-cli-skill

Training a Text2SQL Model

The workflow involves seven core steps:

  1. Model creation via CLI
  2. Task type selection (Question Answering for text-to-SQL)
  3. Data file preparation
  4. Data upload
  5. Teacher evaluation validation
  6. Model training
  7. Model download and deployment

Required Data Files

FilePurpose
job_description.jsonTask objectives and configuration
config.yamlTask type and model settings
train.csv20+ labeled (question, SQL) pairs
test.csvHeld-out evaluation set

Teacher Evaluation Results

MetricScore
ROUGE89.36%
METEOR88.31%
Binary (Exact Match)52.00%
LLM-as-a-Judge80.00%

The 80% semantic correctness score indicated a green light to proceed with training.


Final Model Performance

MetricTeacher (DeepSeek-V3)Base ModelFine-tuned Model
LLM-as-a-Judge80%36%74%
Exact Match38%24%40%
ROUGE88.3%69.3%88.5%

Downloaded Model Contents

downloaded-model/
├── model.gguf              (2.2 GB) - Quantized model for Ollama
├── Modelfile               (1.6 KB) - Ollama configuration
├── model_client.py         (2.6 KB) - Python client to invoke
├── README.md               (2.4 KB) - Deployment instructions
├── model/                  # Full precision model (HuggingFace format)
└── model-adapter/          # LoRA adapter only (35 MB)

Example Results

Query: “Which artists have total album sales over 1 million?”

  • Base model: Returns hallucinated query ignoring the question entirely
  • Fine-tuned model: Returns correct JOIN, GROUP BY, and HAVING clause

What We Built

Conversational AI can guide users through a complete machine learning workflow — from prompt to production-ready model — without requiring traditional ML expertise, GPU infrastructure, or extensive data labeling.


Resources


Keep Learning