Semantic Huffman Coding using Synonymous Mapping

Jin Xu, Kai Niu, Zijian Liang, Ping ZhangarXiv 2024 · DOI

Abstract

Traditional Huffman coding is limited by the Shannon entropy of syntactic symbols. This paper proposes Semantic Huffman Coding, which leverages synonymous mapping to group symbols with identical meanings into synonymous sets. By constructing a Huffman tree based on the cumulative probability of these sets, the authors achieve compression rates that surpass the classical Shannon limit while maintaining high semantic integrity. Experimental results on technical texts demonstrate a ~6% reduction in average code length with near-perfect semantic similarity (BERT score of 0.9969).

Introduction

For decades, Classical Information Theory (CIT) has defined the boundaries of data compression through the lens of syntactic accuracy. Standard methods like Huffman coding ensure that every bit is reconstructed exactly, treating words like "send" and "transmit" as distinct entities regardless of context. However, as we approach the theoretical Shannon limit, further gains require a shift toward Semantic Communication. This paper introduces a practical framework for Semantic Huffman Coding that utilizes semantic redundancies to compress data more effectively than traditional statistical methods.

Methodology

Synonymous Mapping and Set Construction

The core of the proposed approach is the definition of "synonymous sets." A synonymous set is a collection of syntactic symbols (words or characters) that convey the same meaning in a given context. For instance, in a technical document, a set might include various forms of a verb (e.g., {be, am, is, are}) or functional synonyms (e.g., {message, information}).

Semantic Huffman Tree Construction

Unlike classical Huffman coding, which assigns a leaf node to every unique symbol, Semantic Huffman Coding merges all symbols within a synonymous set into a single leaf node. The probability assigned to this semantic node is the sum of the probabilities of its constituent syntactic symbols.

Comparison between Classical and Semantic Huffman Code trees. The semantic version merges synonymous symbols into single leaf nodes, resulting in a shallower tree and shorter average codewords.

As illustrated in the comparison above, this merging process results in a shallower tree structure. Consequently, the average codeword length for the semantic units is significantly reduced compared to the classical approach. This mathematical simplification allows the method to remain uniquely decodable while increasing efficiency.

Encoding and Decoding

During encoding, the source symbol is mapped to its corresponding synonymous set, and the short codeword for that set is transmitted. The receiver decodes the codeword back to the synonymous set. To reconstruct the text, the system selects an "objective syntactic symbol" from the set—typically the one with the highest prior probability—to ensure grammatical and contextual consistency.

Experimental Evaluation

The authors evaluated the system using Claude Shannon’s seminal 1948 paper, "A Mathematical Theory of Communication." A targeted thesaurus was manually constructed to group singular/plural forms, case variations, and technical synonyms to ensure semantic distortion-free mapping.

Results and Discussion

The experimental results confirm that Semantic Huffman Coding can effectively surpass the classical Shannon limit by ignoring "meaningless" syntactic differences.

Numerical comparison of Classical vs. Semantic Huffman coding performance, showing the reduction in average code length and the difference between information and semantic entropy.

As shown in the results table, the average code length was reduced from 8.7762 bits/symbol to 8.2457 sebits/symbol, representing a 6.04% improvement in compression efficiency. Crucially, the measured "Semantic Entropy" ($H_s$) of 8.2119 sebits is lower than the standard Information Entropy ($H$) of 8.7430 bits.

While the exact word-match metric (BLEU score) was 54.60, the semantic preservation was nearly perfect, with a BERT similarity score of 0.9969. This indicates that while the decoded text may differ syntactically from the source (e.g., substituting "send" for "transmit"), the underlying meaning remains intact.

Conclusion and Future Work

Semantic Huffman Coding provides a viable path for exceeding traditional compression limits by prioritizing meaning over syntax. While the current study relied on manual mapping, future work will focus on automating the construction of synonymous sets using Large Language Models (LLMs) and addressing context-sensitive mapping (polysemy) to handle more complex linguistic structures.

Summary updated

BibTeX
@misc{xu2024semantic,
  author = {Jin Xu and Kai Niu and Zijian Liang and Ping Zhang},
  title = {{Semantic Huffman Coding using Synonymous Mapping}},
  year = {2024},
  eprint = {2401.14634},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2401.14634},
}
Figure