Mimic-Kit
中文文档 | English
Mimic-Kit is a black-box knowledge distillation scaffolding that helps you distill capabilities from powerful teacher models into smaller, more efficient student models.
Features
- 🤖 Teacher Model Generation: Use OpenAI API (or compatible APIs) to generate high-quality training data
- 🚀 Efficient Training: Built on ms-swift for streamlined model training
- 🧩 Flexible Tuning: Support both LoRA (parameter-efficient) and full fine-tuning
- ⚡ Performance Optimized: Integrated with DeepSpeed and Liger Kernel for accelerated training
- 💾 Smart Caching: Automatically cache API responses to save costs
- 📊 Multiple Data Formats: Support both chat and text completion formats
Quick Start
1. Installation
Option 1: Install from PyPI (Recommended)
pip install mimic-kit
Option 2: Install from source
# Clone the repository
git clone https://github.com/ECNU-innoSpark/EduRmDistill
cd mimic-kit
# Install dependencies using UV
uv sync
# Or with dev dependencies
uv sync --group dev
2. Initialize Configuration
uv run mimic init
This creates a config.yaml template. Edit it to configure your teacher model, student model, and training parameters.
3. Prepare Your Data
Create a JSONL file with your prompts. Supports two formats:
Chat Format:
{"messages": [{"role": "user", "content": "Explain Python decorators"}]}
{"messages": [{"role": "user", "content": "How to reverse a linked list?"}]}
Text Completion Format:
{"text": "Python decorators are a powerful feature..."}
{"text": "To reverse a linked list, you need to..."}
4. Generate Training Data
uv run mimic generate
This sends your prompts to the teacher model and saves the generated responses as training data.
5. Train Your Student Model
uv run mimic train
The student model will be fine-tuned on the generated data using the configured method (LoRA or full fine-tuning).
Configuration
See config.yaml for all available options. Key sections:
data: Input/output paths, system prompts, templatesteacher: API provider, model, generation parametersstudent: Base model, tuning method, hyperparameterstraining: Batch size, learning rate, saving strategy
Project Structure
mimic-kit/
├── mimic/
│ ├── cli.py # CLI entry point
│ ├── config.py # Configuration models (Pydantic v2)
│ ├── generator/ # Teacher model data generation
│ └── trainer/ # Student model training (ms-swift)
├── data/ # Training data directory
├── config.yaml # Your configuration file
└── output/ # Model outputs and checkpoints
Requirements
- Python 3.13+
- CUDA-capable GPU (for training)
- OpenAI API key (or compatible API)
Development
# Run tests
uv run pytest
# Run single test
uv run pytest tests/test_cli.py::test_function
# Format code
uv run ruff format .
# Check linting
uv run ruff check .
License
MIT License - see LICENSE file for details.
Acknowledgments
Metadata
Release files for mimic-kit 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| mimic_kit-0.1.1.tar.gz | 14.1 kB | Without provenance | Details for mimic_kit-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| mimic_kit-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for mimic_kit-0.1.1-py3-none-any.whl |
Total release size: 29.9 kB
Release files / mimic_kit-0.1.1.tar.gz
| Download URL | mimic_kit-0.1.1.tar.gz |
|---|---|
| Size | 14.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c4c0ed22ac84b4a033d56482637d4ce57ed7ec26f0aaa8b2e4fe119c34b97666
|
|
BLAKE2b-256 checksum How to use checksums |
d360ec0793a8a0bcf3359ab73bb1f46f5dc3ae6e9fdf5215e61686a99fd18a1d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / mimic_kit-0.1.1-py3-none-any.whl
| Download URL | mimic_kit-0.1.1-py3-none-any.whl |
|---|---|
| Size | 15.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7bfc9d6ed81669862e715e36bcab89687cefe963f56966c559a49ac4760ed8b9
|
|
BLAKE2b-256 checksum How to use checksums |
213cfb9adc280c5dab035924f136eeb1996d801c6ef3511a0b8eb620439de9c7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.10.9 {"installer":{"name":"uv","version":"0.10.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for mimic-kit 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.