Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Hugging Face 8 min read Release mediumAdept

🤗 Kernels: Major Updates

Hugging Face's Kernels project, which packages and distributes custom GPU kernels via the Hub, now has a dedicated "kernel" repository type and several security layers on top of Nix-based reproducible builds. By default only kernels from trusted publishers load, with an explicit trust_remote_code opt-in for others, and Sigstore cosign signing with ephemeral keys tied to trusted GitHub workflows (verification is not yet enforced at load time). Other changes include separate kernels and kernel-builder CLIs designed to be easy for agents to drive, Torch Stable ABI and Apache TVM FFI support, and compatibility-checking APIs. A segfault-causing libstdc++ global-initialization conflict was fixed by switching from static linking to dynamic linking with the official manylinux_2_28 toolchain.

Assumes: PyTorch custom opsGPU kernelsPython packaging

Related posts

  • From Zero to GPU: A Guide to Building and Scaling Production-Ready CUDA Kernels

    Hugging Face mediumAdept

    Hugging Face's kernel-builder lets developers write a custom CUDA kernel, register it as a native PyTorch operator, build it reproducibly with Nix for every supported PyTorch/CUDA combination, and publish it to the Hub for loading via `get_kernel`. The worked example is an RGB-to-grayscale kernel using a 2D thread grid, bound through TORCH_LIBRARY so it works with torch.compile and the dispatcher's per-device backends. It covers the build.toml manifest, Nix dev shells per torch/CUDA variant, build2cmake, and uploading build artifacts with Git LFS. Production concerns follow, including versioning kernels so API changes don't break downstream users and packaging kernels as Python wheels.

  • Easily Build and Share ROCm Kernels with Hugging Face

    Hugging Face mediumAdept

    Hugging Face's kernels library and kernel-builder can package a custom ROCm kernel as a native PyTorch operator and share it on the Hub, shown with the prize-winning RadeonFlow FP8 block-wise GEMM kernel for AMD MI300X. The walkthrough covers the expected project layout, renaming HIP sources to .h/.hip, a build.toml manifest targeting gfx942, and a flake.nix for reproducible Nix builds. It also covers registering the launcher via TORCH_LIBRARY so it is exposed through torch.ops, plus a Python __init__.py wrapper. Builds run with `nix build` or a `nix develop` shell using build2cmake and CMake, and enabling the Hugging Face cachix cache avoids expensive rebuilds.

  • Learn the Hugging Face Kernel Hub in 5 Minutes

    Hugging Face mediumAdept

    Hugging Face's Kernel Hub and `kernels` library let PyTorch code download pre-compiled, optimized GPU kernels such as FlashAttention, activations, RMSNorm and quantization kernels with a single `get_kernel` call. The library matches the binary to the installed Python, PyTorch and CUDA versions, which avoids source builds that for FlashAttention can need about 96 GB of RAM and hours of compilation. The walkthrough checks a fast GELU kernel against PyTorch and swaps a Triton LlamaRMSNorm into a simple model with the `use_kernel_forward_from_hub` decorator. It then benchmarks the kernel against a plain PyTorch RMSNorm using CUDA events.

  • 4M Models Scanned: Protect AI + Hugging Face 6 Months In

    Hugging Face easyNovice

    Six months into the Hugging Face partnership, Protect AI's Guardian has scanned 4.47 million model versions across 1.41 million Hub repositories and flagged 352,000 unsafe or suspicious issues in 51,700 models. It serves 226 million requests a month at about 8 ms response time. Four new detection modules cover archive slip, Joblib code execution, TensorFlow SavedModel architectural backdoors and malicious llamafiles. Recurring attack themes are library-dependent call chains (e.g. torchvision.io file overwrites), payloads hidden through compression and nested archives, framework-extensibility exploits such as Keras CVE-2025-1550, and chained attack vectors, all handled under a zero-trust stance that treats any arbitrary code execution as suspicious.

  • Custom Kernels for All from Codex and Claude

    Hugging Face mediumAdept

    Hugging Face packaged CUDA kernel expertise (GPU architecture guides for H100/A100/T4, diffusers and transformers integration patterns, vectorized kernel templates, benchmark scripts) into an agent skill that lets Claude and Codex generate complete kernel-builder projects with PyTorch bindings. Agent-written RMSNorm kernels averaged 1.88x over PyTorch for LTX-Video and 1.94x for Qwen3-8B on H100 in BF16, with Qwen3 speedups growing from 1.58x at 128 tokens to 2.47x at 8192. End to end, LTX-Video gained only 6% (1.43x with torch.compile), consistent with RMSNorm taking about 5% of compute. The post also walks through building all PyTorch/CUDA variants with Nix and publishing to the Kernel Hub for one-line loading via get_kernel.

The quest for software engineering knowledge.

Look:
Layout: