pub enum NegativeStrategy {
WrongPublicationDate,
WrongArticle,
QuestionAnswerMismatch,
}Expand description
Strategy for picking the negative record in a triplet.
Each variant defines the candidate pool from which the negative record is drawn. By default all variants scope candidates to the same source as the anchor, so negatives are hard relative to the source domain rather than trivially cross-domain. A same-split fallback engages automatically when the in-source pool is too small (for example a source with only one record in the split).
When the bm25-mining feature is enabled, BM25 lexical re-ranking is applied
on top of the strategy-filtered pool — BM25 re-orders candidates by keyword
overlap with the anchor, but does not widen or replace the strategy pool.
BM25 is a first-pass lexical ranker, not a semantic one; it is well-suited for
lifting average negative quality without an encoder at data-generation time.
Semantic or embedding-based re-ranking (iterative hard-negative mining with the
trained encoder, cross-encoder scoring, dense retrieval) is out of scope for
the data pipeline and can be integrated by pre-ranking negatives before
ingestion or by reweighting source batches in the training loop.
Variants§
WrongPublicationDate
Choose a record with a different publication date from record metadata.
This refers to metadata/taxonomy publication-date values (for example
META_FIELD_DATE), not filesystem timestamps like mtime/ctime/atime.
WrongArticle
Choose a different record from the same source.
Negatives are drawn from within the same source, making them hard relative to the source domain. This is appropriate when each source represents a coherent domain (a collection of finance articles, a physics paper set, etc.) where same-source records are already confusable. If your sources are not meaningful domain boundaries, the fallback path (same split, any source) is the relevant escape hatch.
QuestionAnswerMismatch
Choose a mismatched Q/A pair.
Trait Implementations§
Source§impl Clone for NegativeStrategy
impl Clone for NegativeStrategy
Source§fn clone(&self) -> NegativeStrategy
fn clone(&self) -> NegativeStrategy
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for NegativeStrategy
impl RefUnwindSafe for NegativeStrategy
impl Send for NegativeStrategy
impl Sync for NegativeStrategy
impl Unpin for NegativeStrategy
impl UnsafeUnpin for NegativeStrategy
impl UnwindSafe for NegativeStrategy
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more