{"id":50810564,"url":"https://github.com/cloudflareresearch/unweight-kernels","last_synced_at":"2026-06-13T04:07:31.175Z","repository":{"id":358270904,"uuid":"1211628924","full_name":"cloudflareresearch/unweight-kernels","owner":"cloudflareresearch","description":"Lossless compression of BF16 MLP weights for LLM inference on NVIDIA Hopper GPUs ","archived":false,"fork":false,"pushed_at":"2026-04-17T11:22:27.000Z","size":33,"stargazers_count":48,"open_issues_count":0,"forks_count":2,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-16T16:25:25.208Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://research.cloudflare.com/nikulin2026","language":"Cuda","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cloudflareresearch.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-15T15:28:24.000Z","updated_at":"2026-05-02T18:26:22.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/cloudflareresearch/unweight-kernels","commit_stats":null,"previous_names":["cloudflareresearch/unweight-kernels"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/cloudflareresearch/unweight-kernels","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudflareresearch%2Funweight-kernels","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudflareresearch%2Funweight-kernels/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudflareresearch%2Funweight-kernels/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudflareresearch%2Funweight-kernels/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cloudflareresearch","download_url":"https://codeload.github.com/cloudflareresearch/unweight-kernels/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudflareresearch%2Funweight-kernels/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34271563,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-13T02:00:06.617Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-06-13T04:07:29.765Z","updated_at":"2026-06-13T04:07:31.166Z","avatar_url":"https://github.com/cloudflareresearch.png","language":"Cuda","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Unweight Kernels\n\nCUDA kernel source for **Unweight** — lossless compression of BF16 MLP weights for LLM inference on NVIDIA Hopper GPUs (H100, H200).\n\nThis repository contains the encoding, decoding, transcoding, and reconstructive matmul kernels described in the technical report.\n\n**Technical report:** https://research.cloudflare.com/nikulin2026\n\n## Overview\n\nBF16 exponent fields in trained LLM weights carry ~2.6 bits of Shannon entropy in their 8-bit allocation, while sign and mantissa fields are near-incompressible. Unweight separates each BF16 value into sign+mantissa and exponent bytes, Huffman-codes the exponents over a per-tensor 16-value palette, and handles rare exponents through verbatim rows rather than inline escape symbols.\n\nThe central inference primitive is a **reconstructive matrix multiplication** — a persistent [ThunderKittens](https://github.com/HazyResearch/ThunderKittens) LCF kernel that reconstructs BF16 tiles in shared memory immediately before Hopper WGMMA consumption, eliminating a full HBM round-trip for the weight matrix.\n\nFour execution pipelines — full decode + cuBLAS, exponent decode + reconstructive matmul, palette transcode + reconstructive matmul, and direct palette + reconstructive matmul — are selected per projection and batch-size bucket via coordinate-descent autotuning on end-to-end throughput. A hard/easy layer alternation schedule extends preprocess-compute overlap across layers with different encoding profiles.\n\nOn Llama 3.1 8B, Unweight achieves ~30% compression on MLP weights (~20% total model size reduction) with lossless numerical equivalence.\n\n## Requirements\n\n- NVIDIA Hopper GPU (SM 9.0a) — H100 or H200\n- CUDA Toolkit 12.4+\n- C++20 capable `nvcc`\n\n## Building\n\n```bash\ngit submodule update --init --recursive\nmake        # → build/libunweight.a\n```\n\n## License\n\nBSD 3-Clause — see [LICENSE](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudflareresearch%2Funweight-kernels","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcloudflareresearch%2Funweight-kernels","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudflareresearch%2Funweight-kernels/lists"}