| """Canonical sample budgets per task. |
| |
| Single source of truth. Every family runner reads from here so that |
| cross-method comparison on each task is fair (same N for every method, |
| same instances, same indices). |
| |
| Normalization principle: |
| - Forecasting / regression-with-subsample tasks (T1, T4, T7): |
| N_eval = 1,000 / N_train = 10,000 (stratified subsample from larger pools) |
| - Ticker-holdout valuation tasks (T2, T5): |
| N_eval = 1,324 / N_train = 2,673 (full 30% holdout, no subsampling) |
| - Filing-level generation tasks (T3, T6): |
| N_eval = 1,058 (some holdout tickers lack complete XBRL); train varies |
| |
| Sample sizes are intentionally conservative -- ~10x the median peer-benchmark |
| scale (CiK 125 / WIT 446 / EDINET 350 / SciTS 1,250) so reviewers cannot |
| claim small-sample noise, while keeping LLM eval (4 LLMs x 7 tasks x ~1K |
| samples = ~28K calls) tractable on 4xA100 within the wall-clock budget. |
| |
| The values here are DEFAULTS; runners may override via the |
| `get_canonical_indices(task, split, n_eval=..., n_train=...)` keyword |
| arguments to regenerate (and re-cache) for a re-tune without rebuilding |
| any artifacts. |
| """ |
|
|
| from __future__ import annotations |
|
|
| from typing import Literal |
|
|
|
|
| Task = Literal["T1", "T2", "T3", "T4", "T5", "T6", "T7"] |
|
|
|
|
| |
|
|
| EVAL_N_PER_TASK: dict[Task, int] = { |
| "T1": 1_000, |
| "T2": 1_324, |
| "T3": 1_058, |
| "T4": 1_000, |
| "T5": 1_324, |
| "T6": 1_058, |
| "T7": 1_000, |
| } |
|
|
| TRAIN_N_PER_TASK: dict[Task, int] = { |
| "T1": 10_000, |
| "T2": 2_673, |
| "T3": 9_458, |
| "T4": 10_000, |
| "T5": 2_673, |
| "T6": 1_377, |
| "T7": 10_000, |
| } |
|
|
|
|
| |
|
|
| SEED: int = 42 |
|
|
| |
| |
| |
| |
| |
| STRATIFIER_VERSION: int = 1 |
|
|
|
|
| |
|
|
| def cache_key( |
| *, |
| n_eval: dict[Task, int] | None = None, |
| n_train: dict[Task, int] | None = None, |
| seed: int | None = None, |
| stratifier_version: int | None = None, |
| ) -> str: |
| """Stable cache-directory name for the (budgets, seed, stratifier) tuple. |
| |
| Defaults to the module-level canonical values. Override any subset to |
| generate a non-canonical cache (e.g. a re-tune at N_eval=2000 produces |
| its own cache dir leaving the canonical cache intact). |
| """ |
| ne = n_eval or EVAL_N_PER_TASK |
| nt = n_train or TRAIN_N_PER_TASK |
| s = SEED if seed is None else seed |
| sv = STRATIFIER_VERSION if stratifier_version is None else stratifier_version |
|
|
| |
| |
| eval_str = "-".join(f"{t}={ne[t]}" for t in ("T1", "T2", "T3", "T4", "T5", "T6", "T7")) |
| train_str = "-".join(f"{t}={nt[t]}" for t in ("T1", "T2", "T3", "T4", "T5", "T6", "T7")) |
| return f"seed={s}_strat=v{sv}_eval[{eval_str}]_train[{train_str}]" |
|
|