Building an AI-Specific Language from DeepSeek-OCR's Visual Compression Idea
This post (translated/summarized from Chinese) explores constructing an AI-specific compressed language: transferring DeepSeek-OCR's "visual compression representation" idea into a purely textual compression space, using rare Chinese character sequences as dense intermediate representations of LLM activation features — readable by machines, not humans.
Core Idea
DeepSeek-OCR maps text to visual tokens via DeepEncoder, then decodes back to text with an MoE-LLM:
The author abstracts this into a symbolic analog: project a semantic vector into a "Hanzi embedding space":
with a dedicated character codebook acting as a sparse basis, motivated by compressive sensing: if the semantic signal is sparse in some basis, few measurements suffice to recover it. Conditions cited: the projection matrix should satisfy the RIP property, and the LLM must be strong enough to invert the representation.
Key points
- Stage 1 — Static prototype: A Gaussian random projection matrix maps 128-d (or 768-d) semantic vectors to 16 compressed dimensions, each bucketed to a rare character. A Java demo (pure simulation) reports cosine similarity ≈ 0.89 between original and reconstructed vectors.
- Stage 2 — Learnable codebook: A PyTorch
encoder → codebook (K=128 characters) → decodermodel is trained with loss1 − cos(decode(encode(v)), v)usingparaphrase-multilingual-MiniLM-L12-v2embeddings. Nearest-neighbor (argmin over cdist) quantization selects characters. - Stage 3 — Entropy-constrained training + verification: Adds softmax soft-quantization, an entropy penalty (encouraging sparse, confident codebook assignments), and Gaussian noise for robustness. Verification proposes feeding both original text and compressed character strings into Qwen2.5-7B-Instruct and comparing last-layer hidden states via cosine similarity and KL divergence of activation spectra; similarity of 0.8–0.9 would suggest activation equivalence.
- Stage 4 — Inter-agent protocol: Agents share an encoder/codebook/decoder; one LLM compresses its output into a short character string (e.g., 16–32 characters), transmits it, and the receiving LLM reconstructs approximate semantics — a text-only version of "context optical compression" with claimed 10x–20x compression.
ChineseCompressionDemo.java— random projection + character encoding simulationAICHanziCompressor.java+embed_server.py(Flask + SentenceTransformer) — end-to-end compress/encode/reconstructtrain_codebook.py— learnable codebook training (PyTorch)train_entropy_codebook.py— entropy + noise regularized trainingverify_llm_equivalence.py— hidden-state comparison in Qwen2.5-7B-Instruct- Semantic-aware co-training so LLMs natively understand compressed characters
- Multi-resolution / adaptive-length encoding based on semantic complexity
- Injecting compressed sequences at the embedding layer and probing attention patterns (KL divergence)
- Memory decay via progressive "blurring" of character sequences, analogous to DeepSeek-OCR's visual forgetting
- Multi-agent systems where AI-human-unreadable character language evolves self-organized codebooks
Mapping to DeepSeek-OCR
| OCR module | Proposed analog | |---|---| | DeepEncoder (visual compression) | Hanzi compression encoder (symbolic) | | MoE decoder | LLM backbone | | Vision tokens | AI-internal character tokens |
Code artifacts included
Proposed future directions
Caveats
This is a speculative, conceptual proposal from a forum author. The reported similarity numbers come from toy simulations and a simplistic pseudo-inverse decoder; the claimed LLM activation equivalence is a proposed experiment, not a demonstrated result. Whether real LLMs assign meaningful semantics to such synthetic character sequences remains unverified.
Conclusion
The author's thesis: "AI-specific Chinese" is essentially a symbolic sparse basis — its goal is not human readability but efficient model activation. DeepSeek-OCR introduced "visual algebra" to text; this proposal builds a "symbolic algebra compression" mechanism inside language itself, from 2D optical subspace to a 1D symbolic space.