Skip to content
DeepForgeby svx
All problems
EasyNLPnlp-144

Cross-Encoder Pair Input

Problem

Build the input token sequence for a cross-encoder: [CLS] followed by the query tokens, then [SEP], then the passage tokens, then a final [SEP].

Empty segments still contribute their separator tokens.

Hint

List concatenation keeps the order of segments and separators.

Test cases

case 1
in: [["what","is"],["this"]]
expected: ["[CLS]","what","is","[SEP]","this","[SEP]"]
case 2
in: [[],[]]
expected: ["[CLS]","[SEP]","[SEP]"]
case 3
in: [["q"],["p"]]
expected: ["[CLS]","q","[SEP]","p","[SEP]"]
Starter codePython
def cross_encoder_pair_input(query_tokens, passage_tokens):
    # Your code here
    pass

3 test cases · run your code against them in the editor