Skip to content

[FEAT][kernels]: implement fused Gumbel-Softmax sampler for differentiable rollouts #45

Open

Description

@Flink-ddd

Description:

Context:

Standard autoregressive sampling like greedy or temperature sampling in vLLM breaks the computational graph, requiring REINFORCE-style gradient estimators like PPO. For future alignment algorithms that may rely on reparameterization gradients through discrete tokens, we need a high-performance, differentiable Gumbel-Softmax sampling operator.

Tasks:

  1. Implement a Triton kernel for the Gumbel-Softmax trick in rl_engine/kernels/ops/triton/sampling.py.
  2. The kernel should support hard=True returns one-hot vectors on forward, continuous gradients on backward and temperature annealing.
  3. Ensure it efficiently handles the [Batch, Sequence, Vocab_size] tensor shape without materializing excessive intermediate random noise arrays in global memory.

Activity

  1. added
    enhancement
    component: kernels
    on May 31, 2026
  2. JLiu4Coding commented on Jul 6, 2026

    @JLiu4Coding
    Contributor

    Hi Vensen, I am eagerly working on this. Can this be assigned to me?

  3. Flink-ddd commented on Jul 6, 2026

    @Flink-ddd
    CollaboratorAuthor

    for sure, assigned, Thank you.

  4. JLiu4Coding commented on Jul 10, 2026

    @JLiu4Coding
    Contributor

    Hi @Flink-ddd , I have created a draft PR #215 addressing this issue. The correctness has successfully passed and our triton implementation has outperformed the native pytorch implementation in terms of both speed and saving memory. Willing to further revise as needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

component: kernelsenhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions