Standard way for reranker prompt templates?

#2
by Dhruv-Intercom - opened

I see sentence-transformers has a way of having simple prefix prompts. Like "query" -> "query: ", which gets prepended before tokenization. I was wondering if there is such a standard way that is more general? Qwen reranker seems to have little complex prompt requirements.

<|im_start|>system
Judge whether the Document meets the requirements based on the Query and the Instruct provided. Note that the answer can only be "yes" or "no".<|im_end|>
<|im_start|>user
 <Instruct>:   {instruct}

<Query>: {query}
 <Document>{document}<|im_end|>
<|im_start|>assistant
 <think>

</think>

Hello!

The big prompt is indeed very inconvenient/tricky. My hope is to update the CrossEncoder support in Sentence Transformers so that users 1) won't have to use the template manually and 2) users can use prompt and prompt_name to specify additional instructions, if the model use them. I'm not sure when I'll have time for that, as my focus right now is on Sparse embedding models.

  • Tom Aarsen
Dhruv-Intercom changed discussion status to closed

Sign up or log in to comment