Skip to content
Back to skills

Clip Contrastive Loss

ASecurity

Compute CLIP-style normalized similarity logits and symmetric contrastive loss for image-text batches.

  • 247 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added September 9, 2026
ai-agentspythongogit

Works with

  • cli

Security analysis

A100/100

Scanned September 9, 2026

npx -y skills add VectorSpaceLab/AREX-Skill --skill clip_contrastive_loss --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Clip Contrastive Loss?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Clip Contrastive Loss
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vectorspacelab-clip-contrastive-loss/badge)](https://www.skillsdirectory.com/skills/vectorspacelab-clip-contrastive-loss)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

SKILL.md
---
name: clip_contrastive_loss
description: Compute CLIP-style normalized similarity logits and symmetric contrastive loss for image-text batches.
---

# CLIP Contrastive Loss

Use this skill when implementing or checking the CLIP training mechanism on paired image/text embeddings. It is appropriate for full, reduced, or synthetic recovery if the result is clearly labeled.

## Inputs
- Equal-length image and text embedding batches.
- A positive logit scale, corresponding to inverse temperature.

## Outputs
- Scaled cosine-similarity logits.
- Image-to-text and text-to-image cross entropy.
- Average symmetric loss and top-1 retrieval accuracy.

## Workflow
1. Normalize each image and text feature vector.
2. Compute all pairwise dot products and multiply by the logit scale.
3. Use diagonal indices as positives for both image-to-text and text-to-image directions.
4. Average the two cross-entropy losses and report retrieval accuracy.

## Validation
Run `python tests/test_contrastive_loss.py` or the generated skill tree validator.

## Limitations
This skill operates on supplied embeddings. It does not implement the visual or text transformer encoders.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…