Welcome to distil labs

distil labs provides a platform for training task-specific small language models (SLMs) with just a prompt and a few dozen examples. Our platform handles the complex machine learning processes behind the scenes. This allows you to focus on your use-case instead of managing large datasets and infrastructure.

Why distil labs?

  • Train Specialized Models with Minimal Data: Train specialized SLMs with just a prompt and a few dozen examples.
  • Full Ownership of Your Models: Download and deploy your models anywhere - your servers, applications, or at the edge. No vendor lock-in for inference.
  • Fully Automated ML Pipeline: No ML expertise required, we handle the technical complexity.
  • High Performance with Smaller Footprint: Get LLM-level accuracy with models up to 400x smaller. Run locally on affordable hardware.

Minimal example

Here’s how simple it is to train a specialized model with distil labs (get YOUR_API_KEY):

1import json
2import requests
3
4# Register a new model
5auth_header = {"Authorization": f"Bearer {distil_bearer_token()}"}
6response = requests.post(
7 "https://api.distillabs.ai/models",
8 data=json.dumps({"name": "testmodel-123"}),
9 headers={"Content-Type": "application/json", **auth_header},
10)
11model_id = response.json()["id"]
12
13# Upload your task description and examples
14data = {
15 "job_description": {"type": "json", "content": open("data/job_description.json").read()},
16 "train_data": {"type": "csv", "content": open("data/train.csv").read()},
17 "test_data": {"type": "csv", "content": open("data/test.csv").read()},
18 "unstructured_data": {"type": "csv", "content": open("data/unstructured.csv").read()},
19 "config": {"type": "yaml", "content": open("data/config.yaml").read()},
20}
21response = requests.post(
22 f"https://api.distillabs.ai/models/{model_id}/uploads",
23 data=json.dumps(data),
24 headers={"Content-Type": "application/json", **auth_header},
25)
26upload_id = response.json()["id"]
27
28# Start SLM training
29response = requests.post(
30 f"https://api.distillabs.ai/models/{model_id}/training",
31 data=json.dumps({"upload_id": upload_id}),
32 headers={"Content-Type": "application/json", **auth_header},
33)
34slm_training_job_id = response.json()["id"]
35
36# When training completes, get your model download link
37response = requests.get(
38 f"https://api.distillabs.ai/trainings/{slm_training_job_id}/model",
39 headers=auth_header,
40)
41print(response.json())

Next steps

Ready to build your own specialized models? Continue to our How to train your SLM guide, see more detailed examples, or jump straight into the API reference.