协作头脑风暴
brainstorming
在实现前澄清需求、探索设计选择,并形成清晰的开发方向。
cic_contrastive_loss【开发与工程】Compute CIC normalized skill-transition contrastive loss, logits, margins, and tiny dependency-free training updates.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Use this skill when implementing the CIC representation-learning objective from paired transition tuples and continuous skills. It owns the normalized query/key logits, diagonal-positive labels, cross-entropy loss, and reduced optimizer update diagnostics.
tau: transition tuple matrix [batch, transition_dim].skills: continuous skill matrix [batch, skill_dim].query_weights: linear weights mapping skills to embedding space.key_weights: linear weights mapping transitions to embedding space.temperature: positive scalar.loss: diagonal-positive cross entropy.logits: normalized query-key similarity matrix divided by temperature.positive_logit_margin: mean diagonal logit minus mean off-diagonal logit.training_trace when running the reduced update helper.query @ key.T / temperature.Run:
python scripts/cic_loss.py --demo
python tests/test_cic_loss.py
The script is dependency-free and designed for tiny reduced recovery, not efficient full-scale RL training. A production implementation should use an autodiff framework such as PyTorch.