Skip to main content

Context-aware GPU/datacenter configuration recommender for LLM fine-tuning

Project description

Coastline

Context-aware recommender for GPU / datacenter configurations for LLM fine-tuning: it grid-searches configs for a workload, filters infeasible ones, predicts throughput + power, and ranks them on a performance↔energy score. Throughput comes from Kavier (analytical physics) or a data-driven model (TabPFN, CatBoost, …); energy from Kavier-power or the OpenDC simulator.

Accuracy (throughput MdAPE, 15% holdout): default intelligent = cache hit (0%) → Kavier (6.2%), never a weak model. Available ML predictors (bring your own trained artifacts): TabPFN 2.1%, XGBoost 7.2%, CatBoost 8.4%, LightGBM 9.1%. Weaker linear/GP/MLP baselines are opt-in.

Install

python -m venv .venv && source .venv/bin/activate
pip install coastline-recommender                 # core engine (Kavier physics path)
pip install "coastline-recommender[autoconf]"     # + AutoConf OOM-feasibility safeguard
pip install "coastline-recommender[ml]"           # + heavy ML backends (TabPFN, XGBoost, …)

For development from a checkout: pip install -e ".[dev]" (plus pip install -e ./common for the shared coastline_common models).

  • Kavier — declared dependency, pulled from PyPI (kavier>=0.4,<0.5). For Kavier dev: pip install -e ../kavier.

  • AutoConf — the OOM-feasibility safeguard (IBM's open-source ado, on public PyPI as ado-autoconf). Install it with the extra: pip install "coastline-recommender[autoconf]". Without it the recommender refuses by default; COASTLINE_ALLOW_RULES_FALLBACK=1 degrades to divisibility-only feasibility (no OOM check).

    NOTE — install AutoConf via the extra, not pip install autoconf. The bare PyPI name autoconf is an UNRELATED package; the OOM checker is ado-autoconf, pulled in by coastline-recommender[autoconf]. If you don't need the OOM check, use feasibility: rules (the divisibility-only path that needs no AutoConf at all).

API & CLI map

Entry point Shape Returns When to use
coastline(throughput_estim=...)(workload) single WorkloadSpec / dict / CSV path list[Recommendation] Low-latency single-workload queries; best for scripting or direct Python use
coastline.recommend(batch, ...) DataFrame / list[dict] / dict pd.DataFrame (input rows + predictions) Batch processing — one or many workloads, per-row column overrides, top_k shortlists
coastline-recommend --config C --input I --output O CSV → CSV (driven by YAML config) output CSV (one row per workload) Production batch; config declares safeguards (feasibility, max_slowdown)
coastline-enrich-trace fine-tuning trace CSV enriched CSV Add Coastline predictions to an existing trace
coastline-plot-trace enriched trace CSV HTML / PNG plots Visualise a trace after enrichment
make gui FastAPI dashboard on :8000 Interactive UI + REST API for exploration and integration testing (dev checkout)

See docs/usage.py (batch API walkthrough), docs/demo_usage/ (facade + CSV examples), and examples/ (config + workload CSVs) for runnable examples.

Use it — Python facade

import coastline

rec = coastline(throughput_estim="Kavier")     # or "tabpfn", "intelligent", a model name
results = rec(
    {"llm_model": "mistral-7b-v0.1", "fine_tuning_method": "lora",
     "gpu_model": "NVIDIA-A100-SXM4-80GB", "tokens_per_sample": 1024, "batch_size": 32},
    total_gpus=[1, 2, 4, 8], preset="balanced",   # multi-objective weighting
)
print(results[0])     # best-ranked Recommendation

First arg is a WorkloadSpec, a dict of its fields, or a CSV path. preset (balanced/performance/energy) or explicit alpha/beta set the trade-off; pass context=SystemContext(...) or let one be derived from the workload + max_gpus.

Use it — batch CSV → CSV

Feed a config (strategy + predictors + grid + safeguards) and an input CSV of workloads; get one recommended config per row.

coastline-recommend --config examples/batch_config.yaml \
                    --input examples/workloads.csv --output recommendations.csv
import coastline
coastline.recommend_csv("examples/batch_config.yaml", "workloads.csv", "out.csv")

Input columns are flexible (model_name/llm_model, method/peft, …); remap arbitrary headers via input.columns. Two config-driven safeguards: predictors.feasibility: autoconf (OOM-aware) and strategy.max_slowdown (never recommend a config slower than N× the fastest feasible one). See examples/batch_config.yaml.

Use it — CLI / API

make recommend          # python -m coastline_recommender.engine --config config/coastline_functionality/config.yaml
make gui                # FastAPI dashboard on http://127.0.0.1:8000 (dev checkout)
coastline-recommend --help   # batch CSV→CSV console entry

Architecture

Package Role Shipped in the wheel
coastline Public facade + batch CSV→CSV + CLI (the deployment surface) yes
coastline_recommender Engine — grid → feasibility → simulate → rank pipeline + predictors yes
coastline_common Shared models (WorkloadSpec, SystemContext, Recommendation) yes
coastline_recommender/.../data_driven/trainer Offline ML-model training yes
benchmark Predictor evaluation suite no (dev only)
api FastAPI service no (dev only)

The published wheel ships only the three coastline* packages (the engine). The api, benchmark, scripts, and models directories are development/research tooling and are excluded from the distribution.

Test

make test         # full suite
make recq         # recommendation quality vs the ground-truth trace

Docker

One image, multiple entrypoints. AutoConf OOM feasibility is enforced by default (installed from PyPI via the autoconf extra).

docker compose up --build api                # serve the dashboard on :8000
docker compose run --rm recommender          # one-shot recommendation
docker compose --profile dev run --rm dev    # run the test suite in a container

External dependencies (not vendored)

  • Kavier — analytical throughput/power model; PyPI dependency (kavier>=0.4,<0.5). Dev override: pip install -e ../kavier.
  • OpenDC — optional Java simulator for the energy: opendc path; point OPENDC_BIN_PATH at a built runner. Not needed for the default Kavier-power energy.
  • ML pickles — the data-driven predictors load trained artifacts from a models/ directory next to the install root; these are not bundled in the published wheel. Retrain them with the trainer package, or point the predictors at your own artifacts (e.g. TABPFN_MODEL_PATH for TabPFN). The default Kavier (physics) path needs no pickles.

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

coastline_recommender-0.1.0.tar.gz (113.3 kB view details)

Uploaded Source

Built Distribution

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

coastline_recommender-0.1.0-py3-none-any.whl (166.1 kB view details)

Uploaded Python 3

File details

Details for the file coastline_recommender-0.1.0.tar.gz.

File metadata

  • Download URL: coastline_recommender-0.1.0.tar.gz
  • Upload date:
  • Size: 113.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for coastline_recommender-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7052f540ce5106ed179bf069c61773b06fd703ee86f27c34e1d1302cb471fba7
MD5 cea884486e46c4de6f6ceccf9e304516
BLAKE2b-256 69cf7651d03abe03ebcfd774d9f4cb13e807f5745101211138962a6767f35a36

See more details on using hashes here.

Provenance

The following attestation bundles were made for coastline_recommender-0.1.0.tar.gz:

Publisher: publish.yml on atlarge-research/coastline

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file coastline_recommender-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for coastline_recommender-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 62108a5a4af6e38e48cfe1ff058194d46d60fa7f443d660c082c9d92eed3deeb
MD5 193be192893e194d1b00ffcae997e967
BLAKE2b-256 034d36f9720e505ca4ced0771be8d9eb470baac813893bd5fc614cd6616df44c

See more details on using hashes here.

Provenance

The following attestation bundles were made for coastline_recommender-0.1.0-py3-none-any.whl:

Publisher: publish.yml on atlarge-research/coastline

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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