v1.3.0 — Sentence-Pair Cross-Encoder
Sentence-Pair Cross-Encoder. A joint-encoding pair head (SentencePairClassifier,
num_classes for rerank/gate/NLI), pair collation, encoder segment support, and
special-token reservation. Additive and backward-compatible.
Added
SentencePairClassifier(polaris.models): a cross-encoder that joint-encodes
[CLS] a [SEP] b [SEP], pools ("cls"or"mean"), and scores with a linear
head —num_classes=1(ranking score),2(gate),3(NLI). Shares the trunk,
so it initializes from a pretrained MLM viatransfer_encoder_to.PairBatch/collate_pairs(polaris.collation): pack(text_a, text_b, label)
triples into[CLS] a [SEP] b [SEP]with segment ids and longest-first truncation.cls_token/sep_tokenonVocabulary(withcls_id/sep_id),
build_vocabulary, andtrain_bpe(which also gainsmask_token) — reserved
first and contiguously so adding a special never renumbers corpus tokens.- The
build_modelfactory now recognizes the"pair_classifier"model type.
Changed
TransformerEncoder.forwardgains an optionaltoken_type_idsargument; a
zero-initialized segment embedding is added only when it is given, so existing
single-segment call sites are byte-identical. Additive, backward-compatible.