Late interaction normalization produces nonfinite float16 embeddings
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- Mezza giornata
- Idoneità per principianti
- 70/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- numpy, python
- Ambito
- machine-learning
Direzione di ricerca
Start with _post_process_onnx_output in the Colbert and LateOn late-interaction postprocessors, which compute L2 norms in float16. Run the reproduction from the issue, which builds an OnnxOutputContext directly, and check that the output has infinities or NaNs. Read the shared normalization helper that the issue says already handles float16 safely, and reuse its approach in both postprocessors. Done when float16 output keeps its dtype, the norms come out near [1, 0, 1], and existing padding, punctuation and query tests still pass.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Colbert._post_process_onnx_output and LateOn._post_process_onnx_output compute L2 norms in float16 when an ONNX model returns float16 embeddings. Small finite embeddings underflow to a zero norm, producing infinities. Zero vectors produce NaNs because the 1e-12 denominator floor also becomes zero in float16. Larger finite values can overflow the norm and become zero vectors.
I reproduced this on main at de502ca8 with NumPy 2.5.3 on Linux. The shared normalization helper already handles float16 safely, but these two postprocessors use their own normalization.
This isolates postprocessing without loading model weights.
import numpy as np
from fastembed.common.onnx_model import OnnxOutputContext
from fastembed.late_interaction.colbert import Colbert
model = object.__new__(Colbert)
model._ensure_tokenizer = lambda: None
model.skip_list = set()
model.pad_token_id = 0
vectors = np.full((1, 3, 128), 1e-5, dtype=np.float16)
vectors[0, 1] = 0
vectors[0, 2] = 100
context = OnnxOutputContext(
model_output=vectors,
attention_mask=np.ones((1, 3), dtype=np.int64),
input_ids=np.array([[1, 2, 3]], dtype=np.int64),
)
result = next(iter(model._post_process_onnx_output(context)))
print(np.isfinite(result).all())
print(np.linalg.norm(result.astype(np.float32), axis=1))
The output contains infinities and NaNs, and the large vector has norm zero. Expected output is finite with norms near [1, 0, 1]. The same reproduction works with LateOn.
Float16 output should retain its dtype and be normalized using enough precision to avoid these errors. Existing padding, punctuation filtering and query behavior should be preserved.
- Lingua principale
- Python
- Stelle
- 3.3k
- Fork
- 296
- Merge medio
- 4g 3h
- PR unite (30g)
- 41
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di qdrant/fastembed
-
[Bug]: Model download sleeps after its final failed attemptForse già presa @elysiopires l’ha presa 8 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 35/100
I maintainer di solito rispondono entro 1 giorno
-
Weekly tests failedForse già presa @joein l’ha presa 11 giorni fa. Aperta
qdrant/fastembed#843 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug]: rerank_pairs raises TypeError when pairs are passed as a tuple of pairsForse già presa @michaelkillgta l’ha presa 28 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 22/100
I maintainer di solito rispondono entro 1 giorno
-
[Feature]: Support huggingface-hub 2.0Forse di nuovo libera @joein l’ha presa 38 giorni fa e non c’è nessuna pull request aperta. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 65/100
qdrant/fastembed#742 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
Silent all-NaN embeddings when a model file is incompatible with the runtime (0.8.0 still ships the fp16 jina-de model fixed by #623)Forse già presa @Shikhaar l’ha presa 72 giorni fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 58/100
qdrant/fastembed#688 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di qdrant/fastembed
Issue simili
-
Difficoltà 1/5 1-3 ore Idoneità per principianti 88/100
aws-samples/sample-per-model-bedrock#782 ·
I maintainer di solito rispondono entro 1 giorno
-
Google text documents are base64-encoded twiceForse già presa @feiiiiii5 l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
coveragepy/coveragepy#2364 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 72/100