Skip to content
Back to skills

Combined Kd Objective

ASecurity

Combine supervised, output distillation, and RAIL intermediate losses with validated RAIL-KD lambda weights.

  • 247 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 9, 2026
testingpythonbashgit

Security analysis

A100/100

Pro scans all 3 files and shows the line behind each finding

Scanned September 9, 2026

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

Installs into .claude/skills of the current project.

Are you the author of Combined Kd Objective?

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

Security grade badge for Combined Kd Objective
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vectorspacelab-combined-kd-objective/badge)](https://www.skillsdirectory.com/skills/vectorspacelab-combined-kd-objective)

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

Download with Pro
SKILL.md
---
name: combined_kd_objective
description: Combine supervised, output distillation, and RAIL intermediate losses with validated RAIL-KD lambda weights.
---

# Combined KD Objective

Use this skill when constructing a RAIL-KD training or proxy recovery objective. It preserves the paper's equation (4): the student minimizes a weighted sum of supervised task loss, output-logit knowledge distillation loss, and the randomized intermediate representation loss. Do not use this skill as a replacement for computing the RAIL representation loss itself.

## Inputs

- `ce_loss`: finite scalar for supervised cross-entropy/task loss.
- `kd_loss`: finite scalar for output prediction distillation.
- `rail_loss`: finite scalar from RAIL-KDl or RAIL-KDc.
- `lambdas`: three non-negative weights `(lambda1, lambda2, lambda3)` that sum to one.

## Outputs

- Total scalar objective.
- Weighted contribution dictionary for audit logs.
- Validation status or an exception for invalid inputs.

## Workflow

1. Validate that all loss components are finite numeric scalars.
2. Validate that all lambda weights are non-negative and sum to one within tolerance.
3. Compute the total weighted objective.
4. Return component contributions so recovery can report what the optimizer minimized.

## Validation

Run:

```bash
python scripts/kd_objective.py --ce 0.4 --kd 0.3 --rail 0.2 --lambdas 0.2 0.3 0.5
python -m pytest tests
```

## Limitations

This skill computes scalar composition only. Production training code still needs a differentiable implementation for framework tensors, but the same validation and contribution reporting should be preserved.

Files in this skill

  • SKILL.md1.6 KB
  • scripts/kd_objective.py2.2 KB
  • tests/test_kd_objective.py657 B

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…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.