home/roleplay/contrastive-learning-prompt

Contrastive Learning.prompt

GPTClaudeGemini··1,104 copies·updated 2026-07-14
contrastive-learning-prompt.prompt
# Contrastive Learning

## Overview

Contrastive learning is a representation learning technique that learns meaningful embeddings by contrasting positive pairs (similar examples) against negative pairs (dissimilar examples). In the context of LLMs, contrastive learning improves sentence embeddings, retrieval quality, and few-shot generalization. Methods like SimCLR, CLIP, and InfoNCE loss have become foundational for learning robust representations.

## Key Concepts

- **Positive/negative pairs**: Defining what constitutes similar vs dissimilar examples
- **InfoNCE loss**: The standard contrastive loss function for representation learning
- **Temperature scaling**: Controlling the sharpness of the similarity distribution
- **Hard negatives**: Mining challenging negative examples for better learning
- **Augmentation strategies**: Creating positive pairs through text transformations
- **Batch construction**: Building effective batches with diverse positive/negative pairs

## Implementation Patterns

when to use it

Community prompt sourced from the open-source GitHub repo Shuvam-Banerji-Seal/LLM-Whisperer (MIT). A "Contrastive Learning.prompt" style prompt — adapt the placeholders and specifics to your task. Imported as-is and not independently retested here, so check the output before relying on it.

tags

roleplaycommunitygeneral

source

Shuvam-Banerji-Seal/LLM-Whisperer · MIT