Monolithic fused head-loss kernel for combinable losses + metrics
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 12/100
- Loại issue
- Tái cấu trúc
- Độ rõ ràng
- Cần làm rõ
- Mức độ hoạt động
- Ít trao đổi
- Công nghệ
- pytorch
- Lĩnh vực
- machine-learning, performance
Hướng nghiên cứu
The redundant softmax passes live in fused_grpo_loss_forward_backward, compute_policy_gradient_metrics, the fused_cross_entropy_base_from* helpers and fused_softmax_base, with the entropy chunking from PR #494. Start by reading those functions to map where sum_exp_logits and the tensor-parallel all-reduces are computed. The issue defers the design, so done needs an agreed design with the maintainers before any implementation.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Problem
Each language-model head loss/metric runs its own softmax pass over the full vocab. When losses are combined, the work is duplicated:
- cross-entropy + z-loss — both compute
sum_exp_logitsover the same logits. - cross-entropy + distillation — both compute the student softmax (and additionally the teacher softmax for distillation).
- GRPO + extra metrics (PR #494) —
fused_grpo_loss_forward_backwardcomputeslogits_norm,exp_logits,sum_exp_logits, andpredicted_logits;compute_policy_gradient_metricsthen recomputes all of them on the same logits. Withcompute_entropy_metric=True, a third softmax pass runs on top.
Each pass also issues its own tensor-parallel all-reduces on logits_max / sum_exp_logits, multiplying the comm cost.
@torch.compile does not fuse across separate decorated functions, so the redundant work is real both in compute and memory.
Proposed direction
A single "monolithic" head-loss kernel (torch.compile and/or triton) that:
- Takes a config / flag-set describing which losses and metrics to emit (CE, z-loss, distillation, GRPO clipped objective, GRPO ratio/KL/clamp/advantage stats, entropy, ...).
- Runs softmax (and TP all-reduce) once over the logits.
- Emits all requested scalars and the combined gradient in one pass.
This subsumes fused_grpo_loss_forward_backward, _fused_cross_entropy_base_from_*, fused_softmax_base, compute_policy_gradient_metrics, and the entropy chunking in PR #494.
Out of scope
- Implementation details (triton vs torch.compile, kernel layout) — left for the design phase.
- The current PRs that hit this redundancy (notably #494) are not blocked on this issue and should land with their existing structure; this is the longer-term consolidation.
Motivation
Surfaced during review of #494, but the underlying redundancy predates it.
- Ngôn ngữ chính
- Python
- Star
- 337
- Fork
- 52
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của ServiceNow/Fast-LLM
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
ServiceNow/Fast-LLM#556 ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 30/100
ServiceNow/Fast-LLM#538 ·
-
enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 12/100
ServiceNow/Fast-LLM#533 ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 15/100
ServiceNow/Fast-LLM#510 · 1 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
ServiceNow/Fast-LLM#500 ·
Tất cả issue của ServiceNow/Fast-LLM
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Claiming namespace `thejakia1`Đang mởnamespace operations
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 65/100
EclipseFdn/open-vsx.org#15057 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
FinanceFlash/unvibecode#349 ·
-
Mission statement: why this is free, in the README, Why This Exists and the wiki HomeCó thể đã có người làm @ChiefGyk3D đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
ChiefGyk3D/Clouds-Against-Humanity#348 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Perf] Default --vllm-watermark 0.05 for rollouts (hybrid models re-preempt under KV pressure)Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
vllm-project/vime#508 ·
Maintainer thường phản hồi trong vòng 4 ngày