File size: 1,837 Bytes
f7b6133
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
from __future__ import annotations
from dataclasses import dataclass, asdict


@dataclass(frozen=True)
class FrozenConfig:
    """Frozen MS-MARCO-developed configuration.

    The point of the six-dataset campaign is transfer, not per-dataset tuning.
    Only corpus-mechanical settings such as max_features/min_df should be changed
    when a dataset physically requires it.
    """

    # Sparse lexical representation
    max_features: int = 50_000
    min_df: int = 1
    lowercase: bool = True
    token_pattern: str = r"(?u)\b\w\w+\b"

    # Fuzzy index
    F: int = 4                   # fuzzy memberships/document
    B: int = 64                  # sparse center support
    S: int = 16                  # signed residual support/membership

    # Reliability
    tau: float = 20.0
    beta: float = -0.2
    reliability_eps: float = 1e-6

    # Corpus term geometry
    L: int = 12                  # top terms/document used to estimate graph
    graph_significance_tau: float = 10.0
    assoc_k: int = 64            # first-order PPMI neighbors retained
    route_k: int = 32            # second-order context neighbors retained
    graph_block_size: int = 128

    # Query routing
    route_alpha: float = 0.10
    route_budget: int = 32       # strongest total route coordinates; original terms preserved

    # Head / tail scoring
    head_k: int = 10
    gamma_head: float = 0.5
    gamma_tail: float = 1.0
    lambda_membership: float = 2.0

    # Final binary-support reranker
    rerank_pool: int = 2_000
    lambda_lex: float = 2.5
    length_b: float = 0.2
    semantic_k: int = 16
    lambda_sem: float = 0.05

    # Requested output depth
    output_k: int = 100

    def to_dict(self) -> dict:
        return asdict(self)

    @classmethod
    def from_dict(cls, d: dict) -> "FrozenConfig":
        return cls(**d)