인터페이스는 현지화되어 있으며, Skill 소개와 설명 문서는 선택한 언어로 AI가 자동 번역합니다. 코드·명령어·경로·전문 용어는 원문을 유지하며 원작자 문서가 우선합니다.
Skills 둘러보기
생산성 및 협업 · SKILL.md

dual_contrastive_loss

dual_contrastive_loss

Compute and inspect a DCL-style contrastive proxy loss with same-latent positives and real-target anti-collapse negatives.

Independent GitHub snapshot · Automated classification · Original documentation governs

Skill 문서

GitHub

name: dual_contrastive_loss description: Compute and inspect a DCL-style contrastive proxy loss with same-latent positives and real-target anti-collapse negatives.

Dual Contrastive Loss

Use this skill when a recovery needs a deterministic feature-level version of the paper's DCL objective. It accepts a latent-paired batch and produces an InfoNCE-like scalar loss plus mechanism checks. Do not use it as a replacement for full StyleGAN training when full models are available.

Inputs

  • Batch from latent_pair_protocol.
  • Temperature scalar.
  • Optional real-target negative weight.

Outputs

  • Mean contrastive proxy loss.
  • Positive and negative similarity diagnostics.
  • Checks showing same-latent positives and real-target negatives were used.

Workflow

  1. Compute dot-product similarity divided by temperature.
  2. For each source feature, treat the same-latent target feature as the positive.
  3. Treat other generated target features and real-target exemplars as negatives.
  4. Average the negative log softmax probability assigned to the positive.

Validation

Run python tests/test_dual_contrastive_loss.py from this skill directory.

Limitations

The script uses small numeric vectors and standard-library math; it preserves objective structure but not neural feature extraction.

Refinement Note

A shuffled-positive stress check should produce higher loss than aligned same-latent positives; see cycle1_shuffled_stress.json in recovery logs.

저장한 Skills