Compact Trie Structure for N-gram Language Model Storage
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing language models are inefficient in terms of storage space and response time due to their large size and complexity, particularly when used in distributed systems for tasks like automatic speech recognition and machine translation.
Innovation Solution
A compact language model representation using a trie structure encoded with integer vectors, which reduces storage requirements and enables rapid response times through segmented storage and sharding, allowing for efficient identification of n-gram probabilities.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Measurement precision
If traditional language models are used with large vocabulary and comprehensive n-gram data, then language modeling accuracy is improved, but storage space requirements and response time increase
Solution Approach 1:
The language model is segmented into multiple shards distributed across different storage locations. Each shard contains a subset of n-grams organized by their left context, allowing the system to divide the large model into manageable pieces that can be stored efficiently and retrieved selectively during inference.
Solution Approach 2:
The patent introduces a sharding dimension to the traditional n-gram storage structure. Instead of storing all n-grams in a single large table, the system adds a shard identifier dimension, organizing n-grams by their left context across multiple shards. This dimensional change enables compact storage while maintaining access efficiency through the trie structure.
2Measurement precision
If comprehensive n-gram data is stored for accurate language modeling, then modeling precision is improved, but response time for probability queries increases
Solution Approach 1:
The n-gram data is segmented and organized in a trie structure where each node represents a prefix of the n-gram sequence. This segmentation allows the system to traverse only the relevant portions of the trie during probability queries, rather than searching through the entire n-gram database, thereby reducing response time while maintaining precision.
Solution Approach 2:
The trie structure is pre-built and organized during model construction, with n-grams systematically arranged by their left context and sequence position. This preliminary organization eliminates the need for complex search algorithms during inference, as the system can directly navigate to the required n-gram probabilities through the pre-structured trie, significantly reducing query response time.
3Volume of stationary object
If language model data is stored in a compact format to reduce storage needs, then storage efficiency is improved, but complexity of data structure and retrieval operations increases
Solution Approach 1:
The trie structure serves multiple functions simultaneously: it organizes n-grams by left context for efficient retrieval, provides compact storage through shared prefixes, enables systematic indexing for probability calculations, and supports distributed sharding. This multi-functionality reduces the need for separate data structures, actually simplifying the overall system despite the inherent complexity of the trie itself.
Data Source
AI summary
Systems, methods, and apparatuses, including computer program products, are provided for representing language models. In some implementations, a computer-implemented method is provided. The method includes generating a compact language model including receiving a collection of n-grams from the corpus, each n-gram of the collection having a corresponding first probability of occurring in the corpus and generating a trie representing the collection of n-grams. The method also includes using the language model to identify a second probability of a particular string of words occurring.


