# Bi-encoder and cross-encoder

**URL:** <https://community.pinecone.io/t/bi-encoder-and-cross-encoder/209>\
**Category:** General\
**Tags:** semantic-search, sentence-transformer\
**Created:** [February 8, 2022, 8:50am UTC](https://community.pinecone.io/t/bi-encoder-and-cross-encoder/209 "2022-02-08T08:50:23Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Laura](https://avatars.discourse-cdn.com/v4/letter/l/a4c791/32.png) [@Laura](https://community.pinecone.io/u/Laura)\
**Post date:** [February 8, 2022, 8:50am UTC](https://community.pinecone.io/t/bi-encoder-and-cross-encoder/209/1 "2022-02-08T08:50:23Z")

</div>

I’m currently working on a project to identify most similar sentences in a document to a specified query sentence. I’m using a pre-trained SBERT bi-encoder model for this but have just started looking at using a cross-encoder model to refine a shortlist of results. Would it actually be better for me to fine tune the bi-encoder model rather than use cross-encoder?

---

<div class="post-metadata">

**Author:** ![jamesbriggs](https://sea2.discourse-cdn.com/flex020/user_avatar/community.pinecone.io/jamesbriggs/32/52_2.png) [@jamesbriggs](https://community.pinecone.io/u/jamesbriggs)\
**Post date:** [February 8, 2022, 2:13pm UTC](https://community.pinecone.io/t/bi-encoder-and-cross-encoder/209/2 "2022-02-08T14:13:59Z")

</div>

Hi Laura, it depends on your use-case.

Cross-encoder models don’t produce sentence embeddings and so performing search or clustering can be much slower as you must perform a full cross-encoder inference for comparing every single pair. However, they are more accurate and require less data to fine-tune.

Bi-encoder models do produce sentence embeddings, so we perform a single inference for each vector and then store the vectors to be compared later, so then all we need to calculate at comparison time is a metric like cosine similarity.
