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

Apply & save

Apply a TuningPlan with col.apply_tuning() to configure recall, crossover, and IVF, then persist the result with col.save().

Applying a plan and persisting it are two steps. col.apply_tuning(plan) writes the plan's settings onto the live collection; col.save() makes them durable on disk. A plan is only a description — there is no TuningPlan.save.

Before you start

  • You have a TuningPlan from running a pass (plan = col.tune(dry_run=True)).

  • The signed runtime is installed and verified.

What each call does

Call
Signature
Effect

col.apply_tuning(plan)

apply_tuning(plan) -> dict

Sets default_target_recall and the exact-search crossover, builds or reuses the per-partition IVF, sets nprobe, and returns the collection's stats().

col.save()

save() -> str

Commits the collection to disk and returns its directory. Persists default_target_recall and applied_tuner (alongside name, dim, dtype, key name, filter columns, id map, and embedder profile).

apply_tuning changes the in-memory collection immediately, but nothing is durable until save() writes collection.json. Exit without saving and the applied tuning is lost.

Apply, then save

1

Apply the plan

from telys import Telys

db = Telys("./store")
col = db.open_collection("notes")

plan = col.tune(dry_run=True)     # compute a plan, apply nothing yet
stats = col.apply_tuning(plan)    # now configure the live collection
2

Read the returned stats

apply_tuning returns the same dictionary as col.stats(), so you can confirm the new configuration.

print(stats["name"])              # notes
print(stats["external_ids"])      # live id count
print(stats)                      # runtime stats reflecting the applied IVF / recall
3

Persist it

path = col.save()                 # commit; returns the collection directory
print(path)                       # ./store/notes
4

Confirm it survived a reopen

db2 = Telys("./store")
reopened = db2.open_collection("notes")
print(reopened.stats())           # default_target_recall / applied_tuner are back

Expected result

After apply_tuning, the collection searches with the plan's recall target and IVF layout: large partitions use the approximate path, partitions below the crossover stay exact. After save(), reopening restores default_target_recall and applied_tuner from collection.json — no re-tuning needed.

notes
48213
./store/notes

From now on, every col.search(...) that does not pass its own target_recall= aims for the applied default_target_recall. Override per query, for example col.search(vector, target_recall=0.995).

Next steps

Last updated

Was this helpful?