From dfed2cb3d2e73f2849e6113641da44907f8c23a0 Mon Sep 17 00:00:00 2001 From: Jiong Gong Date: Wed, 23 Sep 2026 11:48:02 +0000 Subject: [PATCH] compass(tests): size the tied head at a 4-byte element size as well as a 2-byte one Every call to tied_lm_head_bytes in test_memory_compare.py passed a 2-byte element size, so a function that ignored dtype_bytes and multiplied by 2 passed the whole file. Add one assertion on the tied 0.6B geometry at dtype_bytes=4: 151936 * 1024 * 4 = 622,329,856 bytes. Closes #284 Co-Authored-By: Claude Opus 5.5 (1M context) --- tests/compass/test_memory_compare.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/compass/test_memory_compare.py b/tests/compass/test_memory_compare.py index 2962a8e8ab..d3f01a9716 100644 --- a/tests/compass/test_memory_compare.py +++ b/tests/compass/test_memory_compare.py @@ -314,6 +314,13 @@ def test_the_tied_head_is_one_embedding_of_0_290_gib_on_the_0_6b(): assert round(nbytes / (1 << 30), 3) == 0.290 +def test_the_tied_head_scales_with_a_4_byte_element_size(): + # A float32 build of the same geometry owes twice the bfloat16 correction. + nbytes = tied_lm_head_bytes(qwen_0_6b(), dtype_bytes=4) + assert nbytes == 151_936 * 1_024 * 4 + assert nbytes == 622_329_856 + + def test_an_untied_model_owes_no_correction(qwen): assert qwen.tie_word_embeddings is False assert tied_lm_head_bytes(qwen, dtype_bytes=2) == 0