Temperature-scaled distillation with SA-KD — optional grilly extension
Project description
GrillyDistil
Temperature-scaled knowledge distillation with SA-KD — optional grilly extension.
Features
- SA-KD Temperature — simulated annealing-based adaptive temperature
- Linear Annealing — fallback T=8 -> T=2 over first 30% of steps
- Expanded Prompts — 50 seed prompts per domain (200 total seeds)
- Distillation Trainer — full training loop with KL-divergence loss
- Compression Synergy — high-T phases produce 2-3x better compression ratios
Quick Start
pip install grillydistil
from grillydistil import SAKDTemperature, DistillationTrainer, PromptGenerator
# SA-KD Temperature
temp = SAKDTemperature(T_init=8.0, alpha=0.97)
for step in range(1000):
loss = train_step(temperature=temp.current_temperature)
new_T = temp.step(loss)
# Generate training prompts
gen = PromptGenerator(prompts_per_domain=500)
prompts = gen.generate() # 2000 total prompts across 4 domains
# Full distillation
trainer = DistillationTrainer(student_model, teacher_model, tokenizer)
losses = trainer.train(dataset, epochs=3)
SA-KD Algorithm
- Start with T_init=8.0 (high temperature -> smooth teacher logits)
- Propose T' = T + random perturbation
- Metropolis acceptance: P = min(1, exp(-dE / T_SA))
- SA cooling: T_SA *= 0.97 each step
- Converges to optimal temperature for student capacity
Requirements
- Python 3.12+
- grilly >= 0.4.0
- grillyinference >= 0.1.0
- numpy
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file grillydistil-0.1.0.tar.gz.
File metadata
- Download URL: grillydistil-0.1.0.tar.gz
- Upload date:
- Size: 22.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4a3bdb11d798e65773bd36e2668645fedad4e8ff22226bf0db06fd6cf0136fb0
|
|
| MD5 |
f120627617d01b63b5393a5da22f79a5
|
|
| BLAKE2b-256 |
e370753d90ba8c56fd74c441aab9e33c58d33d2b8b847417d64d6eb6b903933c
|
Provenance
The following attestation bundles were made for grillydistil-0.1.0.tar.gz:
Publisher:
publish.yml on Grillcheese-AI/GrillyDistil
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
grillydistil-0.1.0.tar.gz -
Subject digest:
4a3bdb11d798e65773bd36e2668645fedad4e8ff22226bf0db06fd6cf0136fb0 - Sigstore transparency entry: 976483315
- Sigstore integration time:
-
Permalink:
Grillcheese-AI/GrillyDistil@c4d42562a1b5de6f8ee2fec304752013537b72eb -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Grillcheese-AI
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c4d42562a1b5de6f8ee2fec304752013537b72eb -
Trigger Event:
release
-
Statement type:
File details
Details for the file grillydistil-0.1.0-py3-none-any.whl.
File metadata
- Download URL: grillydistil-0.1.0-py3-none-any.whl
- Upload date:
- Size: 13.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
17d4d5c43d39cd4bf81d440221dc6b36470e698816ca236ab95ba5ceadba6b9e
|
|
| MD5 |
7034c881c0b06ee3abf177754372e4ff
|
|
| BLAKE2b-256 |
f178fb25d321420f945f524d447e22454edcbce579ce2a51a1bdd3152536e29c
|
Provenance
The following attestation bundles were made for grillydistil-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on Grillcheese-AI/GrillyDistil
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
grillydistil-0.1.0-py3-none-any.whl -
Subject digest:
17d4d5c43d39cd4bf81d440221dc6b36470e698816ca236ab95ba5ceadba6b9e - Sigstore transparency entry: 976483320
- Sigstore integration time:
-
Permalink:
Grillcheese-AI/GrillyDistil@c4d42562a1b5de6f8ee2fec304752013537b72eb -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/Grillcheese-AI
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@c4d42562a1b5de6f8ee2fec304752013537b72eb -
Trigger Event:
release
-
Statement type: