Repository navigation
feat: add a two-headed token tagger for intent spans and slots - #15
Merged
Merged
Conversation
belambert
force-pushed
the
feat/encoder-tagger
branch
2 times, most recently
from
October 4, 2026 23:38
8e2f38d to
e009261
Compare
belambert
force-pushed
the
feat/encoder-tagger
branch
from
October 23, 2026 02:47
e009261 to
d08ce68
Compare
belambert
force-pushed
the
feat/encoder-tagger
branch
3 times, most recently
from
October 24, 2026 01:51
5354822 to
7ae23ba
Compare
belambert
force-pushed
the
feat/encoder-tagger
branch
from
October 24, 2026 01:53
7ae23ba to
e81ab6b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a non-generative baseline: a BERT-style sequence tagger with two classification heads on a shared backbone, one tagging intent spans and one tagging slots, each as BIO labels over subword tokens.
Intents never nest and slots sit inside intents, so two flat tag layers capture the whole annotation. Decoding puts each slot under the intent span that contains it and returns the same
Annotationthe generative formats produce, sometrics.scoregrades it identically.Changes
tagging.py: converts spans to BIO tags and back, using token offsets rather than a tokenizer, so it's testable without downloads.I-tag starts a new span.tagger.py: the model, training via HFTrainer, prediction, and save/load. The loss is the sum of both heads' cross-entropies, with--slot-weightto rebalance it.AutoModelbackbone works, decoders included. The default is ModernBERT-base.tag-trainandtag-predictcommands.tag-predictwrites the same JSONL aspredict, rendered throughxml, soscoreand--detailwork unchanged.scripts/compare-taggers.sh: trains and scores ModernBERT, BERT, RoBERTa and Qwen3.5-0.8B. Qwen sees left context only, which is what that comparison tests.tag-predictprints the average inference time per utterance after the scores, reusing the timing helpers from feat: report average inference time per utterance #16.Testing
uv run pytestpasses (73 tests), along with black, isort and mypy.To Do