Abstract
Modern Large Language Models (LLMs) are constrained by static vocabularies, leading to inefficiencies in generating long phrases and difficulties in domain adaptation. This paper proposes a dynamic vocabulary approach that allows models to treat arbitrary text spans as atomic units. By incorporating a parametric Dynamic Phrase Encoder, the model can expand its vocabulary on-the-fly based on input context. Experimental results on WikiText-103 and ASQA demonstrate a 25% improvement in generation quality (MAUVE) and a 20% reduction in latency, alongside significantly improved citation accuracy in long-form question answering.
Introduction
Modern LLMs rely on fixed sets of tokens determined during pre-training. This static approach creates bottlenecks in domain flexibility, computational efficiency, and evidence integrity. For instance, generating a common phrase like "theatre production" token-by-token is more expensive than treating it as a single unit. Furthermore, models often struggle to provide verbatim citations because they must reconstruct them from small sub-word tokens. This research introduces a method to make vocabularies dynamic, allowing the incorporation of multi-token phrases into input and output layers without retraining the core model backbone.
Methodology
The proposed architecture centers on a Dynamic Phrase Encoder, a module that maps arbitrary text spans into the model's existing embedding space.
The system functions as a plug-and-play extension to existing LLMs (e.g., GPT-2). Candidate phrases are retrieved or extracted from the context and passed through the Phrase Encoder to create new embedding vectors. These are then appended to the standard embedding matrices. Key technical components include:
- Causal Phrase Encoding: A causal Transformer decoder is used for encoding, facilitating efficient negative sampling.
- Informative Negative Sampling: To distinguish phrases from their constituent tokens, the training regime includes "prefixes" (sub-parts of the phrase) and "successors" (likely distractor tokens) as negative examples.
- Alignment Loss: A KL-divergence loss ensures the model's behavior with dynamic phrases remains consistent with its original token-level logic.
Evaluation and Results
The method was evaluated across three scenarios: open-ended language modeling (WikiText-103), training-free domain adaptation (LawMT), and long-form question answering (ASQA).
Key Findings:
- Generation Quality: On WikiText-103, the model achieved a 25.69 MAUVE score, compared to 20.47 for the baseline Transformer, indicating significantly higher human-like fluency.
- Efficiency: Latency was reduced by approximately 20% (0.99s vs 1.10s for 128 tokens) due to fewer decoding steps.
- Citation Accuracy: In the ASQA task, citation recall improved from 0.62 to 9.76 when using n-gram phrases, highlighting the model's enhanced ability to reference source material verbatim.
- Sequence Compression: The "Normalized Sequence Length" dropped from 127.72 to 101.38, allowing more information to fit within the context window.
Discussion and Limitations
By treating phrases as atomic units, the model increases information density per decoding step. The use of informative negative samples effectively resolves "decoding ambiguity," where a string could be tokenized in multiple valid ways. Crucially, the parametric nature of the phrase encoder allows for training-free generalization; domain-specific knowledge can be injected at inference time simply by updating the embedding table.
However, limitations remain. The current implementation primarily optimizes the generated text, leaving the input prompt tokenizer unchanged. Additionally, there is a minor computational overhead for running the Phrase Encoder and maintaining expanded tables. Future work will explore deeper integration of phrase extraction into internal attention mechanisms and reducing dependency on external retrievers.
Summary updated