microsoft/BitNet
Official inference framework for 1-bit LLMs
C++★ 40,991+97 that day#3 on trending
E19.9/100
Duplication5
40.3% in python, c-header, bash, cpp, perlDead code94
0.2%Complexity36
79.7% The score is jscpd's own --health model: markup, data and text left out, tests kept. The numbers below are the trending scan's.
41.42%duplicated code · 8,478 of 20,469 lines
249clones in code
48code files of 73 scanned
37.48%duplicated over all files · 256 clones
Most complex files
- utils/convert-ms-to-gguf-bitnet.py338 cx
- utils/convert.py333 cx
- preset_kernels/Llama3-8B-1.58-100B-tokens/bitnet-lut-kernels-tl2.h202 cx
- include/bitnet-lut-kernels.h160 cx
- preset_kernels/bitnet_b1_58-3B/bitnet-lut-kernels-tl2.h160 cx
- preset_kernels/bitnet_b1_58-large/bitnet-lut-kernels-tl2.h160 cx
- src/ggml-bitnet-mad.cpp155 cx
- utils/convert-bitnet-embedding-to-gguf.py93 cx
- utils/codegen_tl2.py84 cx
- preset_kernels/Llama3-8B-1.58-100B-tokens/bitnet-lut-kernels-tl1.h80 cx
Dead code 0.24% unused · 27 findings
- gpu/convert_checkpoint.py:jsonunused-import
- gpu/convert_checkpoint.py:reunused-import
- gpu/convert_checkpoint.py:sysunused-import
- gpu/convert_checkpoint.py:Pathunused-import
- gpu/convert_checkpoint.py:Optionalunused-import
- gpu/convert_checkpoint.py:dataclassunused-import
- gpu/convert_checkpoint.py:rearrangeunused-import
- gpu/convert_checkpoint.py:save_fileunused-import
- gpu/convert_safetensors.py:reunused-import
- gpu/convert_safetensors.py:Pathunused-import
The code number leaves out tests, fixtures, docs, examples, data files, styles, translations and vendored code.
Largest clones in the code
- 112 lines in 10 placesc-header1,939 tokensinclude/bitnet-lut-kernels.h:284–395include/bitnet-lut-kernels.h:528–639include/bitnet-lut-kernels.h:772–883preset_kernels/Llama3-8B-1.58-100B-tokens/bitnet-lut-kernels-tl2.h:282–393preset_kernels/Llama3-8B-1.58-100B-tokens/bitnet-lut-kernels-tl2.h:526–637and 5 more
284for (int i = 0; i < BM3200_8640; i += 32) { 285__m256i vec_as[KK / 2]; 286__m256i vec_signs[KK / 8]; 287#pragma unroll 288for (int ai = 0; ai < KK / 2; ai++) { 289 vec_as[ai] = _mm256_loadu_si256(reinterpret_cast<__m256i*>(a + i * KK / 2 + ai * 32)); 290} 291#pragma unroll 292for (int as = 0; as < KK / 8; as++) { 293 vec_signs[as] = _mm256_loadu_si256(reinterpret_cast<__m256i*>(sign + i * KK / 8 + as * 32));First 10 of 112 lines.
- 868 lines in 2 placesc-header12,635 tokensinclude/bitnet-lut-kernels.h:260–1127preset_kernels/bitnet_b1_58-3B/bitnet-lut-kernels-tl2.h:258–1125
260#endif 261 return 0; 262} 263static bool is_type_supported(enum ggml_type type) { 264 if (type == GGML_TYPE_Q4_0 || 265 type == GGML_TYPE_TL2) { 266 return true; 267 } else { 268 return false; 269 }First 10 of 868 lines.
- 271 lines in 3 placesc-header3,027 tokenspreset_kernels/Llama3-8B-1.58-100B-tokens/bitnet-lut-kernels-tl2.h:1–271preset_kernels/bitnet_b1_58-3B/bitnet-lut-kernels-tl2.h:1–271preset_kernels/bitnet_b1_58-large/bitnet-lut-kernels-tl2.h:1–271
1#if defined(GGML_BITNET_X86_TL2) 2#include "ggml-bitnet.h" 3#define GGML_BITNET_MAX_NODES 8192 4static bool initialized = false; 5static bitnet_tensor_extra * bitnet_tensor_extras = nullptr; 6static size_t bitnet_tensor_extras_index = 0; 7static void * aligned_malloc(size_t size) { 8#if defined(_WIN32) 9 return _aligned_malloc(size, 64); 10#elseFirst 10 of 271 lines.
7 more
- 896 lines in 2 placespython5,575 tokens
- 89 lines in 6 placesc-header1,065 tokenspreset_kernels/Llama3-8B-1.58-100B-tokens/bitnet-lut-kernels-tl1.h:333–421preset_kernels/Llama3-8B-1.58-100B-tokens/bitnet-lut-kernels-tl1.h:585–673preset_kernels/bitnet_b1_58-3B/bitnet-lut-kernels-tl1.h:199–287preset_kernels/bitnet_b1_58-3B/bitnet-lut-kernels-tl1.h:451–539preset_kernels/bitnet_b1_58-large/bitnet-lut-kernels-tl1.h:199–287and 1 more
- 41 lines in 10 placesc-header467 tokens
- 105 lines in 4 placesc-header1,325 tokens
- 184 lines in 3 placesc-header1,621 tokens
- 253 lines in 2 placespython1,565 tokens
- 86 lines in 2 placesc-header1,148 tokens
Largest clones over all files, tests and data included
- 112 lines in 10 placesc-header1,939 tokensinclude/bitnet-lut-kernels.h:284–395include/bitnet-lut-kernels.h:528–639include/bitnet-lut-kernels.h:772–883preset_kernels/Llama3-8B-1.58-100B-tokens/bitnet-lut-kernels-tl2.h:282–393preset_kernels/Llama3-8B-1.58-100B-tokens/bitnet-lut-kernels-tl2.h:526–637and 5 more
284for (int i = 0; i < BM3200_8640; i += 32) { 285__m256i vec_as[KK / 2]; 286__m256i vec_signs[KK / 8]; 287#pragma unroll 288for (int ai = 0; ai < KK / 2; ai++) { 289 vec_as[ai] = _mm256_loadu_si256(reinterpret_cast<__m256i*>(a + i * KK / 2 + ai * 32)); 290} 291#pragma unroll 292for (int as = 0; as < KK / 8; as++) { 293 vec_signs[as] = _mm256_loadu_si256(reinterpret_cast<__m256i*>(sign + i * KK / 8 + as * 32));First 10 of 112 lines.
- 868 lines in 2 placesc-header12,635 tokensinclude/bitnet-lut-kernels.h:260–1127preset_kernels/bitnet_b1_58-3B/bitnet-lut-kernels-tl2.h:258–1125
260#endif 261 return 0; 262} 263static bool is_type_supported(enum ggml_type type) { 264 if (type == GGML_TYPE_Q4_0 || 265 type == GGML_TYPE_TL2) { 266 return true; 267 } else { 268 return false; 269 }First 10 of 868 lines.
- 271 lines in 3 placesc-header3,027 tokenspreset_kernels/Llama3-8B-1.58-100B-tokens/bitnet-lut-kernels-tl2.h:1–271preset_kernels/bitnet_b1_58-3B/bitnet-lut-kernels-tl2.h:1–271preset_kernels/bitnet_b1_58-large/bitnet-lut-kernels-tl2.h:1–271
1#if defined(GGML_BITNET_X86_TL2) 2#include "ggml-bitnet.h" 3#define GGML_BITNET_MAX_NODES 8192 4static bool initialized = false; 5static bitnet_tensor_extra * bitnet_tensor_extras = nullptr; 6static size_t bitnet_tensor_extras_index = 0; 7static void * aligned_malloc(size_t size) { 8#if defined(_WIN32) 9 return _aligned_malloc(size, 64); 10#elseFirst 10 of 271 lines.
- 896 lines in 2 placespython5,575 tokens
- 89 lines in 6 placesc-header1,065 tokenspreset_kernels/Llama3-8B-1.58-100B-tokens/bitnet-lut-kernels-tl1.h:333–421preset_kernels/Llama3-8B-1.58-100B-tokens/bitnet-lut-kernels-tl1.h:585–673preset_kernels/bitnet_b1_58-3B/bitnet-lut-kernels-tl1.h:199–287preset_kernels/bitnet_b1_58-3B/bitnet-lut-kernels-tl1.h:451–539preset_kernels/bitnet_b1_58-large/bitnet-lut-kernels-tl1.h:199–287and 1 more
By format, code only
| Format | Files | Lines | Clones | Duplicated lines | Duplication |
|---|---|---|---|---|---|
| c-header | 10 | 7,153 | 142 | 5,374 | 75.13% |
| python | 24 | 10,482 | 68 | 2,635 | 25.14% |
| cpp | 2 | 1,248 | 39 | 469 | 37.58% |
| bash | 11 | 1,418 | 0 | 0 | 0% |
| perl | 1 | 168 | 0 | 0 | 0% |
By format, all files
| Format | Files | Lines | Clones | Duplicated lines | Duplication |
|---|---|---|---|---|---|
| c-header | 10 | 7,153 | 142 | 5,374 | 75.13% |
| python | 25 | 11,090 | 69 | 2,645 | 23.85% |
| cpp | 2 | 1,248 | 39 | 469 | 37.58% |
| markdown | 7 | 1,373 | 5 | 69 | 5.03% |
| ini | 7 | 154 | 1 | 20 | 12.99% |
| bash | 16 | 1,561 | 0 | 0 | 0% |
| perl | 1 | 168 | 0 | 0 | 0% |
| txt | 3 | 99 | 0 | 0 | 0% |
| text | 2 | 38 | 0 | 0 | 0% |
Trending appearances
| Day | Rank | Stars | Files | Lines | Clones | All files | Code | Health | Commit |
|---|---|---|---|---|---|---|---|---|---|
| Oct 13, 2026 | #3 | 40,991 (+97) | 73 | 22,884 | 256 | 37.48% | 41.42% | E 19.9 | 0b341e5 |
Want this for your own project? Install jscpd and run jscpd ., or measure it the way the baselines were measured.