pub enum PoolingStrategy {
MeanVisualTokens,
LastToken,
}Expand description
How to collapse a prefill’s per-position hidden states into one fixed-size embedding vector.
Retrieval quality with the base Qwen3.5-0.8B instruct checkpoint is unvalidated. GME-style pooled embeddings normally come from a checkpoint that has been contrastively fine-tuned for retrieval (image-text matching, hard-negative mining); the base instruct checkpoint was never trained for that objective. What this module provides — and what is tested — is the extraction machinery: pooling over the verifiably correct positions, deterministically, into a unit-norm vector. Picking (or fine-tuning) a checkpoint for retrieval quality is a separate, later decision.
Variants§
MeanVisualTokens
Mean over the hidden states at the request’s <|image_pad|>
positions (the visual tokens). For a text-only request — no image
runs, so no pad tokens are present — this degrades to a mean over
every position, i.e. an ordinary mean-pooled text embedding rather
than an error.
LastToken
The hidden state at the last physical position — GME’s text-embedding convention. Well-defined for both image and text-only requests.
Trait Implementations§
Source§impl Clone for PoolingStrategy
impl Clone for PoolingStrategy
Source§fn clone(&self) -> PoolingStrategy
fn clone(&self) -> PoolingStrategy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for PoolingStrategy
Source§impl Debug for PoolingStrategy
impl Debug for PoolingStrategy
impl Eq for PoolingStrategy
Source§impl PartialEq for PoolingStrategy
impl PartialEq for PoolingStrategy
impl StructuralPartialEq for PoolingStrategy
Auto Trait Implementations§
impl Freeze for PoolingStrategy
impl RefUnwindSafe for PoolingStrategy
impl Send for PoolingStrategy
impl Sync for PoolingStrategy
impl Unpin for PoolingStrategy
impl UnsafeUnpin for PoolingStrategy
impl UnwindSafe for PoolingStrategy
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.