Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Tuner & plans

Reference for the Tuner base class, the bundled HeuristicTuner and AlgentaTuner, and every field and method of the TuningPlan dataclass.

A Tuner inspects a collection and a workload and emits a TuningPlan — a serializable description of the recall target, exact-search crossover, and IVF layout to apply. Tuner and TuningPlan are top-level imports; the concrete tuners resolve from the signed native runtime or an optional adapter.

from telys import Tuner, TuningPlan

Tuner (base class)

Tuner is the abstract interface every tuner implements. It defines the contract but computes no plans — tune_collection raises NotImplementedError.

Attribute / method
Signature
Description

name

str — "base"

Identifier recorded on plans produced by this tuner.

mode

str

How Collection.tune(dry_run=None) behaves. When it equals "suggest_then_apply", a None dry-run applies the plan automatically; otherwise a None dry-run only suggests.

tune_collection

tune_collection(collection, workload=None, objectives=None) -> TuningPlan

Build a plan for collection under an optional workload and objectives. Base raises NotImplementedError — use a concrete tuner.

choose_plan

choose_plan(stats, query)

Query-time hook: pick search parameters given current collection stats and a query. Primarily overridden by runtime tuners.

explain

explain()

Return a description of the strategy this tuner uses to make its decisions.

workload and objectives are free-form inputs a concrete tuner interprets — for example a sample of representative queries, or a latency/recall objective. The base accepts them for interface stability.

Bundled tuners

You rarely construct Tuner directly. Two concrete implementations exist, both outside the runtime-free SDK:

The default, dependency-free tuner. Listed in telys.__all__, it resolves lazily from the signed native runtime.

from telys import HeuristicTuner   # ImportError without the runtime installed

It sizes the IVF and picks nprobe from collection statistics and your recall target — no query sample or training required.

An optional, workload-aware tuner in the separate telys-algenta adapter — not part of the telys package.

from telys_algenta import AlgentaTuner   # provided by the telys-algenta adapter

It fits parameters to a supplied workload (representative queries), matching your access pattern more tightly than the heuristic default.

Attach a tuner when you create a collection, so col.tune() knows which one to run:

TuningPlan

A dataclass recording a tuning decision. Every field is a plain attribute; it carries no engine handles and is safe to log, diff, and serialize.

Fields

Field
Type
Meaning

collection

str

Name of the collection this plan targets.

tuner

str

name of the tuner that produced the plan.

target_recall

float

Recall the plan aims for; becomes default_target_recall when applied.

exact_crossover_rows

int

Row count below which a partition keeps exact (brute-force) search.

ivf

dict

Chosen IVF layout — for example the number of cells and the nprobe to scan.

expected

dict

Predicted post-apply metrics (for example p50 / p95 latency in ms, recall_at_k, fallback_rate).

constraints

dict

The latency / recall / memory bounds the tuner was asked to honor.

decision_trace

list

Ordered, readable steps explaining how the tuner arrived at the plan.

workload_hash

str

Fingerprint of the workload the plan was fit to (empty when none was supplied).

engine

str

Engine identifier; defaults to "telys".

plan_id

str

Stable identifier; auto-filled as "tune_<hash>" when left empty.

Methods

Method
Returns
Description

as_dict()

dict

The plan as a plain dictionary — every field, ready to log or compare.

to_json(**kw)

str

JSON string of the plan; keyword arguments pass through to the JSON encoder (for example indent=2).

There is no TuningPlan.save. A plan is a description, not persistent state. Apply it with col.apply_tuning(plan), then persist with col.save(), which stores default_target_recall and applied_tuner.

See also

Last updated

Was this helpful?