Skip to content

tier_classes

tier_classes

Family-neutral tier classes frontier, balanced and light from catalog v2 (MC1c).

The existing capability classes name a job (review) or a rough strength (strong). A tier class names a capability tier, the way "Opus class, Sonnet class, Haiku class" does, with no family in the name: any family's model may sit in it, at the reasoning effort that makes it that tier.

tier_chains is a pure function from a validated catalog and the profiles a machine has to the three chains. It is run twice with different inputs:

  • against the BUILTIN profiles, to generate the packaged classes/default.yaml block (python -m marianne.instruments.tier_classes --write-default);
  • against the registered profiles of one machine, by mzt instruments classes tiers (printed, or written to a proposal file the owner merges by hand; the user layer is never written).

Rules (each has a test):

  • only non-provisional tier claims count (a guess is never a class member);
  • only routes whose access is in allow_access (default: no metered);
  • models whose status is superseded, deprecated, retired or sunset are skipped;
  • each entry pins the LOWEST effort at which the model reaches the tier, the cheapest way to get that class, and only an effort the profile maps for that model; a route whose profile maps none of the qualifying efforts is skipped;
  • where the effort is part of the model slug (antigravity: ...-high) the entry names the full slug and carries no effort;
  • access order is strict: every subscription entry before any free one, every free before any local (a flat-rate plan is the dependable seat; a free tier is shared quota). Within one access group entries alternate families (round robin) so a fallback leaves the family that just failed; before alternation a model in its own tier (the tier it reaches at its default effort) comes before one borrowed by raising or lowering its effort, then the cheaper effort first;
  • a model whose recorded Terminal-Bench 4.0 score is below AGENTIC_FLOOR is left out of every tier: a light worker still has to drive a coding agent (Nemotron 3.5 Lightning, TB4 0.5%, was fourth in light before this rule). A model with no TB4 record is not judged by it.

Attributes

Classes

TierEntry dataclass

TierEntry(profile, model, effort, family, catalog_id, access)

One chain step plus the catalog facts that placed it.

Functions:

tier_chains

tier_chains(catalog, *, profiles_available, allow_access=DEFAULT_ALLOW_ACCESS)

The frontier/balanced/light chains the catalog yields for these profiles.

profiles_available is the profile set to seat entries on (builtins for the packaged default, the registered profiles for a machine). A tier with no qualifying entry maps to an empty list; the caller decides what to do with it.

Source code in src/marianne/instruments/tier_classes.py
def tier_chains(
    catalog: Catalog,
    *,
    profiles_available: Mapping[str, InstrumentProfile] | Iterable[InstrumentProfile],
    allow_access: Collection[str] = DEFAULT_ALLOW_ACCESS,
) -> dict[Tier, list[TierEntry]]:
    """The ``frontier``/``balanced``/``light`` chains the catalog yields for these profiles.

    ``profiles_available`` is the profile set to seat entries on (builtins for the
    packaged default, the registered profiles for a machine). A tier with no
    qualifying entry maps to an empty list; the caller decides what to do with it.
    """
    profiles: Mapping[str, InstrumentProfile] = (
        profiles_available
        if isinstance(profiles_available, Mapping)
        else {p.name: p for p in profiles_available}
    )
    family_order = {slug: i for i, slug in enumerate(catalog.files)}
    result: dict[Tier, list[TierEntry]] = {}
    for tier in TIER_CLASSES:
        ranked: list[tuple[tuple[int, int, int, int, int], TierEntry]] = []
        for position, model in enumerate(catalog.models()):
            if model.status in SKIPPED_STATUSES or model.tier_status.provisional:
                continue
            if _below_agentic_floor(model):
                continue
            if tier not in model.tier_by_effort.values():
                continue
            borrowed = 0 if _home_tier(model) == tier else 1
            for entry in _candidates(model, tier, profiles, allow_access):
                key = (
                    _ACCESS_ORDER.index(entry.access) if entry.access in _ACCESS_ORDER else 9,
                    borrowed,
                    _effort_rank(entry.effort, entry.model, model),
                    family_order.get(model.family, len(family_order)),
                    position,
                )
                ranked.append((key, entry))
        ranked.sort(key=lambda pair: pair[0])
        chain: list[TierEntry] = []
        for access_rank in sorted({key[0] for key, _ in ranked}):
            group = [entry for key, entry in ranked if key[0] == access_rank]
            chain.extend(_alternate_families(group))
        result[tier] = chain
    return result

chains_to_classes

chains_to_classes(chains)

Class name -> chain as plain class-file data; empty tiers are omitted.

Source code in src/marianne/instruments/tier_classes.py
def chains_to_classes(chains: Mapping[Tier, list[TierEntry]]) -> dict[str, list[dict[str, object]]]:
    """Class name -> chain as plain class-file data; empty tiers are omitted."""
    return {tier: [e.as_dict() for e in chains[tier]] for tier in TIER_CLASSES if chains.get(tier)}

render_classes_block

render_classes_block(chains, *, indent=2)

YAML text of the tier classes (flow-style entries, one per line, with a why comment).

Source code in src/marianne/instruments/tier_classes.py
def render_classes_block(chains: Mapping[Tier, list[TierEntry]], *, indent: int = 2) -> str:
    """YAML text of the tier classes (flow-style entries, one per line, with a why comment)."""
    pad = " " * indent
    lines: list[str] = []
    for tier in TIER_CLASSES:
        chain = chains.get(tier) or []
        if not chain:
            continue
        lines.append(f"{pad}{tier}:")
        for entry in chain:
            config = f"model: {entry.model}"
            if entry.effort is not None:
                config += f", effort: {entry.effort}"
            lines.append(
                f"{pad}  - {{profile: {entry.profile}, config: {{{config}}}}}"
                f"  # {entry.family}, {entry.access}"
            )
    return "\n".join(lines) + "\n"

render_proposal

render_proposal(chains, *, machine_note)

A classes-file fragment the owner may merge by hand into ~/.marianne/classes.yaml.

Source code in src/marianne/instruments/tier_classes.py
def render_proposal(
    chains: Mapping[Tier, list[TierEntry]], *, machine_note: str,
) -> str:
    """A classes-file fragment the owner may merge by hand into ``~/.marianne/classes.yaml``."""
    header = (
        "# Proposal from `mzt instruments classes tiers --write-proposal`.\n"
        "# NOT installed: Marianne never writes your classes file. To use it, copy the\n"
        "# `frontier`, `balanced` and `light` chains you want under `classes:` in\n"
        "# ~/.marianne/classes.yaml (a class defined there replaces the packaged chain\n"
        "# whole), or leave them out and the packaged chains stand.\n"
        f"# {machine_note}\n"
    )
    return header + "version: 1\nclasses:\n" + render_classes_block(chains)

splice_default_yaml

splice_default_yaml(text, block, header)

Replace (or append) the generated section of default.yaml; the rest is untouched.

Source code in src/marianne/instruments/tier_classes.py
def splice_default_yaml(text: str, block: str, header: str) -> str:
    """Replace (or append) the generated section of ``default.yaml``; the rest is untouched."""
    section = f"{BEGIN_MARKER}\n{header}{block}{END_MARKER}\n"
    if BEGIN_MARKER in text:
        before, rest = text.split(BEGIN_MARKER, 1)
        _, after = rest.split(END_MARKER, 1)
        return before + section + after.lstrip("\n")
    return text.rstrip("\n") + "\n" + section