Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Principle:FlagOpen FlagEmbedding Distributed Reranker Training

From Leeroopedia


Sources Domains
Paper: BGE Reranker, Paper: Layerwise Reranker NLP, Distributed_Training

Overview

A distributed training pipeline that fine-tunes BGE reranker models using cross-encoder contrastive learning with DeepSpeed, supporting encoder-only and decoder-only architectures.

Description

Reranker fine-tuning uses torchrun for multi-GPU training. Three modules are supported:

  • encoder-only base -- cross-encoder with classification head
  • decoder-only base -- LLM reranker with LoRA
  • decoder-only layerwise -- per-layer scoring heads

Reranker training processes (query, passage) pairs jointly, in contrast to embedder training which encodes them separately. Data collation concatenates query and passage with separator tokens.

Usage

When fine-tuning a BGE reranker on custom data.

Theoretical Basis

Cross-encoder loss: binary cross-entropy for encoder-only, language model loss on relevance token for decoder-only. Layerwise training adds classification heads at specified layers.

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment