Skip to main content

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

  1. Start with T_init=8.0 (high temperature -> smooth teacher logits)
  2. Propose T' = T + random perturbation
  3. Metropolis acceptance: P = min(1, exp(-dE / T_SA))
  4. SA cooling: T_SA *= 0.97 each step
  5. Converges to optimal temperature for student capacity

Requirements

  • Python 3.12+
  • grilly >= 0.4.0
  • grillyinference >= 0.1.0
  • numpy

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

grillydistil-0.1.0.tar.gz (22.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

grillydistil-0.1.0-py3-none-any.whl (13.6 kB view details)

Uploaded Python 3

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

Hashes for grillydistil-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4a3bdb11d798e65773bd36e2668645fedad4e8ff22226bf0db06fd6cf0136fb0
MD5 f120627617d01b63b5393a5da22f79a5
BLAKE2b-256 e370753d90ba8c56fd74c441aab9e33c58d33d2b8b847417d64d6eb6b903933c

See more details on using hashes here.

Provenance

The following attestation bundles were made for grillydistil-0.1.0.tar.gz:

Publisher: publish.yml on Grillcheese-AI/GrillyDistil

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for grillydistil-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 17d4d5c43d39cd4bf81d440221dc6b36470e698816ca236ab95ba5ceadba6b9e
MD5 7034c881c0b06ee3abf177754372e4ff
BLAKE2b-256 f178fb25d321420f945f524d447e22454edcbce579ce2a51a1bdd3152536e29c

See more details on using hashes here.

Provenance

The following attestation bundles were made for grillydistil-0.1.0-py3-none-any.whl:

Publisher: publish.yml on Grillcheese-AI/GrillyDistil

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page