Skip to content

Adopt content-addressed SQLite cache with HF sync - #77

Draft
ErlisLushtaku wants to merge 5 commits into
erlislushtaku/feat/add-meta-evalfrom
restore/cache-sqlite-adopt
Draft

Adopt content-addressed SQLite cache with HF sync#77
ErlisLushtaku wants to merge 5 commits into
erlislushtaku/feat/add-meta-evalfrom
restore/cache-sqlite-adopt

Conversation

@ErlisLushtaku

@ErlisLushtaku ErlisLushtaku commented Jul 19, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Content-address judgements by rendered judge input and isolate configs in hashed SQLite cell folders.
  • Wire local store reuse into generate/evaluate and ELO, with fetch-by-default / push-opt-in Hugging Face sync (judgearena-cache).
  • Add backfill for saved annotation runs and document the shared-cache workflow, including NFS/WAL caveats.

@ErlisLushtaku
ErlisLushtaku marked this pull request as draft July 19, 2026 12:56

@geoalgo geoalgo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this @ErlisLushtaku ! Just had a first read, did not finish it, I will finish the PR in a second pass but already have some comments.

One thing that occurs to me as well, the storage seems to be a bit leaking in the sense that all mains needs to be modified and it seems that we must make them aware of the caching.

However, ideally I think we could have something which is more like:

completion_fun = make_model(model, cache_args)
annotation_fun = make_model(judge_model, cache_args)

and then call those in any entrypoint with something like

completions, metadata = completion_fun(
  inputs=...,
  hash=...,
)

which would feel less invasive and hopefully will reduce the LOC change.

Comment thread README.md Outdated

### Shared SQLite cache

Pass `--store_root <path>` to reuse completion and judgement rows across runs.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think adding a high level description before would make sense, something like:

Suggested change
Pass `--store_root <path>` to reuse completion and judgement rows across runs.
Storing completions and judgement annotations can be made so that LLM calls are avoided by reading from disk. Completions and judgements are written into `~/judgearena-data/db/completions/{task}/{model_name}/{provider}/{config_hash}/` and can be deleted by the user (judgements can be accessed in judgements/). In addition, completions can be fetched from a shared Hugginface (fetching is activated by default, sharing is not).
Pass `--store_root <path>` to reuse completion and judgement rows across runs.

Comment thread scripts/migrate_olmo3_to_store.py Outdated

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we may not need that one right?

Comment thread scripts/benchmark_store_speed.py Outdated
@@ -1,4 +1,4 @@
"""Benchmark SQLiteCompletionStore / SQLiteJudgementStore load and missing_indices speed.
"""Benchmark SQLite completion/judgement store lookup speed.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps we move those to scripts/db/ to avoid spamming scripts/?

Comment thread judgearena/cli.py Outdated
max_model_len=args.max_model_len,
chat_template=args.chat_template,
result_folder=args.result_folder,
store_root=args.store_root,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would it be clear to add those to a namespace with a cache config?

eg to add args.cache_config with its own dataclass which contains those 6 fields.

Comment thread judgearena/estimate_elo_ratings.py Outdated
return Path(store_root) / kind / task / model_name / provider
def _cache_stores(
args: CliEloArgs,
) -> tuple[

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We almost never wants to return a tuple with 5 elements.
Ideally, we splits into subfunctions which do different things, if not possible we should do a dataclasses (but here it really looks like we could do separate functions, for instance, it would be cleaner to pass judge_system_prompt, judge_user_prompt as input and we have already 2 outputs less.

Comment thread judgearena/estimate_elo_ratings.py Outdated
if args.store_root is not None:
comp_folder = _store_folder(
args.store_root, "completions", args.arena, args.model
def _collapse_elo_prefs(prefs: list, n_battles: int) -> list:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def _collapse_elo_prefs(prefs: list, n_battles: int) -> list:
def _collapse_elo_prefs(prefs[float]: list, n_battles: int) -> list[float]:

?

Comment thread judgearena/estimate_elo_ratings.py Outdated
comp_folder = _store_folder(
args.store_root, "completions", args.arena, args.model
def _collapse_elo_prefs(prefs: list, n_battles: int) -> list:
if len(prefs) == n_battles:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The contract of this function is a bit weird, it feels to me that this would be cleaner:

# in the caller
if args.swap_mode:
  # average the preferences which are the concatentation of preference with A and B as model and then reverse
  prefs = _collapse_pairwise_prefs(raw_prefs)
else: 
  prefs = raw_prefs 

Comment thread judgearena/estimate_elo_ratings.py Outdated
return collapsed


def _cache_elo_direction(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The name is not super telling, perhaps _cache_elo_judgement?

Introduce content-addressed SQLite cells with atomic metadata associations and deterministic Hugging Face merge semantics.

Includes-AI-Code: true
Add lazy prepared-model adapters and route inference through versioned, provider-aware descriptors without initializing backends on full hits.

Includes-AI-Code: true
Thread one inference cache through generation, judging, ELO, MT-Bench, and meta-eval while removing the legacy pass-level cache paths.

Includes-AI-Code: true
Expose strict cache synchronization commands and conservatively reconstruct hosted judge rows from verifiable saved-run artifacts.

Includes-AI-Code: true
Describe cache modes, hosted-provider limits, offline Hugging Face synchronization, SQLite constraints, and conservative migration examples.

Includes-AI-Code: true
@ErlisLushtaku
ErlisLushtaku force-pushed the restore/cache-sqlite-adopt branch from cce746f to 75c7699 Compare July 24, 2026 21:37
@ErlisLushtaku
ErlisLushtaku changed the base branch from cache to erlislushtaku/feat/add-meta-eval July 24, 2026 21:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants