Skip to content

feat: custom zero-shot taxonomies for the v2 detectors - #94

Merged
adaamko merged 1 commit into
mainfrom
feat/custom-taxonomies
Aug 13, 2026
Merged

adaamko merged 1 commit into
mainfrom
feat/custom-taxonomies

Conversation

@adaamko

@adaamko adaamko commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

What

Implements #92:

  • TaxonomyTyper gains categories/subcategories dict params; custom labels are embedded exactly like the trained ones (name: description text), so held-out labels type zero-shot from their description. Frozen dicts remain the default.
  • TransformerDetector(taxonomy_head=..., include_taxonomy=...) and the facade accept the same bool | list | dict semantics as LLMDetector, plus a nested {"categories": {...}, "subcategories": {...}} form for full control (flat dict = categories; without custom subcategories the native path collapses subcategory to unspecified).
  • The native generative path (lettucedect-v2-qwen-2b) builds its system prompt and JSON-schema enums from the custom labels when provided — the trained prompt structure is preserved since labels were always inline text. Marked experimental in code comments pending the holdout evaluation (tracked on Expose custom zero-shot taxonomies on the taxonomy head and the native generative detector #92).
  • Contract fix: zero_shot, fewshot_path, prompt_path now raise ValueError on native detectors instead of being silently ignored; message points at native=False.

15 new network-free tests (tests/test_custom_taxonomy_pytest.py) with stubbed clients/encoders; full suite 178 passed; ruff format + check clean under the CI invocation.

The held-out-label evaluation for both paths (acceptance item on #92) follows as a separate run; numbers get posted on the issue before any public zero-shot claim.

Closes #92

Checklist

  • python -m pytest tests/test_custom_taxonomy_pytest.py -v green; full suite green; ruff clean.

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

…nerative detector

TaxonomyTyper accepts custom {name: description} label sets (labels enter
only as text, matching training); TransformerDetector and the facade thread
them through include_taxonomy. The native generative path builds its prompt
and schema from custom labels when provided. zero_shot/fewshot_path/
prompt_path now raise on native detectors instead of being silently ignored.

Closes #92
@adaamko
adaamko merged commit 4e83c2a into main Aug 13, 2026
4 checks passed
@adaamko
adaamko deleted the feat/custom-taxonomies branch August 13, 2026 12:36
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.

Expose custom zero-shot taxonomies on the taxonomy head and the native generative detector

1 participant