File size: 3,423 Bytes
315cbe0
a969e99
 
 
 
315cbe0
a969e99
 
 
 
315cbe0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
266f01b
 
 
 
 
 
 
 
 
 
 
 
315cbe0
a969e99
 
 
 
 
 
315cbe0
 
 
 
 
 
 
 
 
 
266f01b
 
 
 
a969e99
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
from dataclasses import dataclass
from typing import Literal, Optional


ResolutionStrategy = Literal["exact", "normalized", "fuzzy", "no_match"]
EntityType = Literal["model", "benchmark", "metric", "harness", "org"]


@dataclass
class ResolutionResult:
    """Outcome of one `Resolver.resolve` call.

    Core matching fields (always populated):
      - `raw_value`, `entity_type`, `source_config`: echo of the inputs
      - `canonical_id`: the matched canonical (None on no_match). For
        models with a `root_model_id` set, this is the IDENTITY ROOT —
        i.e. the unquantized base — so callers reasoning about
        same-identity quantizations get one canonical instead of N.
      - `strategy`: which matcher fired (or "no_match")
      - `confidence`: 0.0–1.0

    Enrichment fields (populated when the `Resolver` is constructed
    with a `CanonicalStore`; otherwise None):
      - `review_status`: review state of the matched canonical
      - `parent_canonical_id`: family/variant parent (for models, the
        `variant` edge in `parents`; for benchmarks/orgs, the
        `parent_*_id` scalar column).
      - `resolved_leaf_id`: the originally-matched canonical before
        any root-collapse. Equals `canonical_id` when no quantized
        chain. Models only.
      - `root_model_id`: identity root via quantized-only walk. NULL
        when the matched leaf IS the root. Models only.
      - `lineage_origin_org_id`: deepest non-variant ancestor's
        org_id. Models only.
      - `parents`: full typed-edge list of the matched leaf. Models only.
      - `open_weights`: True/False/None. Models only.
      - `release_date`: YYYY-MM or YYYY-MM-DD. Models only.
      - `params_billions`: approximate parameter count. Models only.
      - `family_key`: canonical_families.id this benchmark belongs to.
        Defaults to the benchmark's own id for singleton families
        (when no curated multi-benchmark family covers it). Benchmarks
        only. See notes/hierarchy-alignment.md §3.
      - `composite_keys`: canonical_composites.id values where this
        benchmark appears (via the composite's source_configs ↔ EEE
        folders chain). Benchmarks only; empty list when none.
      - `category`: curated single-valued category from the family
        (general / agentic / reasoning / knowledge / multimodal /
        tool-use / math / security / factuality / reward-modelling /
        safety / code / instruction-following / other). Benchmarks
        only; None when no category curated.
    """
    raw_value: str
    entity_type: EntityType
    source_config: Optional[str]
    canonical_id: Optional[str]
    strategy: ResolutionStrategy
    confidence: float
    # Enrichment fields — None when no CanonicalStore is attached.
    review_status: Optional[str] = None
    parent_canonical_id: Optional[str] = None
    resolved_leaf_id: Optional[str] = None
    root_model_id: Optional[str] = None
    lineage_origin_org_id: Optional[str] = None
    parents: Optional[list[dict]] = None
    open_weights: Optional[bool] = None
    release_date: Optional[str] = None
    params_billions: Optional[float] = None
    # Benchmark-only enrichment (see notes/hierarchy-alignment.md §3).
    family_key: Optional[str] = None
    composite_keys: Optional[list[str]] = None
    category: Optional[str] = None


@dataclass
class ResolverConfig:
    threshold: float = 0.85