File size: 4,690 Bytes
ce6548c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
"""Schema & shared constants for Tamarillo/groundedness-guard:
  0: hallucinated  — Response/claim is unsupported by or contradicts the provided context/evidence
  1: consistent    — Response/claim is factually grounded in and supported by the provided context/evidence

Matches Vectara HHEM-2.1-Open id2label semantics (`0: hallucinated`, `1: consistent`) using
standard `AutoModelForSequenceClassification` with ZERO `trust_remote_code=True`.
"""

from __future__ import annotations

LABELS: list[str] = ["hallucinated", "consistent"]
LABEL2ID: dict[str, int] = {"hallucinated": 0, "consistent": 1}
ID2LABEL: dict[int, str] = {0: "hallucinated", 1: "consistent"}
NUM_LABELS: int = 2

# 14 languages in s-nlp/PsiloQA (CC-BY-4.0)
PSILOQA_LANGS: list[str] = [
    "en", "ar", "ca", "cs", "de", "es", "eu", "fa", "fi", "fr", "hi", "it", "sv", "zh",
]

# Realistic neutral RAG distractor chunks for unconfounded multi-chunk long-context haystacks
DISTRACTOR_CHUNKS: list[str] = [
    "Chunk: Regional telemetry service operates across three availability zones in us-central1 with rolling deployments scheduled every Tuesday at 04:00 UTC. Automated health checks verify HTTP 200 status codes on /healthz every fifteen seconds before shifting ingress traffic.",
    "Chunk: Standard PostgreSQL connection pooling via PgBouncer in transaction mode limits idle backend processes while keeping p99 query latency under 12 milliseconds. Read replicas handle analytical reporting queries separately from the primary write cluster.",
    "Chunk: The municipal transit authority published its winter timetable covering bus routes 14 through 42. Express commuter lines operate at ten-minute intervals between 06:30 and 09:30 on weekdays, switching to twenty-minute headways during midday hours.",
    "Chunk: Quarterly inventory reconciliation audits warehouse stock counts across four distribution centers. Barcoded pallet scans are ingested into the ERP ledger nightly and flagged whenever physical counts diverge from recorded balances by more than two units.",
    "Chunk: In botany, deciduous broadleaf trees enter dormancy during autumn as photoperiod shortens and chlorophyll breaks down, revealing carotenoid and anthocyanin pigments before abscission layers form at the petiole base.",
    "Chunk: Modern container build pipelines separate dependency installation from application source layers to maximize registry layer caching. Multi-stage Dockerfiles strip compiler toolchains from final runtime images to reduce attack surface.",
    "Chunk: Acoustic oceanography instruments moored along continental shelves record ambient sound levels from shipping lanes, wind-driven wave breaking, and marine mammal vocalizations over twelve-month deployment cycles.",
    "Chunk: ISO 8601 standardizes calendar dates and timestamps in descending order from year to second, using UTC offset notation or a trailing Z designator to prevent ambiguity across distributed logging pipelines.",
]

# Asymmetric & factual-but-hallucinated anchor pairs (never overlapping eval suites!)
COUNTERFACTUAL_ANCHORS: list[tuple[str, str, int]] = [
    ("The capital of France is Berlin according to the fictional map provided.", "The capital of France is Paris.", 0),
    ("The capital of France is Berlin according to the fictional map provided.", "According to the provided map, the capital of France is Berlin.", 1),
    ("The shipment arrived in the United States on Tuesday.", "The shipment arrived in California on Tuesday.", 0),
    ("The shipment arrived in California on Tuesday.", "The shipment arrived in the United States on Tuesday.", 1),
    ("Quarterly revenue reached $4.2 million, up 8% year over year.", "Quarterly revenue reached $4.8 million, up 8% year over year.", 0),
    ("Quarterly revenue reached $4.2 million, up 8% year over year.", "Quarterly revenue grew 8% year over year to $4.2 million.", 1),
    ("Alice mentored Bob during his first year at the lab.", "Bob mentored Alice during her first year at the lab.", 0),
    ("Alice mentored Bob during his first year at the lab.", "Bob was mentored by Alice in his first year at the lab.", 1),
    ("The policy excludes flood damage and pre-existing structural defects.", "The policy covers flood damage automatically.", 0),
    ("The policy excludes flood damage and pre-existing structural defects.", "Flood damage is not covered under this policy.", 1),
    ("The API rate limit is 600 requests per minute per workspace key.", "Workspace keys can send up to 6,000 requests per minute.", 0),
    ("The API rate limit is 600 requests per minute per workspace key.", "Each workspace key is limited to 600 API requests per minute.", 1),
]