MCPcopy Create free account

hub / github.com/DevTechJr/turboquant_cutile / functions

Functions74 in github.com/DevTechJr/turboquant_cutile

↓ 29 callersMethodcompress_keys_pytorch
K: (seq_k, head_dim) -> compressed dict.
turboquant_cutile/host.py:61
↓ 15 callersMethodcompress_values_pytorch
V: (seq_v, head_dim) -> compressed dict (MSE only, no QJL).
turboquant_cutile/host.py:92
↓ 11 callersMethodattention_scores_pytorch
Asymmetric estimator: term1 (MSE dot) + term2 (QJL correction).
turboquant_cutile/host.py:117
↓ 8 callersMethoddecompress_values_pytorch
(self, compressed_v: dict)
turboquant_cutile/host.py:110
↓ 7 callersMethodfused_attention_pytorch
Full pipeline: scores -> softmax -> weighted V sum.
turboquant_cutile/host.py:136
↓ 6 callersFunction_make_random_keys
(seq_k: int, head_dim: int = 128)
tests/test_compress.py:21
↓ 5 callersMethod_cdiv
(self, a: int, b: int)
turboquant_cutile/host.py:148
↓ 3 callersFunction_standard_attention
(Q, K, V, head_dim)
tests/test_end_to_end.py:13
↓ 2 callersMethodcompressed_size_bytes
(self, seq_len: int)
turboquant_cutile/host.py:362
↓ 2 callersMethoddequantize
(self, indices: torch.Tensor)
turboquant_cutile/codebook.py:74
↓ 2 callersMethodquantize
(self, x: torch.Tensor)
turboquant_cutile/codebook.py:70
↓ 1 callersMethod_dequant_keys_from_indices
indices -> centroids -> un-rotate -> rescale.
turboquant_cutile/host.py:197
↓ 1 callersFunction_gaussian_pdf
(x: float, sigma: float)
turboquant_cutile/codebook.py:14
↓ 1 callersFunction_generate_qjl_matrix
Random Gaussian projection matrix for QJL.
turboquant_cutile/host.py:27
↓ 1 callersFunction_generate_rotation_matrix
Haar-distributed random orthogonal matrix via QR of Gaussian.
turboquant_cutile/host.py:16
↓ 1 callersMethodlaunch_decompress_values
(self, compressed_v: dict)
turboquant_cutile/host.py:249
↓ 1 callersFunctionsolve_lloyd_max
Returns (centroids, boundaries) as sorted float32 tensors. centroids: (2^bits,) boundaries: (2^bits - 1,)
turboquant_cutile/codebook.py:20
Method__init__
(self, d: int, bits: int)
turboquant_cutile/codebook.py:64
Method__init__
( self, head_dim: int = HEAD_DIM, total_bits: int = DEFAULT_TOTAL_BITS, seed:
turboquant_cutile/host.py:37
Method__repr__
(self)
turboquant_cutile/codebook.py:77
Methodlaunch_attention_scores
( self, Q: torch.Tensor, compressed_k: dict, use_swizzle: bool = False )
turboquant_cutile/host.py:281
Methodlaunch_compress_keys
(self, K: torch.Tensor)
turboquant_cutile/host.py:152
Methodlaunch_compress_values
(self, V: torch.Tensor)
turboquant_cutile/host.py:207
Methodlaunch_fused_attention
( self, Q: torch.Tensor, compressed_k: dict, compressed_v: dict, use_s
turboquant_cutile/host.py:306
Functiontest_bits_sweep_scores_reasonable
Higher bits should produce lower MSE in scores.
tests/test_attention.py:140
Functiontest_boundaries_between_centroids
(bits)
tests/test_codebook.py:50
Functiontest_compress_keys_shapes
(seq_k, total_bits)
tests/test_compress.py:28
Functiontest_compress_matches_reference
Compare our engine against the original cutiledump compressors.py implementation.
tests/test_compress.py:88
Functiontest_compress_values_shapes
()
tests/test_compress.py:70
Functiontest_compression_ratios
()
tests/test_end_to_end.py:110
Functiontest_correct_num_levels
(d, bits)
tests/test_codebook.py:24
Functiontest_correlation_with_true_scores
Estimated scores should correlate well with true Q·K^T scores.
tests/test_attention.py:61
Functiontest_decompress_shape
(seq_v, total_bits)
tests/test_decompress.py:15
Functiontest_deterministic_with_same_seed
()
tests/test_end_to_end.py:126
Functiontest_different_head_dims
(head_dim)
tests/test_end_to_end.py:154
Functiontest_different_seeds_different_results
()
tests/test_end_to_end.py:140
Functiontest_distortion_within_paper_bound
MSE distortion per vector <= sqrt(3) * pi/2 * (1/4^b) for unit vectors.
tests/test_codebook.py:57
Functiontest_edge_case_large_values
()
tests/test_compress.py:129
Functiontest_edge_case_zero_vector
()
tests/test_compress.py:121
Functiontest_full_pipeline_output_shape
(seq_q, seq_k, total_bits)
tests/test_end_to_end.py:22
Functiontest_higher_bits_lower_mse
More bits → strictly lower reconstruction MSE.
tests/test_decompress.py:63
Functiontest_indices_in_valid_range
(total_bits)
tests/test_compress.py:41
Functiontest_k_mse_reconstruction_quality
k_mse should be a reasonable approximation of K.
tests/test_compress.py:107
Functiontest_mse_within_bound
Per-vector MSE should be bounded by paper's theoretical upper bound.
tests/test_decompress.py:44
Functiontest_needle_in_haystack
Can we still find the most-attended key after compression?
tests/test_attention.py:115
Functiontest_needle_retrieval_through_full_pipeline
()
tests/test_end_to_end.py:64
Functiontest_norms_positive
()
tests/test_compress.py:61
Functiontest_norms_preserved
Vector norms should be approximately preserved after round-trip.
tests/test_decompress.py:78
Functiontest_output_cosine_similarity
(total_bits)
tests/test_end_to_end.py:38
Functiontest_quantize_nearest_centroid
Values close to a centroid should map to that centroid's index.
tests/test_codebook.py:86
Functiontest_reconstruction_quality
Cosine similarity between original and reconstructed should be high.
tests/test_decompress.py:26
Functiontest_roundtrip_identity
Quantize → dequantize should map each centroid exactly to itself.
tests/test_codebook.py:78
Functiontest_scaling_correct
Scores should be scaled by 1/√d.
tests/test_attention.py:84
Functiontest_scores_shape
(seq_q, seq_k, total_bits)
tests/test_attention.py:23
Functiontest_signs_are_pm1
()
tests/test_compress.py:52
Functiontest_single_decode_token
Typical decode scenario: seq_q=1, seq_k=large.
tests/test_attention.py:101
Functiontest_softmax_distribution_preserved
()
tests/test_end_to_end.py:88
Functiontest_sorted
(bits)
tests/test_codebook.py:41
Functiontest_symmetry
(d, bits)
tests/test_codebook.py:33
Functiontest_unbiasedness
The asymmetric estimator should be unbiased: E[estimated_ip] ≈ true_ip. We test by averaging over many random pairs.
tests/test_attention.py:35
Functiontest_value_indices_in_valid_range
()
tests/test_compress.py:79
Functiontest_vfused_cosine_vs_fp16
(total_bits)
tests/test_end_to_end.py:192
Functiontest_vfused_matches_pytorch_reference
(seq_q, seq_k, total_bits)
tests/test_end_to_end.py:173
Functiontest_vfused_needle_retrieval
(total_bits)
tests/test_end_to_end.py:219
Functionturboquant_attention_scores
Score-only kernel. One program per query block, streams over KV.
turboquant_cutile/attention.py:27
Functionturboquant_compress_2bit
2-bit MSE (4 centroids) + 1-bit QJL. total_bits=3.
turboquant_cutile/compress.py:12
Functionturboquant_compress_3bit
3-bit MSE (8 centroids) + 1-bit QJL. total_bits=4.
turboquant_cutile/compress.py:66
Functionturboquant_compress_values_2bit
MSE-only value compression, 2-bit (4 levels).
turboquant_cutile/compress.py:169
Functionturboquant_compress_values_3bit
MSE-only value compression, 3-bit (8 levels). No QJL.
turboquant_cutile/compress.py:130
Functionturboquant_decompress_2bit
4-level centroid lookup, un-rotate, rescale.
turboquant_cutile/decompress.py:49
Functionturboquant_decompress_3bit
8-level centroid lookup, un-rotate, rescale.
turboquant_cutile/decompress.py:12
Functionturboquant_fused_attention
Fused attention + online softmax. V is pre-decompressed FP16.
turboquant_cutile/attention.py:75
Functionturboquant_fused_attention_vfused_2bit
Fused attention + online softmax, decompresses 2-bit V on-chip.
turboquant_cutile/attention.py:274
Functionturboquant_fused_attention_vfused_3bit
Fused attention + online softmax, decompresses 3-bit V on-chip.
turboquant_cutile/attention.py:163