Course contentsShow
← Machine Learning and Deep Learning
Lesson 1332 of 3,53829. Core NLP TasksFree lesson

Asymmetric Search Tasks

Handle cases where queries and documents differ in length or style by training asymmetric dual encoders.

Asymmetric Search Tasks

What you'll learn: How to handle search scenarios where queries and documents have fundamentally different lengths or styles using specialized dual encoder training.


The Core Problem

In many real-world search applications, your query and your documents look nothing alike. A user might type a short question like "best budget laptop" while the document is a 500-word product review. Or imagine searching code documentation: your query is "how to sort a list" but the document contains full API specifications with examples.

Standard bi-encoders (which we learned earlier) treat queries and documents identically—they use the same encoder for both. This works well when both sides are similar in nature, but it's suboptimal for asymmetric tasks where they differ dramatically in length, style, or information density.

Training Asymmetric Dual Encoders

The solution is to train separate encoders optimized for their specific roles:

  • Query encoder: Learns to embed short, informal, question-like text
  • Document encoder: Learns to embed longer, structured, information-rich content

During training with contrastive learning (which you've seen), the model learns to map these different text types into a shared embedding space where semantically related query-document pairs end up close together—despite their stylistic differences.

Think of it like having a translator who specializes in converting casual questions into academic paper language, ensuring they can still find each other.

When to Use Asymmetric Search

Use asymmetric dual encoders when:

  • Queries are much shorter than documents (FAQ search, product search)
  • Queries are questions and documents are answers
  • Queries use informal language while documents are formal

Key Takeaway: Asymmetric search tasks require training separate query and document encoders to handle fundamental differences in length and style, creating embeddings that bridge the gap between short queries and long documents.