Skip to content

Evaluate replacing anchor similarity with an LLM classification call #8

Description

@yav02

How issue scoring works today

src/mk_tracking/bigquery_issue_scoring.py embeds each post, takes the maximum cosine similarity across that issue's 8 hand-curated multilingual anchors, then applies a softmax at temperature 0.07 across all issues. Anchors live in db/issue_anchors.json.

The proposal

Replace that with a single gemini-flash-lite structured-output call per post, scoring the post against the issue list directly.

Measure before implementing

The original issue asserted that this "should improve performance and only slightly increase costs". Neither claim has been tested, and both are load-bearing. Before writing the replacement:

  1. Build a labelled sample of posts — a few hundred, covering all issues and both Hebrew and Arabic.
  2. Measure agreement between the current scorer and the proposed one against those labels.
  3. Measure cost per 1,000 posts and wall-clock latency for both, at the volumes the pipeline actually runs at.
  4. Consider what is lost: the current approach is deterministic and reproducible for a fixed model version. An LLM call is neither, which matters for a site making public claims about named politicians.

If the numbers do not favour the change, closing this issue with the measurements recorded is a perfectly good outcome.

Prior art in this repo

bill_issues/ already does exactly this shape — Gemini structured output scoring bills against the issue taxonomy. Its prompt and schema are a useful reference, and its cost profile is a rough guide.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestquestionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions