Skip to main content

evolvers

PyPI CI License: Apache-2.0 Python Downloads

Evolvable AI programs: define a Python function + criteria of success, the bound LLM iteratively rewrites the function body to maximize the criteria score.

Status: early PoC. APIs will change.

Idea

A program is a Python function with an injected llm. Criteria are either natural-language LLM judges or plain code, each scoring outputs in [-1, 1]. An LLM-driven optimizer proposes mutations to the function body; mutations that improve the weighted score are accepted, the rest are reverted. Trained programs save to disk and reload by URI.

Quick look

evolvers is async-primary — train, evaluate, and calling an Evolvable are coroutines.

End-to-end runnable example: fetch a small dataset with lurkers, then train a TLDR program against it.

uv add evolvers lurkers
import asyncio
import evolvers as ev
import lurkers

def tldr(input_text: str, llm) -> str:
    return input_text[:130] + "..."  # naive baseline; the optimizer rewrites this

async def main():
    # Bring your own data — here, three arXiv abstracts.
    docs = await asyncio.gather(
        lurkers.afetch("https://arxiv.org/abs/1706.03762"),  # Attention Is All You Need
        lurkers.afetch("https://arxiv.org/abs/2005.14165"),  # GPT-3
        lurkers.afetch("https://arxiv.org/abs/2310.06825"),  # Mistral 7B
    )
    dataset = [d.content for d in docs]

    llm = ev.LLM(model="claude-opus-4-7")  # or any OpenAI-compatible endpoint

    evo = ev.Evolvable(
        tldr,
        criteria=[
            ev.judge("Does it directly summarize the main points as a TLDR?"),
            ev.code(lambda output_text:
                max(-1.0, 1 - 2 * max(0, (len(output_text) - 140) / 140))),
        ],
        llm=llm,
    )

    await evo.train(dataset, num_train_epochs=10)
    print(evo.source)  # the function body the optimizer settled on
    evo.save("you/tldr-v1:claude-opus-4-7")

    reloaded = ev.Evolvable.load("you/tldr-v1:claude-opus-4-7")
    print(await reloaded(dataset[0]))

asyncio.run(main())

Sync wrappers (evo.train_sync, evo.evaluate_sync, evo.call_sync) exist for non-async codebases. See examples/with_lurkers.py for the full version.

Install (from source)

git clone https://github.com/tiramisu-sh/evolvers
cd evolvers
uv sync

What works today

  • ev.LLM against Anthropic and OpenAI-compatible endpoints (vLLM, Ollama, OpenAI, Azure)
  • Structured output via pydantic schemas (schema=)
  • ev.judge(question) + ev.code(callable) criteria; lambdas captured as def for round-tripping
  • await evo.train(dataset, num_train_epochs=N) — propose-test-accept-or-revert loop driven by the bound LLM
  • Evolvable.save("owner/name:variant") / Evolvable.load(...) for sharing trained programs
  • Evolvable.clone().set_llm(other) for variants

Validated end-to-end against a local Qwen3.5-27B reasoning model: naive truncation baseline → optimized LLM-using TLDR in one mutation attempt.

License

Apache-2.0.

Metadata

Release files for evolvers 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for evolvers 0.2.0
File Size Uploaded Provenance Actions
evolvers-0.2.0.tar.gz 54.6 kB Without provenance Details for evolvers-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for evolvers 0.2.0
File Interpreter ABI Platform Actions
evolvers-0.2.0-py3-none-any.whl Python 3 none any Details for evolvers-0.2.0-py3-none-any.whl

Total release size: 77.4 kB

Release files / evolvers-0.2.0.tar.gz

Download URL evolvers-0.2.0.tar.gz
Size 54.6 kB
Tags Source
SHA-256 checksum
How to use checksums
9955567dbf42af9c8f74aa751f753831058be008329f10977ec30cd9baaf3785
BLAKE2b-256 checksum
How to use checksums
622708292852de390caea2bf70e833bd51516444ffe9efe01b289893321be825
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / evolvers-0.2.0-py3-none-any.whl

Download URL evolvers-0.2.0-py3-none-any.whl
Size 22.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c5a1737220d2e429ee84a039fa3dab0f2585838635ab187c4f5a3ca60b07792a
BLAKE2b-256 checksum
How to use checksums
541ab3b5a99143aec5d07d07f9eca48a5186ea76513f5406ea7540b07ce3a6fe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for evolvers 0.2.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

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