CoolFace
Datasetpublic

agentlans/doc-context-contrastive-triplets

Document Context Contrastive Triplets This dataset provides training and validation examples designed for contrastive learning and representation tasks, specifically focusing on distinguishing contextually related text spans from unrelated spans. Dataset Structure Each example in the dataset contains the following fields: Field Type Description anchor string Random text span sampled from a source document. positive string Random text span sampled… See the full description on the dataset page: https://huggingface.co/datasets/agentlans/doc-context-contrastive-triplets.

sourceHugging Facecc-by-4.0updated 1mo agoView on Hugging Face
0likes68downloads
Dataset Card

Document Context Contrastive Triplets

This dataset provides training and validation examples designed for contrastive learning and representation tasks, specifically focusing on distinguishing contextually related text spans from unrelated spans.

Dataset Structure

Each example in the dataset contains the following fields:

FieldTypeDescription
anchorstringRandom text span sampled from a source document.
positivestringRandom text span sampled from the same document as the anchor.
negativestringRandom text span sampled from a different document.
lengthintNumber of tokens used for the sampled spans (16, 32, 64, 128, 256, or 512).

Example Record

json
{
  "anchor": "ting retellings that combine biblical inspiration with science fiction elements...",
  "positive": "concepts? By doing so, they challenge us to think more profoundly about faith...",
  "negative": "History Happens in my classroom, then I copied the lyrics and the students...",
  "length": 64
}

Dataset Splits

SplitNumber of Examples
train100 000
validation20 100

Sampling & Tokenization Strategy

  • Sampling: For each example, a span length $n$ is uniformly selected from {16, 32, 64, 128, 256, 512}. Anchor and positive spans are drawn from the same source document, while the negative span is drawn independently from a different document.
  • Tokenization: Spans are measured using token counts produced by `FacebookAI/xlm-roberta-base`. Because subword tokenization is used, exact character and word lengths will vary across samples even for the same nominal length value.
  • Filtering: Negative examples are included only if its token-level Jaccard similarity with the anchor is below 0.2.

Intended Use

Potential applications include:

  • Contrastive representation learning and text embedding training
  • Document and passage retrieval tasks
  • Same-document vs. different-document discrimination
  • Hard-negative and negative-pair model evaluation
  • Document-level representation benchmarks

Limitations

  • Document-Level Membership: The positive relationship is defined by shared document membership rather than explicit semantic similarity or human annotation. Consequently, an anchor and positive span may discuss different topics or subplots within the same document.
  • Negative Overlap: Negative spans are sampled from different documents and are therefore not strictly guaranteed to be semantically unrelated to the anchor.
  • Source Constraints & Bias:
  • Long documents within the dataset are almost exclusively sourced from Project Gutenberg.
  • The data lacks specialist material. Academic literature (such as arXiv and PubMed papers) is not included.
  • This dataset should be interpreted and utilized primarily as a same-document / different-document contrastive dataset rather than a fine-grained semantic similarity benchmark.

Source Datasets

Derived from:

Please refer to the original source repositories for detailed information regarding underlying sources, licensing, and intended use.

Citation

If you use this dataset in your work, please cite this repository along with the underlying source datasets.