adaptcompile
adaptcompile is a model-agnostic Python library for representing and comparing
observed model-adaptation experiments.
adaptcompile treats model adaptation as a behavioral transformation that can be
represented, measured, and compared independently of the training framework used to
produce it. It provides the representation and analysis foundation on which future
adaptation-compilation functionality can be built.
See the architecture overview for how the objects fit together.
Installation
pip install adaptcompile
DataFrame exports are optional:
pip install "adaptcompile[dataframe]"
For contributor setup:
python -m pip install -e ".[dev]"
Minimal example
from adaptcompile import (
AdaptationResult,
AdaptationStudy,
LearningEpisode,
ModelContext,
ProgramSpec,
)
model = ModelContext("example/model", revision="v1", base_state_id="base-1")
episode = LearningEpisode(
"toy-task",
train=["example"],
evaluations={"accuracy": ["held-out example"]},
episode_id="toy-task-v1",
)
results = [
AdaptationResult(
model_context=model,
episode=episode,
program=ProgramSpec(name, "adapter", {"strength": strength}),
before={"accuracy": 0.40},
after={"accuracy": score},
)
for name, strength, score in [
("gentle", 0.25, 0.68),
("strong", 0.75, 0.81),
]
]
study = AdaptationStudy(results)
print(study.best("accuracy").program.name)
print(study.best("accuracy").delta.to_dict())
More runnable examples are available in examples.
Core objects
ModelContextidentifies a model revision and pre-adaptation base state.LearningEpisodenames a learning problem and references its datasets.ProgramFamilydescribes a conceptual adaptation family.ProgramSpecdeclares one concrete, backend-independent adaptation program.AdaptationGeometrystores arbitrary-dimensional behavioral measurements.AdaptationResultrecords before/after geometry for one observed adaptation.AdaptationStudycompares programs for one fixed model context and episode.AdaptationDatasetstores observations across models, episodes, and programs.
Public records support JSON-safe serialization. Dataset-like objects attached to a
LearningEpisode are intentionally held by reference and are not serialized.
DataFrame export is available through the optional dataframe extra.
What adaptcompile does not do
- It does not train or load models.
- It does not implement LoRA or replace PEFT, TRL, or another training framework.
- It does not currently predict outcomes or select adaptation programs.
- It does not require PyTorch, Transformers, pandas, or any other ML framework.
Status
0.1.0 is the first public release. The API is usable but may evolve during the
0.x series. Compiler functionality may be added in future releases without adding
ML-framework dependencies to the representation layer.
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 adaptcompile-0.1.0.tar.gz.
File metadata
- Download URL: adaptcompile-0.1.0.tar.gz
- Upload date:
- Size: 29.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.12.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e0428c45910888ff3c2b3043daa94d6181ff93a14fa533ef1c1d2110dbe8d5a9
|
|
| MD5 |
264c55d0384f98b32bd288ce7758f984
|
|
| BLAKE2b-256 |
33ab3f20b81f559762a619c45d5ace89073e0760d64d41ccd9e697713bdae01f
|
File details
Details for the file adaptcompile-0.1.0-py3-none-any.whl.
File metadata
- Download URL: adaptcompile-0.1.0-py3-none-any.whl
- Upload date:
- Size: 19.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.12.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
12c2564c55f33ded69df33033228cdf6866bb07612feaf2e79fcbc04fb35b7a6
|
|
| MD5 |
ccee7f735ed5335477bfd59f79a37732
|
|
| BLAKE2b-256 |
113fd9ba21133694ca1ab6c595127dc835e2ca75445de9ad12ba48b2a839c111
|