Language models that read text as whole words are fast but break on typos, slang, and rare forms. Models that also read the characters inside each word handle these cases well, but they pay the character cost on every token, including the many ordinary words that gain nothing from it. This proposal builds a word-level tagger with an optional, expensive character path. A small learned switch decides, token by token and using the surrounding sentence, whether to run the character path. The switch takes a single price knob, $\lambda$, which sets how much the operator is willing to pay in latency for accuracy. One trained model can then be moved along the whole accuracy–latency curve at inference time. An online controller can also turn the knob automatically when the serving load changes.
The claim that makes this worth doing is narrow and testable. The obvious cheap alternative is a rule that sends only rare or out-of-vocabulary words to the character path. We claim that on noisy social-media text a context-aware learned switch reaches the same accuracy while running the character path on substantially fewer tokens. We also claim this saving shows up in measured wall-clock time, not only in operation counts. If a swept frequency rule matches the learned switch, the proposal fails, and the experiments are built so that this outcome would be visible.
Core Claim
Two strands of prior work meet here without having been joined. The first is hybrid character-word representation. Gated Word-Character Recurrent Language Model mixes a word embedding with a character-LSTM embedding through a sigmoid gate, and the gate learns to lean on characters for rare words. That work supplies our mixing mechanism, but it leaves two openings we target. Its gate sees only the word itself, which the authors name as a limitation. And the character LSTM runs on every word whatever the gate value, so the gate never saves compute. Stacked and ensembled systems do the same thing at larger scale. BennettNLP at SemEval-2021 Task 5 concatenates Flair character embeddings with BERT and GloVe for every token. NTUA-SLP at SemEval-2018 Task 3 runs full word and character networks in parallel and averages them. Both motivate the proposal: they show characters help on noisy text, and they pay the full character cost everywhere.
The second strand is weighted multi-objective optimization, meaning the collapse of competing goals into one score through a tunable weight. Dynamic Deep Neural Networks trains routing decisions with a reward of accuracy minus $\lambda$ times multiplications, and it traces a trade-off curve on image tasks. It supplies the objective shape. It also constrains our design in two ways. Its Q-learning routing took two to four times longer to converge than a static network. And a 53% cut in multiplications became only an 18% cut in wall time, because data-dependent branching fragments GPU work. Online Linear Programming for Multi-Objective Routing in LLM Serving supplies the online piece. It adjusts "shadow prices" on congested resources by dual gradient steps in 1–2 ms and admits work only when its weighted reward exceeds the price. It does this at the level of whole requests and treats tokens as uniform units. We move the same price signal inside the model, to the choice of how finely each token is read.
What is new is the combination of three properties. The switch is conditioned on sentence context. It is trained against an explicit, measured latency cost with $\lambda$ as an input, so one model serves every trade-off point. And the character path is actually skipped, in a form that keeps GPU work dense. Charformer is the closest efficiency-minded character model. It learns soft subword blocks and downsamples by a factor fixed at training time, uniformly across positions, with no knob after training. Our model instead spends characters unevenly, only where they are needed, and lets the operator choose the budget.
Research Program
The model has a cheap backbone and an expensive side path. The backbone uses word lookup embeddings and a small bidirectional encoder, and it produces a contextual state $h_t$ for each token $t$. The side path is a contextual character encoder in the style of Flair. It reads the characters of token $t$ and a window of neighbouring tokens, and its output is merged into $h_t$ through a Miyamoto–Cho style gate before the task head. The switch is a two-layer network. It reads $h_t$, the word's frequency bucket, and the current price $\lambda$, which is injected through feature-wise scaling. It outputs a probability $p_t$ of running the side path. At inference the decision is hard: $z_t = 1$ if $p_t > 0.5$.
Training minimizes
$$\mathcal{L} = \mathcal{L}_{\text{task}} + \lambda \cdot \frac{1}{T}\sum_{t=1}^{T} c_t\, z_t,$$
where $\mathcal{L}_{\text{task}}$ is the tagging or classification loss, $T$ is the number of tokens in the batch, $z_t$ is the routing decision, and $c_t$ is the profiled latency of running the side path on token $t$. That latency is modelled as an affine function of the token's character count, fitted on the target GPU. Because $z_t$ is discrete, gradients pass through a straight-through estimator rather than reinforcement learning. This choice directly targets the convergence cost reported for Q-learning routing. A fresh $\lambda$ is sampled per batch from a log-uniform range, so the switch learns the whole family of trade-offs at once.
To avoid the gap between operation counts and wall time, the side path is never branched per token. The selected tokens and their windows are gathered into one dense, length-bucketed batch, the character encoder runs once, and the results are scattered back. The side path's cost is then roughly proportional to the number of selected tokens. We report the ratio of routed-fraction reduction to wall-time reduction explicitly and compare it with the 53%→18% gap.
The online layer is deliberately thin. A latency budget per request window defines a dual variable. A projected dual gradient step, borrowed from the LLM serving work, raises $\lambda$ when measured latency exceeds the budget and lowers it otherwise. The same trained model receives the updated $\lambda$ with no retraining.
Baselines
The naive reference points are the word-only backbone with the side path never run and the always-on hybrid with the side path run on every token. These two bracket the curve. The always-on model is our reimplementation of the gated mixing of Gated Word-Character Recurrent Language Model with the Flair-style encoder. A result counts only if the learned switch recovers at least 95% of the accuracy gap between the two brackets at a clearly lower wall-clock cost.
The strongest competitor on the question we actually pose is a family of hand-set rules applied to the same trained always-on model. The frequency rule routes tokens below frequency rank $k$, plus all out-of-vocabulary tokens, and $k$ is swept to trace a curve. The uncertainty rule routes tokens where the word-only head's predictive entropy exceeds a threshold, which is the token-level analogue of early-exit criteria such as BEEM. These rules cost nothing to train and inherit all the character path's accuracy, so they are the real threat. Every rule and the learned switch share the same backbone, side path, and training data, and each gets an equal budget of threshold or $\lambda$ settings evaluated on the dev set. Beating them means a higher accuracy at every matched wall-clock budget between 20% and 60% routing, summarized as area under the accuracy–latency curve, with confidence intervals over five seeds.
As a strong external system we include Charformer with downsampling rates 2 and 4, run at matched parameter count. For published reference points we use the strongest numbers in the file, obtained with systems that always pay the full character cost. On toxic spans, the Flair+BERT stacking in BennettNLP reports F1 of 0.748 on SemEval-2021 Task 5. On Italian Twitter tagging, When silver glitters more than gold reports 92.25% accuracy on PoSTWITA 2016. On irony, NTUA-SLP reports post-task F1 of 0.7856 on SemEval-2018 Subtask A. On Arabic, Advancing Arabic Diacritization reports 3.12% WER on WikiNews-2014 and 2.70% on WikiNews-2024. We do not claim to exceed these numbers. They show whether our always-on bracket is competitive enough for the routing results to mean anything. No reported result was found on Lacuna for Charformer on these specific tasks.
Two ablations isolate the key ingredients. The first removes context by feeding the switch only the word embedding and frequency, mirroring the original gate. The second removes $\lambda$-conditioning by training one separate switch per $\lambda$, which tests whether sharing one model across budgets costs accuracy.
Why not just…?
Why not just route rare and out-of-vocabulary words to characters with a frequency threshold? This is the alternative most likely to work as well, and the proposal stands or falls on it. The case against it is that noise on social media is not the same as rarity. A real-word typo ("form" for "from"), a hashtag that happens to be in the vocabulary, or a common word used ironically all look frequent. Meanwhile, on PoSTWITA the test out-of-vocabulary rate is 41–47% (When silver glitters more than gold), so a frequency rule would route nearly half the tokens, many of them harmless. The matched-budget comparison above settles the question directly. If the frequency curve lies within the seed confidence intervals of the learned curve on all four tasks, we report that the simple rule suffices and the learned switch is not worth its cost.
Why not just use the word model's own uncertainty to decide? Uncertainty-triggered routing is attractive because it needs no training. But a corrupted token can make the word-only model confidently wrong, since the lookup embedding for an in-vocabulary typo is a clean, confident vector. Early-exit work notes that results depend heavily on the exit criterion (BEEM), which suggests that raw confidence is a fragile signal. We test this directly. On the dev sets we inject controlled real-word typos and measure what fraction each policy routes. The claim predicts the learned switch catches more of them at equal budget.
Why not just use Charformer or a smaller always-on character model? If the character path is cheap, there is nothing to route, and this threat is real. Before any routing experiment, we profile the always-on hybrid and require the side path to account for at least 30% of per-sentence latency on our target GPU. If it does not, we stop and report that routing is moot for this encoder. Charformer lowers cost uniformly with a fixed rate (Charformer). It is included on the same curve, and if its two points dominate ours, uniform downsampling is the better answer.
Proposed Experiments and Decisive Checks
We train on the SemEval-2021 toxic spans data, PoSTWITA 2016, SemEval-2018 irony Subtask A, and the Arabic MSA diacritization corpus with evaluation on WikiNews-2014 and 2024. The Arabic setting tests whether context-driven routing survives the non-concatenative morphology of Arabic. The primary metrics are task F1, accuracy, or WER, plotted against measured median and 95th-percentile per-sentence latency at batch sizes 1 and 32, together with the fraction of tokens routed.
The first decisive check is the matched-budget comparison against the frequency and uncertainty rules described above. The second is the hardware check: the wall-time saving should be at least 70% of the routed-fraction saving, which would close most of the gap reported for dynamic vision networks. The third is the single-model check: the $\lambda$-conditioned switch should fall within one standard deviation of per-$\lambda$ switches. The fourth is an online trace in which the latency budget halves partway through a replay of test sentences. We measure the fraction of windows meeting the budget and the accuracy lost, compared with a static $\lambda$ chosen for the tighter budget. A final analysis inspects which tokens the switch routes that the frequency rule does not, broken down by typo, elongation, hashtag, and code-switching categories. This shows whether any advantage comes from the context mechanism we claim or from something incidental.
References
- Gated Word-Character Recurrent Language Model
- BennettNLP at SemEval-2021 Task 5: Toxic Spans Detection using Stacked Embedding Powered Toxic Entity Recognizer
- NTUA-SLP at SemEval-2018 Task 3: Tracking Ironic Tweets using Ensembles of Word and Character Level Attentive RNNs
- Dynamic Deep Neural Networks: Optimizing Accuracy-Efficiency Trade-Offs by Selective Execution
- Online Linear Programming for Multi-Objective Routing in LLM Serving
- Charformer: Fast Character Transformers via Gradient-based Subword Tokenization
- BEEM: Boosting Performance of Early Exit DNNs using Multi-Exit Classifiers as Experts
- When silver glitters more than gold: Bootstrapping an Italian part-of-speech tagger for Twitter
- Advancing Arabic Diacritization: Improved Datasets, Benchmarking, and State-of-the-Art Models