Skip to main content

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

  • ModelContext identifies a model revision and pre-adaptation base state.
  • LearningEpisode names a learning problem and references its datasets.
  • ProgramFamily describes a conceptual adaptation family.
  • ProgramSpec declares one concrete, backend-independent adaptation program.
  • AdaptationGeometry stores arbitrary-dimensional behavioral measurements.
  • AdaptationResult records before/after geometry for one observed adaptation.
  • AdaptationStudy compares programs for one fixed model context and episode.
  • AdaptationDataset stores 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

adaptcompile-0.1.0.tar.gz (29.7 kB view details)

Uploaded Source

Built Distribution

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

adaptcompile-0.1.0-py3-none-any.whl (19.0 kB view details)

Uploaded Python 3

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

Hashes for adaptcompile-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e0428c45910888ff3c2b3043daa94d6181ff93a14fa533ef1c1d2110dbe8d5a9
MD5 264c55d0384f98b32bd288ce7758f984
BLAKE2b-256 33ab3f20b81f559762a619c45d5ace89073e0760d64d41ccd9e697713bdae01f

See more details on using hashes here.

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

Hashes for adaptcompile-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 12c2564c55f33ded69df33033228cdf6866bb07612feaf2e79fcbc04fb35b7a6
MD5 ccee7f735ed5335477bfd59f79a37732
BLAKE2b-256 113fd9ba21133694ca1ab6c595127dc835e2ca75445de9ad12ba48b2a839c111

See more details on using hashes here.

Release history Release notifications | RSS feed

0.6.0

2 files

0.5.0

2 files

0.4.0

2 files

0.3.0

2 files

0.2.0

2 files

This release

0.1.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page