Hi NVIDIA Developer Community,
This is not a bug report. I am looking for technical feedback on an experimental long-context LLM inference optimization I am working on, called SHBF.
At a high level, SHBF is a sparse attention path that uses a Hamming-style coarse retrieval stage over compact Q/K binary signatures, followed by exact reranking and sparse attention over a bounded candidate set.
The goal is to reduce quadratic attention/memory pressure in long-context inference while preserving quality.
Some current prototype observations:
- In one Qwen-based long-context test, native attention at 8192 tokens used about 10.9 GB, while the SHBF path used about 5.6 GB.
- At 16384 tokens, the native path reached OOM, while SHBF still ran at about 8.1 GB.
- In the best validated path, quality degradation was small, around ~1% PPL delta in some long-context tests.
- A recent SHBF v10 candidate showed about ~86–88% estimated attention-side memory saving in a limited validation harness, not total model VRAM reduction.
- Runtime latency is still the main open problem. The current prototype is slower than optimized dense attention because candidate selection, reranking, sparse attention, and Python/PyTorch overhead are not yet implemented as optimized GPU kernels.
The approach is not designed to be specific to Qwen. In principle, it targets the attention mechanism itself and should be applicable to decoder-only Transformer LLMs that expose standard Q/K/V attention tensors. I have been using Qwen models mainly as convenient validation targets, not because the method depends on Qwen-specific weights.
I am trying to understand the best NVIDIA implementation path for this kind of candidate-selection + sparse-attention workload.
My main questions are:
-
Would this kind of popcount/Hamming + top-k candidate selector be better implemented as a custom CUDA kernel, TensorRT plugin, Triton kernel, CUTLASS-style component, or another NVIDIA stack component?
-
Are there known pitfalls with sparse candidate gathering, reranking, and sparse attention on NVIDIA GPUs?
-
What would be the fairest benchmark methodology against dense attention, sliding-window attention, FlashAttention-style dense baselines, or existing sparse-attention approaches?
Environment
Current experiments are prototype-level.
GPU Type: Tesla T4 for Colab validation
CUDA Version: 12.8 in recent Colab run
PyTorch Version: 2.11.0+cu128 in recent Colab run
Models tested: Qwen2.5-0.5B and reduced tests with Qwen2.5-1.5B-Instruct
TensorRT Version: N/A
TensorFlow Version: N/A
Any guidance on the right NVIDIA stack, benchmark design, or relevant examples would be appreciated.
Thanks,
João Vitor