executing-plans
executing-plans
Use when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available
pairwise_similarity_preservationCompute DDPM-PA pairwise cosine-softmax distributions and adapted-to-source KL preservation loss.
Independent GitHub snapshot · Automated classification · Original documentation governs
Use this skill when implementing the DDPM-PA relative-distance preservation term. It compares the geometry of source and adapted generated samples by converting pairwise cosine similarities into per-anchor probability distributions and minimizing KL divergence.
Do not use this skill to compare images to target training images directly. It preserves relative geometry between source and adapted predictions, while target-detail matching belongs to the high-frequency module.
KL(p_adapted || p_source).Run:
python scripts/pairwise_loss.py --smoke
python -m pytest tests
The tests check zero loss for identical geometry, positive loss for changed geometry, and no self-index in neighbor lists.
The included implementation is deterministic and standard-library only. For tensor frameworks, keep the same anchor-wise exclusion and KL direction; changing either changes the paper mechanism.