Skip to main content

Custom Triton/CUDA kernels that complement Liger Kernel for LLM post-training

Project description

Chalk

Custom Triton/CUDA kernels that complement Liger Kernel.

pip install freesolo-chalk

Liger fuses the cross-entropy, activation, and RMSNorm paths. Chalk fills the gaps that matter for Freesolo's Flash post-training stack — fused GEMMs, the LoRA-delta matmuls, the QKV norm+RoPE epilogue, embedding gather, and FP8 frozen-base GEMMs — each behind a documented, benchmarked, opt-in entry point.

Chalk's repository layout and conventions intentionally mirror Liger Kernel.

Layout

src/chalk/
  ops/           # raw Triton/CUDA kernels + autograd.Function wrappers
  transformers/  # model-level installers that monkeypatch kernels into HF modules
  utils.py       # device detection helpers
test/            # correctness + gating tests (mirrors test/ops, test/transformers)
benchmark/       # speed + fp32-correctness A/B harness

Design principles

  • Worker-side kernel library. Like Liger, chalk depends on torch + triton — it is meant to be installed where kernels actually run (the GPU worker), so consumers should depend on it from a gpu extra rather than their base install. Importing the top-level chalk package is still cheap (kernels lazy-load), so probing chalk.utils.infer_device() never forces a heavy import.
  • Complements, not replaces, Liger. Liger fuses CE / activation / RMSNorm; chalk fuses the GEMMs, LoRA delta, QKV epilogue, embedding, and FP8 base.
  • Safe fallback. Every installer is arch-gated, runs a numeric self-test on install, patches only frozen nn.Linear layers (never trainable / PEFT-wrapped layers), and silently falls back to the eager / Liger path on any import / compile / self-test failure.
  • Opt-in & evidence-based. Kernels are off unless explicitly enabled, and every kept kernel has end-to-end loss-curve evidence — not just a microbenchmark.

Development

pip install -e '.[dev]'
make checkstyle   # ruff check + format
make test         # pytest with coverage
make run-benchmarks

Status

Intentionally minimal to start — kernels are landed one at a time under chalk/ops + chalk/transformers, each with correctness tests and benchmark evidence.

License

BSD-2-Clause. See LICENSE and NOTICE.

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

freesolo_chalk-0.2.0.tar.gz (205.9 kB view details)

Uploaded Source

Built Distribution

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

freesolo_chalk-0.2.0-py3-none-any.whl (102.8 kB view details)

Uploaded Python 3

File details

Details for the file freesolo_chalk-0.2.0.tar.gz.

File metadata

  • Download URL: freesolo_chalk-0.2.0.tar.gz
  • Upload date:
  • Size: 205.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for freesolo_chalk-0.2.0.tar.gz
Algorithm Hash digest
SHA256 5c5859731c9ff60f892ce52b3d55dbdb03a905975a8a1d145d1f766434b8fdef
MD5 0258e813676108d9d5ec3603985cc817
BLAKE2b-256 12bf24a6b1a1c2e63b0055fa4572e4d8c0a130664560c41312376eff3d0f0ee8

See more details on using hashes here.

File details

Details for the file freesolo_chalk-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: freesolo_chalk-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 102.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for freesolo_chalk-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3e3b56e9bee5abf59b0281ad2cf6d8d79639eaaae3ff022364b872b5bf0bfbdb
MD5 b55b5c7b23f01e7c563ab6e3a7999743
BLAKE2b-256 7b8ae5fc30d1666b64f4da1cc07fb996e291b51207913adef85098b18831c189

See more details on using hashes here.

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