Skip to content

Fix repeated LLM span localization - #86

Merged
adaamko merged 2 commits into
KRLabsOrg:mainfrom
Sanjays2402:fix/repeated-llm-span-offsets
Aug 11, 2026
Merged

adaamko merged 2 commits into
KRLabsOrg:mainfrom
Sanjays2402:fix/repeated-llm-span-offsets

Conversation

@Sanjays2402

Copy link
Copy Markdown
Contributor

Summary

Map repeated LLM judge spans to the first unused, non-overlapping answer occurrence, reserving occurrences before confidence/verdict filtering. The judge prompt now requests left-to-right occurrence order.

Related issue

Closes #85.

Type of change

  • Bug fix
  • Feature
  • Documentation
  • Tests
  • Refactor or maintenance

Testing

  • ruff format --check lettucedetect/ lettucedetect_api/ tests/
  • ruff check lettucedetect/ lettucedetect_api/ tests/ --extend-exclude lettucedetect/integrations/
  • python -m pytest
  • Other: python -m pytest tests/test_llm_detector_pytest.py -q; targeted Ruff check and format check

Checklist

  • I kept the PR focused on one change.
  • I added or updated tests/docs when needed.
  • I checked that no secrets, API keys, or credentials are included.

Rights & sign-off (required)

  • I certify that I have the right to submit this code and that it may be
    distributed under the repository's MIT license
    (see CONTRIBUTING).

Sanjays2402 and others added 2 commits July 22, 2026 03:15
Reserve each verbatim answer occurrence before applying judge filters so repeated span strings keep distinct offsets and metadata. Add direct and token-level regressions for duplicate, filtered, overlapping, and excess items.
@adaamko
adaamko merged commit cd17e53 into KRLabsOrg:main Aug 11, 2026
4 checks passed
@adaamko adaamko mentioned this pull request Aug 11, 2026
5 tasks done
@kocaemre kocaemre mentioned this pull request Aug 11, 2026
10 of 13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Map repeated LLM span strings to distinct answer occurrences

2 participants