Metadata-Version: 2.5
Name: fastsft
Version: 0.2.1
Summary: A CLI tool that distills a large LLM into a small one via synthetic-data generation, quality filtering, and fine-tuning.
License-File: LICENSE
Requires-Python: >=3.12
Requires-Dist: datasets>=5.0.1
Requires-Dist: distilabel[instructor,openai]>=1.5.3
Requires-Dist: huggingface-hub>=0.26.0
Requires-Dist: modal>=0.65.0
Requires-Dist: pillow>=11.3.0
Requires-Dist: pydantic>=2.13.4
Requires-Dist: python-dotenv>=1.2.1
Requires-Dist: requests>=2.32.4
Requires-Dist: rich>=13.7.0
Requires-Dist: transformers>=5.14.1
Provides-Extra: evaluation
Requires-Dist: accelerate; extra == 'evaluation'
Requires-Dist: peft; extra == 'evaluation'
Requires-Dist: sentence-transformers; extra == 'evaluation'
Requires-Dist: torch; extra == 'evaluation'
Provides-Extra: local-training
Requires-Dist: accelerate; extra == 'local-training'
Requires-Dist: peft; extra == 'local-training'
Requires-Dist: torch; extra == 'local-training'
Requires-Dist: trl; extra == 'local-training'
Description-Content-Type: text/markdown

# FastSFT

**Teach a small, weak model to answer like a big, smart one.**

- 🧠 **Parent** — a big, powerful model. The teacher.
- 🐣 **Child** — a small, weak model. The student you're upgrading.

```
Parent  ──ask tough questions──▶  Q&A dataset  ──train──▶  Child
(big,        (judge filters                      (small,
 smart)       out weak answers)                    fast)
```

Ask the Parent hard questions in the style you want, keep only the good answers, and train the Child on them. Result: a tiny model that mimics the big one's style — for a fraction of the size and cost. This is called **distillation**.

**Why bother, instead of just calling the Parent every time?** Cheaper (no per-token API bill), fits on your laptop, and yours to keep — no rate limits, no vendor lock-in.

---

## Run it

**Don't wish to install?** [Try the Colab playground](https://colab.research.google.com/github/AniDas10/FastSFT/blob/main/colab/FastSFT_Playground.ipynb) — chat with an already-trained model instantly. With the option of creating your own dataset with a prompt and training your own SFT model.

**Willing to try it locally with different combinations?**

```bash
uv sync --extra local-training
echo "OPENROUTER_API_KEY=sk-or-..." > .env   # free key at openrouter.ai
uv run trial_run.py
```

That's the whole pipeline — generate data, filter it, and train — running end to end with sensible defaults.

Open [`trial_run.py`](trial_run.py) locally to play around: change the `PROMPT` to whatever persona you want, swap the `CHILD_MODEL_ID`, tweak a config value. Every field is commented with what it does and what else you could try. Edit, save, rerun.

---

## Want more?

- **[TUTORIAL.md](TUTORIAL.md)** — a slower, narrated walkthrough (CLI usage, troubleshooting, cloud training).
- **[data_generation_tutorial.md](data_generation_tutorial.md)**, **[training_tutorial.md](training_tutorial.md)**, **[evaluation_tutorial.md](evaluation_tutorial.md)** — deep dives on each pipeline stage.

---

Built on [distilabel](https://github.com/argilla-io/distilabel), [OpenRouter](https://openrouter.ai), Modal, Hugging Face, and PEFT.

Personal project, built for fun to learn about how post-training in LLM models looks like. Have fun with it, hopefully it's accessible to all! (won't be actively maintained)
