Logits Cookbook
logits_cookbook is a recipe library for training and evaluation on the Logits platform. It is built on the logits SDK and provides higher-level recipes, renderers, evaluation helpers, and end-to-end examples for Logits users.
Installation
- Create a Logits platform API key in your Logits console.
- Export it as
LOGITS_API_KEY. - Install the SDK and cookbook in a virtual environment.
pip install logits-sdk logits-cookbook
For local development on the cookbook itself:
pip install -e .
Backend Model
The cookbook builds on the same training, sampling, and checkpoint primitives exposed through logits. A minimal low-level flow looks like:
import logits
service_client = logits.ServiceClient()
training_client = service_client.create_lora_training_client(
base_model="meta-llama/Llama-3.2-1B", rank=32,
)
training_client.forward_backward(...)
training_client.optim_step(...)
training_client.save_state(...)
training_client.load_state(...)
sampling_client = training_client.save_weights_and_get_sampling_client(name="my_model")
sampling_client.sample(...)
See logits_cookbook/recipes/sl_loop.py and logits_cookbook/recipes/rl_loop.py for minimal examples.
To download the weights of any model:
import urllib.request
rest_client = service_client.create_rest_client()
# Resolve a short-lived, pre-signed download URL for the checkpoint archive.
# `model_path` points at sampler weights, e.g. logits://<run>/sampler_weights/<name>.
archive = rest_client.get_checkpoint_archive_url_from_tinker_path(
sampling_client.model_path
).result()
# `archive.url` is a pre-signed URL valid until `archive.expires`; fetch the archive.
urllib.request.urlretrieve(archive.url, "model-checkpoint.tar.gz")
Logits Cookbook
Besides these primitives, we also offer Logits Cookbook (a.k.a. this repo), a library of abstractions and starter scripts for customizing training environments.
The current primary getting-started path is the four starter scripts in logits_cookbook/recipes/:
sl_basic.py: configuration-driven supervised learning starter.sl_loop.py: minimal supervised learning loop close to the raw API.rl_basic.py: configuration-driven reinforcement learning starter.rl_loop.py: minimal reinforcement learning loop close to the raw API.
The repository still contains additional recipe directories for more advanced or experimental workflows, but they are not part of the primary entry path above.
Documentation
The docs/ directory contains the Logits Cookbook documentation for install, training, checkpointing, and evaluation workflows.
Note: The documentation files use MDX format (Markdown with JSX), which includes some syntax that isn't standard Markdown. You may see things like import statements, <Callout> components, or curly-brace expressions. These are artifacts of our documentation framework - the actual content should still be readable as Markdown.
If you find errors or want to improve the documentation, edit files in docs/ directly.
Import our utilities
Logits Cookbook includes several utilities:
renderersconverts tokens from/to structured chat message objectshyperparam_utilshelps calculate hyperparameters suitable for LoRAscheckpoint_utilshelps save, resume, and inspect checkpoints
Additional utilities, including evaluation integrations, remain available in the repository but are outside the current primary getting-started path.
Development Setup
uv sync --extra dev
pre-commit install
This installs dev dependencies and registers pre-commit hooks that run ruff formatting and linting on every commit. CI enforces these checks on all pull requests.
Contributing
This project is built in the spirit of open science and collaborative development. We believe that the best tools emerge through community involvement and shared learning.
We welcome PR contributions.
Metadata
Release files for logits-cookbook 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| logits_cookbook-0.1.2.tar.gz | 858.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| logits_cookbook-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 1.4 MB
Release files / logits_cookbook-0.1.2.tar.gz
| Download URL | logits_cookbook-0.1.2.tar.gz |
|---|---|
| Size | 858.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
be8f0210f4c1d6c64e56b74610169e80a3584bfc620f7d77f2efd2e1aa09b0d4
|
|
BLAKE2b-256 checksum How to use checksums |
79c371287dec571bf31ae8a1d4a72d2416a1266068a5500826590c916af34d85
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 9, 2026.
Transparency logRelease files / logits_cookbook-0.1.2-py3-none-any.whl
| Download URL | logits_cookbook-0.1.2-py3-none-any.whl |
|---|---|
| Size | 507.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1e4f191d8c7e5ac3932afb98649f9de78ae165d7bba90a070eece6007c107e71
|
|
BLAKE2b-256 checksum How to use checksums |
02a9e905d11a6260a49eda034b4f7b33fb8631a5fc2feb4186680ab61cc6184b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 9, 2026.
Transparency log