Skip to content

Operator: schema_frequency_exceeds + candidate/stable schema rule-pack contract (frequency-tau denoising) #145

Description

@se-jo-ma

Context. MemGraphRAG's most portable, deterministic mechanism is Thematic Denoising via Unified Schema Filtering: a schema is promoted candidate→stable only once its extraction frequency ≥ τ, and only facts aligned to a stable schema activate. Ablation shows removing the schema filter degrades accuracy. Fathom already has the cross-fact counting shape (fathom_count_exceeds, fathom_last_n, fathom_distinct_count) but no relation-type support-count gate — so it can't yet serve as the deterministic, auditable denoising stage after an external extractor.

Proposal. Add a schema_frequency_exceeds temporal operator + a candidate_schema/stable_schema rule-pack contract.

  • fathom_schema_frequency_exceeds(template_name, slot_name, slot_value, threshold) — count facts of that type via tmpl.facts(), return count >= τ (near-identical to fathom_last_n).
  • Register operator key schema_frequency_exceeds in _TEMPORAL_OPS; add a _compile_temporal_condition branch mirroring count_exceeds.
  • Ship a pack with candidate_schema/stable_schema templates + a promotion rule; downstream rules pattern-match only stable_schema. τ is a per-rule literal arg (stays deterministic).

Where.

  • src/fathom/engine.py _register_external_functions :301 (add beside fathom_count_exceeds :334 / fathom_last_n :395-403).
  • src/fathom/compiler.py _TEMPORAL_OPS :930 + _compile_temporal_condition :1068 (mirror count_exceeds branch :1112-1122).
  • New pack under src/fathom/rule_packs/.

Acceptance criteria.

  • Operator declarable in rule YAML; count >= τ semantics.
  • Pack promotes a schema past τ; downstream rules match only stable_schema.
  • Deterministic (τ literal); existing operators unaffected.

Honest framing. The counter is functionally identical to fathom_last_n (count ≥ n) — the real new content is the candidate/stable pack contract, not the counting primitive.


Source: arXiv:2606.00610v1 — "MemGraphRAG: Memory-based Multi-Agent System for Graph Retrieval-Augmented Generation". Distilled from arXiv-research/2606.00610v1/analysis.md; file refs verified against current main by the analysis pass.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High priority: load-bearing gap or correctnessenhancementNew feature or requestrule-packRelated to OWASP/NIST/HIPAA/CMMC rule packssize/M<2 days: multi-file feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions