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.

Compiler-ready data

adaptcompile.compiler combines an AdaptationDataset with externally supplied numeric decision-time descriptors to produce a validated supervised dataset. Feature extraction and prediction remain external in 0.2.

from adaptcompile.compiler import build_compiler_dataset

compiler_data = build_compiler_dataset(
    observations,
    episode_descriptors=episode_features,
    program_descriptors=program_features,
    target="delta",
)
print(compiler_data.feature_names)

See the compiler data contract for descriptor identities, namespaces, baseline features, and validation rules.

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 has no mandatory ML-framework or numerical-stack dependencies; pandas is optional for DataFrame export.

Status

0.2.0 adds compiler-ready supervised data assembly. The API is usable but may evolve during the 0.x series. The package does not extract features, fit models, predict outcomes, or select programs.

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.2.0.tar.gz (39.4 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.2.0-py3-none-any.whl (23.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: adaptcompile-0.2.0.tar.gz
  • Upload date:
  • Size: 39.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.12.14

File hashes

Hashes for adaptcompile-0.2.0.tar.gz
Algorithm Hash digest
SHA256 ca2663d7543ef580d45c195f1d7ac7ea3f915eded5320f694a04e96a8abaf960
MD5 08a5f5b2aaaf1d8ef48300b1c1d4e468
BLAKE2b-256 215ed2e7026d709546399555d408b4e12a629401b25e17fb9ab9f9623b58964b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: adaptcompile-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 23.4 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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3864c03390e7941725eac044214321bfba8c488c1d92e414806c9c5851bc86e4
MD5 beee1b40de3b68785cad641240562955
BLAKE2b-256 169fe1f7900e4d445c7423b0efd79b0d3bcccb39d27949d71dc9534a57927cc0

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

This release

0.2.0 This release

2 files

0.1.0

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