Views
No views yet
repeat_interleave(64) → 16 * 64 = 1024.d_model=1024 input vector, but the learned semantic geometry is not coming from the embedding table.n_embed=1024 embedding table (e.g. UNI_GLYPH / unfrozen baselines) are ~335M.vocab_size * 1024 = 65536 * 1024 ≈ 67.1Mvocab_size * 16 = 65536 * 16 ≈ 1.0Md_model): 1024n_embed=16, expanded to 1024 by repetition (non-trainable)embeddings.txt (human-readable reference):Note: Embeddings are shipped in this model repo (even though the tokenizer exists as a separate HF repo) to keep the model+embedding mapping self-contained and unambiguous.
1
2import torch
3from transformers import AutoTokenizer, AutoModelForCausalLM
4
5tokenizer = AutoTokenizer.from_pretrained("Bochkov/emergent-semantics-model-16-bit-269m")
6model = AutoModelForCausalLM.from_pretrained("Bochkov/emergent-semantics-model-16-bit-269m", trust_remote_code=True).to('cuda')
7
8inputs = torch.tensor([tokenizer.encode("Question: What is the capital of Japan?\nAnswer:")], dtype=torch.long, device='cuda')
9
10outputs = model.generate(
11 inputs,
12 max_new_tokens=10,
13 do_sample=False
14)
15print(tokenizer.decode(outputs[0].tolist()))
16
17#Question: What is the capital of Japan?
18#Answer:Nagano Prefecture
19nn.Embedding(vocab_size=65536, n_embed=16) whose values are strictly binary (0/1). Each 16-dim vector is then deterministically expanded to d_model=1024 via repeat_interleave(scale=64).1import torch
2from transformers import AutoTokenizer, AutoModelForCausalLM
3
4repo_id = "Bochkov/emergent-semantics-model-16-bit-269m"
5
6tokenizer = AutoTokenizer.from_pretrained(repo_id)
7model = AutoModelForCausalLM.from_pretrained(repo_id, trust_remote_code=True)
8model.eval()
9
10print("vocab_size:", tokenizer.vocab_size)
11print("config:", {k: getattr(model.config, k) for k in ["vocab_size", "n_embed", "d_model", "n_layer", "n_head", "scale"]})
12
13# --- 1) Show embedding matrix shape (should be 65536 x 16) ---
14W = model.token_embeddings.weight.detach().cpu()
15print("token_embeddings.weight shape:", tuple(W.shape)) # (65536, 16)
16
17# --- 2) Tokenize 'A' and show its token id (should be 65 for a unicode-char tokenizer) ---
18text = "A"
19ids = tokenizer.encode(text, add_special_tokens=False)
20tokens = tokenizer.convert_ids_to_tokens(ids)
21
22print(f"text={text!r}")
23print("ids:", ids)
24print("tokens:", tokens)
25
26tid = ids[0]
27
28# --- 3) Print the 16-dim vector and verify it is binary (0/1) ---
29e16 = W[tid] # shape: (16,)
30print("16-dim embedding for token id", tid, ":", e16.tolist())
31
32uniq = torch.unique(e16)
33print("unique values in e16:", uniq.tolist())
34
35is_binary = torch.all((e16 == 0) | (e16 == 1)).item()
36print("is strictly binary (0/1):", is_binary)
37
38# --- 4) Show deterministic expansion to d_model=1024 via repeat_interleave ---
39scale = model.config.scale # should be 1024 // 16 = 64
40e1024 = e16.repeat_interleave(scale) # shape: (1024,)
41print("expanded embedding shape:", tuple(e1024.shape))
42print("expanded embedding first 128 values:", e1024[:128].tolist())
43
44# --- 5) Global check: all embedding weights are exactly 0/1 ---
45is_binary_global = torch.all((W == 0) | (W == 1)).item()
46num_non_binary = torch.numel(W) - torch.sum((W == 0) | (W == 1)).item()
47print("is binary globally (0/1):", is_binary_global)
48print("non-binary entries:", int(num_non_binary))@article{
bochkov2025emergent,
title={Emergent Semantics Beyond Token Embeddings: Transformer {LM}s with Frozen Visual Unicode Representations},
author={Andrey Bochkov},
journal={Transactions on Machine Learning Research},
issn={2835-8856},
year={2025},
url={https://openreview.net/forum?id=Odh8IynO1o},
note={}
}
@misc{bochkov2025growingtransformersmodularcomposition,
title={Growing Transformers: Modular Composition and Layer-wise Expansion on a Frozen Substrate},
author={A. Bochkov},
year={2025},
eprint={2507.07129},
archivePrefix={arXiv},
primaryClass={cs.LG},
url={https://arxiv.org/abs/2507.07129},
}