MoonshotAI / MoonshotAI/FlashKDA

Add a differentiable CPU backend for KDA research and prototyping

Open
#26 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Cuda
Stars
1.3k
Forks
122
PR merge metrics
No merged PRs in 30d

Description

Motivation

FlashKDA currently focuses on high-performance CUTLASS CUDA inference. Researchers who want to introduce KDA into conventional PyTorch models also need an accessible CPU path for architecture exploration, correctness validation, unit tests, and small-scale experiments.

A differentiable CPU implementation would make KDA easier to use as a reusable model component during research, including environments where Hopper-class GPUs or a CUDA toolchain are unavailable.

Proposed scope

  • Add a native PyTorch recurrent KDA reference implementation with autograd support.
  • Add an optional C++/ATen CPU recurrent operator with an analytical first-order backward.
  • Support arbitrary key/value dimensions, grouped value heads, variable-length sequences, FLA-style gates, and initial/final states.
  • Keep the existing CUTLASS path unchanged as the high-performance CUDA inference backend.
  • Allow CPU-only and compiler-free installation modes.

Intended use

This backend is primarily for research, model prototyping, model-architecture innovation, correctness checks, and small workloads. It is not intended to claim production-grade CPU throughput: the proposed C++ implementation composes ATen operations and is not yet a fused AVX/NEON kernel.

Higher-order gradients can use the pure PyTorch reference implementation. A native CUDA backward remains separate future work.

I have an implementation ready and will link the pull request to this issue.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the existing CUTLASS CUDA path and the proposed native PyTorch and C++/ATen CPU entry points described in the issue. The work is complete when the CPU backend supports autograd, variable-length sequences, grouped value heads, gates, initial/final states, and CPU-only or compiler-free installation modes while leaving the CUDA path unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp, pytorch
Domain
backend, machine-learning, performance
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.