---
title: "Natural Language Processing with Small Feed-Forward Networks"
description: "Small feed-forward networks trade memory, precision and computation to identify languages, tag words, segment Chinese text and reorder words."
canonical: "https://research.elamur.ai/free/en/papers/botha-2017-natural-language-processing-small-feed/"
---
Elamur: [Mova](https://md.mova.elamur.ai/free/en/) · [Parse](https://mova.elamur.ai/free/en/parse/) · [Dictionary](https://md.dictionary.elamur.ai/free/en/) · [Translate](https://md.translate.elamur.ai/free/en/) · **Research** · [Gali](https://md.gali.elamur.ai/free/en/) · [MCP](https://mcp.elamur.ai/) · [Locations](https://md.locations.elamur.ai/free/en/) · [Weather](https://md.weather.elamur.ai/free/en/) · [Constitution](https://md.constitution.elamur.ai/)

[Elamur Research](https://md.research.elamur.ai/free/en/) · [this page in HTML](https://research.elamur.ai/free/en/papers/botha-2017-natural-language-processing-small-feed/)

[Elamur Research](https://md.research.elamur.ai/free/en/) / [papers](https://md.research.elamur.ai/free/en/papers/) / [2017](https://md.research.elamur.ai/free/en/papers/2017/) / Natural Language Processing with Small Feed-Forward Networks

# Natural Language Processing with Small Feed-Forward Networks

Paper · 2017 · Jan A. Botha, Emily Pitler, Ji Ma et al.

**Authors:** [Jan A. Botha](https://md.research.elamur.ai/free/en/authors/jan-a-botha/), [Emily Pitler](https://md.research.elamur.ai/free/en/authors/emily-pitler/), [Ji Ma](https://md.research.elamur.ai/free/en/authors/ji-ma/), [Anton Bakalov](https://md.research.elamur.ai/free/en/authors/anton-bakalov/), [Alex Salcianu](https://md.research.elamur.ai/free/en/authors/alex-salcianu/), [David Weiss](https://md.research.elamur.ai/free/en/authors/david-weiss/), [Ryan McDonald](https://md.research.elamur.ai/free/en/authors/ryan-mcdonald/) and [Slav Petrov](https://md.research.elamur.ai/free/en/authors/slav-petrov/) · **Year:** 2017 · **Venue:** EMNLP 2017 · **Licence:** [CC BY 4.0 (ACL Anthology)](https://creativecommons.org/licenses/by/4.0/)

[Cited by **16** papers in our library of more than 163,000 papers whose bibliographies we read](https://md.research.elamur.ai/free/en/papers/botha-2017-natural-language-processing-small-feed/cited-by/) · EMNLP 2017 · [licence](https://creativecommons.org/licenses/by/4.0/)

- [Publisher's page](https://aclanthology.org/D17-1309/)
- [PDF](https://aclanthology.org/D17-1309.pdf)

## Summary

A language-processing system can be accurate and still be too slow or too large for the device that needs to run it. Botha and colleagues ask how much accuracy a system can retain with a small memory budget and a shallow feed-forward network. They use the same basic design for identifying the language of a document, assigning grammatical labels to words, finding word boundaries in Chinese, and rearranging English words into an order closer to Japanese. The tasks range from assigning a single label to constructing an output through a sequence of decisions. The paper treats prediction quality, storage and computation as separate measures of success. [Natural language processing](https://md.research.elamur.ai/free/en/concepts/natural-language-processing/)

The network learns short numerical representations of features drawn from the input. Character sequences can supply much of the information usually obtained from large word dictionaries. Hashing lets many such sequences share a fixed number of entries, and quantization lets the network store those entries at lower numerical precision. A single hidden layer combines the features and scores the possible outputs. For segmentation and reordering, a transition system keeps track of the work in progress. The network chooses an action from the current state, and the action changes the state before the next prediction.

On Wikipedia text in 66 languages, the quantized identifier reached 88.0 micro F1 at 302 KB. The nearest-neighbor comparison scored 90.2, while the nearest-prototype comparison scored 87.0. In [part-of-speech tagging](https://md.research.elamur.ai/free/en/concepts/part-of-speech-tagging/), adding word clusters and reducing the dimensions of the other features yielded 95.39 average accuracy at 0.7 MB, with fewer estimated operations than the monolingual recurrent comparison. On Chinese Treebank 6.0, explicitly representing pairs of characters brought the segmenter to 95.18 accuracy at 2.0MB. The strongest comparison in the paper’s segmentation table reached 95.95. For English-to-Japanese reordering, a system that first predicts grammatical tags scored 81.3 on the fuzzy reordering metric at 1.3MB, close to the comparison score of 81.6.

The experiments show that the way a budget is spent matters as much as the choice to keep it small. For language identification, more embedding dimensions at lower precision preserved the score of the full-precision setting. For segmentation, storing useful character pairs paid off more than widening the representations of individual characters. For reordering, grammatical tags produced by a separate network were more effective and took less space than giving the reorderer all the features used to infer those tags. These results establish a range of practical options on the tested tasks. The speed measurements describe throughput on a workstation CPU, while the recurrent comparison for tagging also uses estimated arithmetic operations to show where the feed-forward design saves computation.

## Deep dive: Natural Language Processing with Small Feed-Forward Networks

Small feed-forward networks trade memory, precision and computation to identify languages, tag words, segment Chinese text and reorder words. · about 37 minutes to read

**In this deep dive**

1. [The problem and its context](#dd-the-problem-and-its-context)
2. [The method, step by step](#dd-the-method-step-by-step)
3. [Experiments and results](#dd-experiments-and-results)
4. [What the ablations show](#dd-what-the-ablations-show)
5. [Limitations](#dd-limitations)
6. [What came after](#dd-what-came-after)

### The problem and its context

#### Why a small network matters

A system deployed on a phone faces a different engineering question from one evaluated only for accuracy. It needs enough memory for its stored parameters and any supporting data, and it needs to process input quickly enough to be usable. The paper takes those constraints seriously at the design stage. It asks which parts of a language system deserve the available space and which operations make the system expensive to run. The aim is to find a good operating point under a tight budget, with enough evidence to judge how much prediction quality a smaller design retains. [Efficient models & compression](https://md.research.elamur.ai/free/en/topics/efficient-models/)

The authors motivate the problem with [machine translation](https://md.research.elamur.ai/free/en/topics/machine-translation/), where some of the successful networks they cite contain hundreds of millions or billions of parameters. That example establishes the difference between making a prediction system more capable by increasing its capacity and fitting one into a constrained environment. The paper’s own translation-related experiment is a preprocessing task. It handles the order of the source words and leaves the rest of translation to a downstream system. The distinction matters because reordering requires only a restricted set of output decisions.

Character-based representations had already shown that a recurrent system could have a relatively small parameter count. The paper cites a tagger with roughly 900,000 parameters as an example. Its concern is that the amount of arithmetic can still make a system slow. The authors point to the eight matrix multiplications they count per long short-term memory cell and to an earlier translation system that processed 8.8 words/second on an Android phone. The phone measurement motivates the emphasis on computation. It describes a different task and implementation from the paper’s own experiments, so it serves as context for the engineering question.

A shallow feed-forward network offers a way to control the work done in a prediction. It reads a representation prepared from the available input and sends it through a fixed sequence of layers. A recurrent network also updates an internal representation as it moves through a sequence. Botha and colleagues retain information about nearby words, characters or earlier decisions through the features supplied to the feed-forward network. In the structured tasks, the evolving state of the problem is maintained explicitly. That division allows a short network computation to serve as one part of a longer prediction process.

#### What the authors take from earlier work

The paper builds on a style of neural [dependency parsing](https://md.research.elamur.ai/free/en/concepts/dependency-parsing/) in which a classifier scores actions from features of a partially completed analysis. Earlier transition-based approaches provided the framework for representing a state and changing it one operation at a time. Previous neural parsers showed how to turn its discrete features into learned numerical representations. The authors reuse that division of labor for other structured outputs. For task-specific transitions, they draw on earlier work that processed segmentation decisions through a state and on a parsing operation that could swap items to change their order.

Earlier applications of related feed-forward architectures had used [word embeddings](https://md.research.elamur.ai/free/en/concepts/word-embeddings/), learned vectors associated with words. Storing useful word coverage can take substantial space even when the network that consumes the vectors is shallow. The paper describes typical requirements of 100,000+ vocabulary entries and 50+ dimensions. Each vocabulary entry needs a row of stored numbers, so growth in either dimension adds to the memory bill. The authors turn to character features, following earlier evidence that character-based representations can work for language tasks. They combine those features with a hashing technique that gives them a direct way to set the size of the lookup table.

Most of the resulting storage can still sit in the feature tables. That observation makes earlier work on quantization relevant even after the vocabulary has been reduced. Quantization changes the precision used to store a numerical value. It gives the authors a way to fit more values into a similar amount of space or to keep the same number of values in a smaller file. This is a separate choice from using characters in place of words. The former changes the cost of each stored entry. The latter changes what the entries represent and how many entries the system needs.

The tasks also bring distinct lines of earlier work into the paper. For language identification, the authors discuss interest in code-switched text and dialect distinctions, then focus on assigning one language to each Wikipedia document. Nearest-neighbor and nearest-prototype classifiers supply a comparison between retaining individual training examples and using a more compact representation of the classes. For grammatical tagging, the reference system reads bytes and predicts labeled spans. Its input representation is compact, and its span prediction handles a broader input-to-output problem than assigning tags to tokens already supplied to the classifier.

For Chinese [word segmentation](https://md.research.elamur.ai/free/en/concepts/tokenization/), the authors describe prior neural approaches that improved on earlier methods and work that showed the value of explicitly representing adjoining character pairs. Segmentation matters where spaces fail to mark every word boundary. The system must infer which adjacent characters belong to the same word. Preordering has a different purpose. Earlier work used it to bring the source sequence closer to the word order expected on the target side of statistical translation. In that case the input units are words, and the system has to change their positions while retaining them all.

Taken together, the tasks give different meanings to a small prediction. A document can receive one language label, and an existing token can receive one grammatical label. A segmented sentence needs a coherent set of word boundaries, while a preordered sentence needs a complete arrangement of its input words. The paper uses the first pair to examine feature representation and the second pair to test whether local classification can be combined with suitable constraints on the output. The shared network is a way to study those choices across problems whose outputs have different forms.

### The method, step by step

#### From a feature to a prediction

The feed-forward network always begins with discrete features. A feature could be a pair of characters from the current word, the identity of a neighboring character, or a grammatical tag supplied by another network. A discrete feature identifies an item that can be looked up. Its embedding is the row of learned numbers retrieved for that item. Grouping related features lets the authors give separate storage and dimensions to different kinds of evidence. A table for character pairs can have a different capacity from a table for individual characters.

The paper’s architecture illustration uses bigrams from the preceding, current and following word, as well as trigrams from the current word. A [character n-gram](https://md.research.elamur.ai/free/en/concepts/n-gram/) is a sequence of consecutive characters of a specified length. A bigram is a pair and a trigram is a group of three. The example illustrates two independent choices. The feature template decides where to look for evidence, while the group decides which embedding table supplies it. Thus the same kind of character sequence can be considered at several positions relative to the token of interest.

The embeddings drawn from those tables form the input to the network. The assembly depends on the task. A template with distinct positions can preserve them when it constructs the input vector. For a document whose length varies, the language identifier instead summarizes the embeddings separately for each character sequence length. Once the input vector is ready, a fully connected hidden layer transforms it. Every hidden unit can use every component of that vector. A layer of output scores then supplies a distribution over labels or action types.

In a document classifier, the decision completes the prediction. In a tagger, the network repeats the classification for the other tokens. In a transition system, the chosen action changes the state used to construct the next input. The repeat step therefore has different meanings in the two cases. Tagging visits more input positions and predicts each label independently. Segmentation and preordering build an output whose intermediate state affects what the next classifier call sees.

How the feed-forward network makes labels and transitions The steps in order.

#### Setting the size of the feature tables

Each feature group has an embedding matrix. A row is the vector for one possible feature value, and a column is one dimension of that vector. The dimensions of the table are specified separately from the width of the hidden layer. This distinction matters because the table contains learned values for all of its entries, while the hidden layer processes only the assembled feature vector for the current prediction. An increase in the table’s vocabulary therefore affects storage without necessarily changing the length of the input vector.

```
E_g ∈ ℝ^(V_g × D_g)
```

Here `g` indexes a feature group and `E_g` is its embedding matrix. `V_g` is the number of rows available for discrete feature values. `D_g` is the number of numerical dimensions stored in each row. `ℝ` denotes real-valued entries in the mathematical description. The `⊂` relation is not needed here. The `∈` sign indicates that the matrix belongs to the space of real-valued matrices of the specified shape, and `×` separates the row and column dimensions.

To bound the table for hashed character features, the network assigns a feature group to each length and uses hashing to choose a row. The length determines the table. The character string determines the lookup within that table. The hash function produces an integer from the string, and the table size turns that integer into an index within the available range.

```
v = H(x) mod V_g
```

`x` is a character sequence of the length assigned to group `g`. `H` is the hash function, and `H(x)` is the integer it gives that sequence. `V_g` is the group’s allotted vocabulary size. `mod` gives the remainder after division by `V_g`, and `v` is the resulting row index.

Different strings can map to the same row. The shared row then receives learning updates from those strings and supplies the same stored vector whenever any of them appears. Hashing sets a firm limit on the number of available vectors even if the input contains many more distinct strings. It also supplies a lookup for a string that was absent from training, provided the same feature rule can be applied to it. The price is that the network loses the ability to distinguish some strings through that feature alone. Other feature groups or positions can still supply information about the input.

The authors give 100-5000 as a typical range for the hashed feature vocabulary sizes. They describe D_g = 16 as a typical embedding width for small feature vocabularies. Those figures characterize the general approach, and the experiments vary dimensions and storage across tasks. The segmenter takes a different approach to vocabulary control and keeps direct character identities. The language identifier makes the use of fixed-size feature groups particularly clear because it collects character sequences from documents whose contents and lengths vary.

The contribution of the embedding tables to parameter storage can be written as a sum over groups.

```
P ≈ ∑_g V_g D_g
```

`P` denotes the memory requirement expressed here through the number of stored parameter values. `≈` marks an approximation. `∑_g` means to add the contribution of every group indexed by `g`. `V_g D_g` is the product of that group’s row count and its row width. This expression isolates the dominant tables. The paper’s size measurements also count other parameters and resources, and the number of bytes occupied by the table values depends on their stored precision.

Quantization makes use of that last distinction. The authors compress the embedding weights and store scale factors associated with the embeddings. Inference can recover numerical values from the compressed representation as it needs them. In terms of the storage expression, the table can keep its shape while each entry takes less space. It can also use those savings to afford more dimensions. The paper tests this choice directly for language identification. The supplementary material is where the authors place the encoding details.

#### Combining features and assigning scores

The network represents its embedding-layer output as a concatenation of the results from the feature groups. Concatenation places vectors next to one another in an ordered list of values. This lets the next layer receive character evidence and other feature types at the same time. It also lets a template keep distinctions such as which word supplied a particular group of features when its output is arranged by position.

```
h₀ = [X_g E_g | ∀g]
```

`h₀` is the input vector passed from the embedding layer to the hidden layer. `g` indexes a feature group, and `E_g` is the embedding matrix for that group. `X_g` represents the extracted feature selections for the group in a form that can be used with the matrix. The product `X_g E_g` obtains the group’s embedding representation. The brackets with `| ∀g` denote taking the contribution for every group and joining the reshaped contributions into a single vector. The language identification experiment uses an average within each group before assembling that vector.

The authors use one hidden layer, denoted by `h₁`, with `M` rectified linear units. A rectified linear unit passes a positive activation through and turns a negative activation into zero. Since each unit receives the complete input vector, the layer can learn useful combinations of features. Its width changes how many such responses the output layer can draw on. The hidden computation also accounts for a substantial part of the arithmetic cost. This makes its width a runtime choice as well as a choice about capacity.

The output uses a softmax. It gives every candidate a positive weight based on its score and normalizes those weights into probabilities over the candidates. The paper gives the relationship in proportional form.

```
P(y) ∝ exp(β_yᵀ h₁ + b_y)
```

`P(y)` is the probability of output class `y`. The symbol `∝` means proportional to, and `exp` is the exponential function. `h₁` is the vector of hidden activations. `β_y` is the learned output weight vector for class `y` with `M` components, and `ᵀ` transposes the vector so that the product with `h₁` gives a scalar. `b_y` is the learned bias for that output. The expression inside the exponential is the class score, also called its logit. Normalization uses the exponential scores of the available classes to turn that proportional weight into a probability.

The classes have a different interpretation in each task. In language identification, they are languages. In grammatical tagging, they are tags for the token currently being classified. In segmentation and reordering, they designate operations on a state. In the structured cases, a classifier decision therefore has to be understood together with the definition of the action. Its effect on the output is specified by the transition system, and an action’s meaning depends on what is currently in the state.

#### Learning the weights

The network learns the character embeddings from scratch. During training, the authors use cross-entropy against the ground truth. Cross-entropy penalizes the classifier when it assigns a low probability to the correct outcome. They combine it with L2 regularization of the biases and hidden-layer weights, which adds a penalty tied to the squared magnitudes of those parameters. The task determines what an example consists of and how its input features are extracted. The shared learning procedure can then adjust the embeddings and network scores using the prediction error.

Optimization uses averaged stochastic gradient descent with momentum. The training procedure estimates updates from small batches of examples, carries information from previous updates through momentum, and decreases the learning rate exponentially. The learning rate governs the size of an update. The mini-batch size is 32. The authors search a grid for the remaining hyper-parameters, judge settings by the relevant task metric on held-out data, and use early stopping. The paper directs readers to its supplementary material for the full feature templates and selected hyper-parameter settings.

#### Preparing input for identification and tagging

For language identification, the network needs a fixed-size input for documents of varying length. The authors extract character sequences of lengths from 1 through 4, hash each sequence into its group, and look up its embedding. They average the retrieved vectors separately for each length and then combine the group averages. The resulting input preserves a separate description for each length. Averaging also prevents the magnitude of the representation from accumulating simply because a document supplies more occurrences. The authors tried summation and report that it gave poor results.

Grammatical tagging uses an already tokenized sequence. The classifier predicts the tag for each token from its input features, which can include a window of nearby words. A prediction can therefore use information about neighboring words even though the tags are assigned independently. That is a useful distinction between context and dependence among predictions. The input derives from local context, while the network issues a separate label decision for each supplied token. Character sequences give one source of information about the form of the current word and the words around it.

Word clusters supply another source. A cluster identifier is a shared label for a group of word types. A lookup can give the tagger a common feature for several words whose character patterns differ. The exact word-to-cluster mapping can itself be larger than the network the authors want to deploy. To control this resource cost, they represent the mapping with a Bloom map, an approximate key-value structure related to a Bloom filter. The map retrieves a cluster identity from a word key, and the tagger embeds that identity as a feature. The paper reports that 300KB represents the cluster mapping for 250,000 word types approximately, with a space saving by a factor of ∼15.

The cluster representation gives the tagger a place to use information about whole words while retaining its small character tables. When the paper tests narrower embeddings, it reduces the dimensions of the other feature groups and leaves the cluster dimensions alone. That choice provides an experiment in allocating memory across different sources of evidence. The authors can keep the extra feature that improved tagging and test how much capacity the rest of the input needs once that feature is present.

#### Segmenting characters into words

The segmenter reads a sequence of characters and marks where words begin. Its state has a buffer of characters waiting to be processed and a stack that records word starts. The initial state places all input characters in the buffer, in their original order, and leaves the stack empty. At each step the system considers the first character in the buffer. A split records that character as the start of a word. A merge consumes the character without recording a new start. When the buffer is empty, the word starts in the stack specify the segmentation of the original sequence.

```
([], [c₁ c₂ … cₙ])
```

This pair is the initial segmentation state. The first list, `[]`, is the empty stack. The second list is the buffer. `c₁` is the first input character, `c₂` is the next one, and `cₙ` is the final one of `n` input characters. `…` stands for the intervening characters. The parentheses pair the two state components and the square brackets enclose their contents.

```
([σ], [i | β]) → ([σ | i], [β])
```

This is `SPLIT`. `σ` is the existing stack of recorded starts. `i` is the character at the front of the buffer, and `β` is the remaining buffer. In `[i | β]`, the bar joins the front item to the rest of the buffer. In `[σ | i]`, it appends the item to the stack. `→` means that applying the action changes the state on the left into the one on the right. The operation records `i` as a start and leaves `β` as the pending input.

```
([σ], [i | β]) → ([σ], [β])
```

This is `MERGE`. `σ` is again the stack of recorded starts, `i` is the next character, and `β` is the rest of the buffer. The bar in `[i | β]` separates its front item from the remaining sequence. The arrow shows the move to the updated state. The character is consumed and the stack stays as it was. It remains part of the original text, whose word boundaries are recovered from the positions retained in the stack.

The segmenter’s feature vocabulary uses direct character identities. The authors found that hashing hurt quality in preliminary experiments for this task. To learn a representation for unknown characters, they map characters seen only once in the training data to a special symbol. The training examples then give that symbol an embedding. At evaluation, a character outside the known vocabulary can use that representation. The authors use no external resources or pretrained embeddings for the segmentation experiment.

The other feature choice is whether to give the classifier explicit character pairs. With only individual character embeddings, the hidden layer can in principle respond to combinations of characters. An explicit bigram supplies a separate lookup for the pair itself. The distinction is between learning the pair’s effect through a hidden unit that receives its components and assigning the pair a vector that can be retrieved directly. Direct lookup costs table space. The segmentation experiment tests whether spending space this way pays off more than increasing the width of the character embeddings.

#### Reordering words with shifts, swaps and joins

For preordering, the state again consists of a stack and a buffer. Its items are spans of words. At first every word is a span of its own, and the buffer lists these spans in source order. The stack starts empty. A shift moves the next span from the buffer onto the stack. A swap returns an earlier of the top stack items to the front of the buffer under the ordering condition in the transition system. An append joins the top stack items in their current order. The finished state has an empty buffer and one span on the stack, which contains the complete output sequence.

```
([], [[w₁] [w₂] … [wₙ]])
```

This pair is the initial preordering state. `[]` is the empty stack. The second component is the buffer. `w₁`, `w₂` and `wₙ` denote the first, next and final words among the `n` source words, and `…` stands for the words between the displayed positions. Brackets around an individual word identify a span consisting of that word. The outer brackets on the right enclose the sequence of spans.

```
([σ], [i | β]) → ([σ | i], [β])
```

This is `SHIFT` in the preordering system. `σ` is the existing stack, `i` is the first span in the buffer, and `β` is the remaining buffer. The bars mark where `i` occurs in the relevant sequence. `→` shows the update, which takes `i` off the front of the buffer and places it on top of the stack.

```
([σ | i | j], [β]) → ([σ | [ij]], [β])
```

This is `APPEND`. `i` and `j` are the top stack spans, with `j` on top and `i` immediately below it. `σ` is what is left below them, and `β` is the buffer. The bars separate components of the stack sequence. `[ij]` denotes a single span with the words of `i` followed by those of `j`. The arrow indicates that this combined span replaces the two stack items and that the buffer is retained as it was.

```
([σ | i | j], [β]) → ([σ | j], [i | β])    if i < j
```

This is `SWAP`. `σ` is the stack below the displayed spans `i` and `j`, and `β` is the existing buffer. The bars show the order of items in each sequence. The arrow indicates that `j` stays on the stack while `i` goes to the front of the buffer. The condition `i < j` is the system’s ordering precondition for the two items. A later shift can put the returned span on the stack after the span that formerly followed it.

The authors describe the transition system as sound and complete for permutations. Soundness concerns the output of a derivation. The operations move or join spans, and the finished span contains all the original words, with their positions possibly changed. Completeness concerns what the available actions can express. The authors give a construction that first uses shifts and swaps to arrange the singleton spans in the desired order, following the logic of bubble sort, and then appends them into one span. For `n` input words, their construction takes `n − 1` append operations after the ordering step. A learned classifier still has to find a suitable sequence of decisions for each input.

The reorderer is trained and evaluated with manually aligned English and Japanese words from Nakagawa’s work. Such alignments supply evidence about where source words correspond to words on the target side, which makes the target ordering a supervised task. The authors try a reorderer using its own input features, a pipeline that predicts grammatical tags first, and a reorderer supplied directly with the features used to predict those tags. The pipeline makes the predicted tag an intermediate representation. The direct configuration gives the reordering network features from the tagger’s three-word context and learns from the downstream task.

### Experiments and results

#### Reading the resource measurements

The experiments report a quality measure appropriate to each task along with storage and, where given, computation. Storage covers both parameters and other resources needed by the system. The paper defines a kilobyte as 1024 bytes. That accounting makes a word-cluster map part of the cost of the tagger even though the map is separate from the network’s learned weights. The weight count and deployed size therefore answer different questions. One says how many numerical parameters the network uses. The other includes the resources it needs to make predictions.

The computational estimate counts floating-point operations for a forward pass beginning with the assembled embedding vector. It includes the matrix computations and the output logits. The count omits the nonlinear activations and softmax normalization, and its starting point leaves feature extraction and input-vector construction outside the estimate. A forward pass may produce a document label, a label for one token, or one action in a structured prediction. The unit of prediction and the number of required passes matter when using that count to reason about full-task throughput.

The authors also report observed processing speeds on a workstation with a 3.50GHz Intel Xeon E5-1650 v3 CPU. Those figures express throughput in units suited to the tasks, such as documents or tokens per second. They complement the arithmetic estimate by giving an indication of how the implementations ran. Individual timings come with input conditions. The document identifier is timed on preprocessed Wikipedia text, and the reordering pipeline is timed with tokenization already done. These conditions matter when comparing the measurements with a system that starts from raw text.

#### Language identification on Wikipedia

The first evaluation asks which of 66 languages a Wikipedia document is written in. The references come from Baldwin and Lui: a nearest-neighbor system and a nearest-prototype system. Nearest-neighbor classification makes its decision by finding a close example among the stored instances. The prototype approach uses representatives of the classes. The paper emphasizes the storage consequence of the nearest-neighbor approach: its memory requirements grow linearly with the amount of training data. The prototype system is the relevant low-memory comparison in the authors’ discussion.

The result is reported as micro F1. Micro-averaging pools the counts used to measure performance across the evaluated categories before calculating the score. All the rows below therefore use the same aggregate metric on the Wikipedia identification task. The smaller feed-forward setting has 6 embedding dimensions. The two wider settings have 16 dimensions and differ in precision.

Language identification on Wikipedia in 66 languages by micro F1 The quantized feed-forward system matches its full-precision counterpart and exceeds the nearest-prototype score.

**The numbers**

| System or setting | Micro F1 |
| --- | --- |
| Nearest neighbor | 90.2 |
| Nearest prototype | 87.0 |
| Small feed-forward, 6 dim | 87.3 |
| Small feed-forward, 16 dim | 88.0 |
| Small feed-forward, 16 dim, quantized (this paper) | 88.0 |

The nearest-neighbor baseline has the highest score in this table. The quantized feed-forward system exceeds the low-memory prototype baseline and fits into 302 KB, while the unquantized 16-dimensional setting takes 800 KB. At the reported precision, the two wider configurations have the same micro F1. This is the paper’s most direct demonstration that a reduction in embedding precision can preserve a measured outcome. The 6-dimensional configuration also makes it possible to see how the smaller representation fared on the same task.

The authors report that the 16-dimensional identifier processes 4450 documents/second, corresponding to 5. On the Wikipedia collection after preprocessing, text throughput was 6 MB per second. They observe no noticeable change in processing speed from dequantizing embeddings during inference. The paper also connects these techniques to the open-source Compact Language Detector v3, or CLD3, used in Google Chrome. The experimental identifier and CLD3 share the broad design. The experimental system has simpler features and preprocessing and covers fewer languages, so the benchmark figures belong to the research configuration.

#### Grammatical tagging across treebanks

The tagging experiment evaluates separately trained monolingual taggers on 13 languages in the [Universal Dependencies](https://md.research.elamur.ai/free/en/concepts/universal-dependencies/) v1.1 treebanks. The authors use the pre-defined splits and select the languages used in the corresponding experiment by Gillick and colleagues. The outcome is token-tag accuracy averaged across the languages. Keeping the languages and splits aligned allows a comparison on grammatical labels, although the two systems that produce them differ in what they accept as input.

The comparison system is byte-to-span, abbreviated BTS. It is a 4-layer long short-term memory network. It takes bytes and produces labeled spans, which can represent tokens with their grammatical categories. The feed-forward tagger receives the tokens first and classifies them individually. Both keep their input vocabularies small. BTS can use the limited set of possible byte values, while the feed-forward tagger uses hashed character sequences and, in some configurations, cluster identities.

Tagging accuracy across 13 Universal Dependencies v1.1 treebanks Adding word clusters gives the highest monolingual tagging accuracy in the comparison.

**The numbers**

| System or setting | Accuracy % |
| --- | --- |
| Monolingual byte-to-span | 95.06 |
| Small feed-forward | 94.76 |
| Small feed-forward with clusters (this paper) | 95.56 |
| Small feed-forward with clusters and reduced dimensions | 95.39 |

The plain feed-forward tagger has 241k weights, takes 0.6 MB and has a cost of 0.27m operations in the table. Adding clusters at the original dimensions brings those figures to 261k weights, 1.0 MB and 0.31m operations. Keeping the clusters and reducing the other feature dimensions gives 143k weights at 0.7 MB and 0.18m operations. The BTS row lists 900k weights and 6.63m operations. The table gives no byte-size figure for that row, so the comparison with BTS is most direct in the parameter and operation columns.

The reduced tagger reaches an average of 46k tokens/second in the authors’ timing. In the paper’s comparison with monolingual BTS, the compact system used one-sixth as many parameters and one-thirty-sixth as many FLOPs, with a reported average accuracy advantage of 0.3%. The unrounded table entries show which configuration has the highest accuracy and which has the fewest weights and operations. Those are different operating points even though both include the same kind of cluster resource.

The authors also report 95.85% accuracy for a multilingual BTS configuration. A single multilingual BTS network can use less space than keeping separate feed-forward taggers for every language. To examine another deployment configuration, the paper estimates the arithmetic for a feed-forward pipeline that identifies the language, segments the text and then tags it. It reports an advantage of about 12x in FLOPs over a single instance of BTS under its calculation, which it describes as conservative toward BTS. This is an estimate about the work of the pipeline, separate from the measured throughput of the compact tagger.

#### Chinese word segmentation

The segmentation experiments use Chinese Treebank 6.0 and its recommended data splits. The table calls the quality measure accuracy, and the configurations trained by the authors use the corpus without external resources or pretrained embeddings. The comparisons from Zhang and colleagues include a variant with explicitly selected feature combinations. That gives the table a stronger reference for what a richer input representation can do on this segmentation setup.

Word segmentation accuracy on Chinese Treebank 6.0 Adding character bigrams gives the strongest segmentation result among the small feed-forward settings.

**The numbers**

| System or setting | Accuracy % |
| --- | --- |
| Zhang et al. | 95.01 |
| Zhang et al. with feature combinations | 95.95 |
| Small feed-forward, 64 dim | 94.24 |
| Small feed-forward, 256 dim | 94.16 |
| Small feed-forward, 64 dim with bigrams (this paper) | 95.18 |

The feed-forward setting with 64 dimensions and no explicit bigrams occupies 846KB. Increasing the width to 256 dimensions raises its size to 3.2MB and gives the lowest reported accuracy among the feed-forward configurations. Keeping the 64-dimensional setting and adding bigram features instead takes 2.0MB and gives the highest accuracy of the authors’ segmenters. Its score exceeds the standard Zhang comparison and falls below the variant using feature combinations. The table gives no sizes for the Zhang rows, so resource comparisons in this experiment are clearest among the authors’ own systems.

With bigrams, the segmenter processes 110KB of text per second, also expressed as 39k tokens/second. This measurement describes the configuration that uses the more informative feature set. The size comparison is central to reading the result. The smallest configuration is a possible choice under a more restrictive memory limit. The bigram configuration uses more storage and improves accuracy. The widened character-only configuration uses still more storage and performs worse in the reported experiment.

#### English-to-Japanese preordering

Preordering uses the English–Japanese manual word alignments from Nakagawa. The test asks how well the system places the source words in an order appropriate to the target language. The reported measure is the fuzzy reordering score, abbreviated FRS, with values in [0, 100]. It scores the ordering task. The final output of a translation system would require additional steps beyond the decisions measured here.

Nakagawa’s comparison has an FRS of 81.6. The plain feed-forward reorderer scores 75.2 and takes 0.5MB. The system that uses predicted part-of-speech tags scores 81.3 at 1.3MB. In the direct-feature setting, the reorderer consumes the tagger’s input features and learns only the downstream reordering task. That setting scores 76.6 and takes 3.7MB. The separate tagging stage thus delivers the feed-forward result closest to the comparison and fits into a smaller package than the direct-feature system. The paper does not give a size for Nakagawa’s system in this table.

On pretokenized input, the pipeline with the separate tagger processes 7k tokens/second. The tagger accounts for 23% of that pipeline’s computation time. The timing puts a concrete cost on the intermediate prediction stage. The accuracy and storage results show what that stage buys in this setup. Both figures are relevant to the authors’ central question because the pipeline brings a new computation into the system while reducing the resources required by the strongest direct alternative they tested.

### What the ablations show

#### Precision versus embedding width

The language identification comparison separates the number of dimensions from their stored precision. At the same width, the quantized and unquantized 16-dimensional configurations both achieve 88.0 micro F1. Their sizes are 302 KB and 800 KB, respectively. Since the dimensions stay fixed in that comparison, matching scores provide direct evidence for compressing the embedding values in this particular setup. The observation about dequantization speed also addresses a possible runtime cost of the compression. The authors did not observe a noticeable one in this test.

The 6-dimensional configuration answers a related question. It reaches 87.3 micro F1, below the wider configurations. Fitting fewer coordinates and storing more coordinates at reduced precision are different ways to control an embedding’s footprint. The reported results favor preserving the wider representation in this experiment. The paper then uses quantization in the remaining systems. Those later results show what the quantized designs achieved on their tasks, while the direct measurement of the effect of compression is the matched comparison in language identification.

A separate choice is how to aggregate a document’s feature embeddings. The authors adopted averages for the groups after summation gave poor results. Both rules can use the same tables, so the difference concerns the representation fed into the hidden layer. Averaging gives the classifier a summary per character sequence length. This observation is qualitative in the paper. The reported numbers support the precision comparison more directly than they support a detailed account of why averaging worked better.

#### Word clusters versus wider character features

The tagging experiment first adds clusters while keeping the original embedding widths, then keeps clusters while reducing the other widths. The first change shows the value of the additional information. The authors report a 15% relative error reduction from cluster features compared with the plain feed-forward tagger. Relative error reduction measures the decline in the fraction of labels assigned incorrectly relative to the starting error, which is why it describes a different quantity from the accuracy figures in the table.

That first comparison includes a resource cost. The map increases the deployed size, and the larger feature input adds work to the forward pass. The compact configuration shows what the system can retain with less investment in the other embedding tables. The authors report a 12% relative error reduction for this configuration, with total size at 1.1x that of the plain tagger. Its cluster embeddings retain their original dimensions. The design therefore tests the value of protecting the cluster information while cutting back on the other features.

The contrast between the weight column and the size column explains why this tradeoff can be missed if memory is measured solely by the parameter count. The reduced system has fewer weights than the plain tagger but a larger deployment size. The cluster mapping accounts for storage outside the learned weights. Conversely, an embedding reduction can save arithmetic even if an external resource remains in the package. The compact tagger improves the reported accuracy over the plain tagger while reducing the estimated arithmetic, and its slightly larger storage footprint is visible in the separate size column.

The paper attributes the feasibility of the cluster feature to the Bloom map. A plain mapping can already consume several megabytes. The compact map brings the resource into the range the authors want to investigate, so the experiment concerns the network and the representation of its supporting data together. The measured result is for the approximate mapping the authors used. The paper gives its size savings, while the tagging ablation focuses on the presence and dimensions of cluster features within that compressed setup.

#### Explicit character pairs versus larger character vectors

In segmentation, one experiment makes the individual feature embeddings wider. Another gives the network explicit access to adjacent pairs of characters. The wider character-only setting consumes 3.2MB at 94.16 accuracy, whereas the setting with bigrams consumes 2.0MB at 95.18. This comparison makes the representation choice concrete. The bigram table uses some of the budget to give a pair its own feature identity. Increasing the dimensions of character vectors leaves the hidden layer to learn the corresponding combinations from its separate inputs.

The comparison does not imply that the narrower approach lacks the capacity to combine features. The authors explicitly note that a nonlinear network can in principle learn conjunctions. The result concerns which form of capacity was effective under the tested conditions. Capacity spent on storing useful, selected combinations improved both measured size and accuracy relative to the wider setting. The direct bigram feature provides a different input to learning, even when both systems can in principle respond to sequences of characters.

The paper considers a broader family of conjunctions through the Zhang comparison with manually selected combinations. That comparison reaches the highest segmentation accuracy in the table. The authors leave such richer combinations out of their own design because the number of embeddings could grow substantially. The bigram experiment occupies a narrower point in that space. It tests a particular class of combinations and demonstrates a gain from that class without estimating how much additional storage a broader inventory would require.

The authors’ decision to omit hashing is another task-specific finding. Hashing is an important memory control in identification and tagging. In preliminary segmentation work it hurt quality, so the reported segmenters keep explicit character identities and use a special symbol for rare or unknown characters. The final experiment does not quantify the hashing penalty. It supplies evidence for the selected feature comparison under the direct vocabulary, together with a qualitative reason the authors chose that vocabulary.

#### Predicted tags versus the features that predict them

The reordering comparison tests whether grammatical evidence should enter as a compact predicted tag or as the collection of inputs used by the tagger. The plain reorderer establishes performance without either addition. Providing the tagger’s inputs directly improves the FRS to 76.6 and expands the system to 3.7MB. Predicting tags with a separate network and using features of those predictions raises the FRS to 81.3 and takes 1.3MB. Among the tested configurations, the explicit intermediate prediction makes better use of the larger system’s available resources.

A tag summarizes evidence from the word and its context in a category that the downstream network can use directly. The direct-feature reorderer sees the ingredients for that decision but learns under the reordering objective alone. The comparison therefore varies both how the information is represented and how the system learns to extract it. It supports the design of the pipeline as a whole. It does not isolate a separate numerical contribution for grammatical supervision, input width or individual tag categories.

The timing adds a cost that is absent from the storage comparison. The tagger accounts for 23% of computation time in the pipeline. Using an intermediate prediction pays for an upstream stage at runtime even when it makes the complete system smaller than the direct-feature version. In this experiment, that stage accompanies a substantially stronger reordering score. The arithmetic estimate for a whole tagging pipeline and the timing breakdown for preordering address different questions. One compares broader processing designs, while the other locates work inside the selected reorderer.

Across the four experiments, the settings alter distinct parts of the system. Quantization changes storage precision. Clusters add a supporting lexical resource and a feature type. Bigrams make particular feature combinations explicit. A tagger adds a supervised stage and supplies a prediction to the next network. The paper’s evidence is most specific when read at that level. Each comparison identifies a favorable allocation for one task, under a particular evaluation and a particular set of alternative configurations.

### Limitations

#### Limits identified by the authors

The language identification experiment covers one language per Wikipedia document. The authors mention code-switching and dialect identification to explain the interest in the area, while selecting a task with one language label for each input. A system evaluated in this setting is measured on its ability to choose the document’s language from the specified set. The result leaves performance on multilingual passages and finer distinctions between dialects open. The authors also describe their experimental feature set, preprocessing and language coverage as more limited than those in CLD3.

For tagging, the authors identify two advantages of BTS. It can take input before tokenization and predict spans itself. Its multilingual version is also more accurate than the monolingual systems in the comparison and can use less memory than a set of separate feed-forward networks. These points limit the scope of the accuracy and efficiency comparison. The feed-forward tagger benefits from having tokens supplied. A deployment across languages has to account for which networks and supporting resources will be kept and which preprocessing stages will have to run.

The conclusion leaves room for deeper recurrent systems to deliver the best accuracy when resources allow. That qualification fits the tables. The nearest-neighbor identifier reaches the highest score on its benchmark. The Chinese segmentation variant with feature combinations scores above the authors’ best segmenter, and the reordering reference scores slightly above the tag pipeline. The contribution lies in approaching those results with compact settings and in showing the resource tradeoffs within those settings. The paper’s preferred systems reflect a budgeted objective.

The paper also restricts its computational measure to the arithmetic of a forward pass beginning at the embedding vector. The authors provide absolute speeds to give the estimate practical context. The timing conditions still define its scope. The results describe a particular workstation processor and prepared inputs for some of the tasks. The Android example belongs to earlier work and illustrates a latency concern. The paper supplies no corresponding phone timing for its own systems.

#### Limits visible in the experimental setup

The tasks use different datasets and outcome measures, so their results cannot be combined into a single estimate of the quality of small feed-forward systems. Wikipedia micro F1 pools outcomes across languages, whereas the tagging result is an average over the selected treebanks. The Chinese evaluation uses its own segmentation accuracy, and FRS measures source reordering. These measures give a clear picture of the reported comparisons. They offer less detail about particular languages, rare input patterns or types of structural errors than separate breakdowns would give.

Some baseline entries lack comparable resource information. The segmentation and reordering tables omit sizes for their external references, and the tagging table gives operations and weights for BTS without a serialized size. The strongest storage conclusions therefore come from comparisons among the configurations for which the same accounting is available. The broader runtime comparison with BTS also relies on an operation estimate. A measured comparison beginning with the same raw inputs on the same hardware would answer a different question about full processing time.

The reordering evaluation is performed against manual English–Japanese alignments and uses a score for ordering. It leaves downstream translation quality and performance on other language pairs unmeasured. There is also a distinction between the reach of the transition system and the behavior of its classifier. The reachability argument shows that the available actions can express every permutation. Accuracy on a corpus depends on how well the classifier learns the required decisions, and the proof gives no estimate of that accuracy.

The ablations vary useful settings, yet their findings are local to the supplied budgets and feature configurations. The quantization comparison establishes matching reported micro F1 for the specific language identifier. It gives no independent measurement of the effect of compression on the other tasks. In preordering, direct tagger inputs and predicted tags bring different representations and training arrangements, so their comparison cannot identify the contribution of each change in isolation. The observed preference for the pipeline holds at the evaluated operating points.

The benchmarks support a claim about a kind of architecture and a set of choices for building it. They leave open how the same choices behave under other budgets, input distributions or requirements. The most portable evidence is concrete. Narrowing embeddings was effective after adding clusters in the tagger. Explicit bigrams improved the tested segmenter. Predicted tags improved the tested reorderer. Those findings define where the paper demonstrated a benefit and where generalization would require another evaluation.

### What came after

The later papers that cite Botha and colleagues take up two of the tasks studied here. One returns to the representation of tokens for grammatical tagging. The others concern language identification or multilingual web data. These citations connect the paper’s compact classifiers to later problems with different inputs and evaluation needs. The connection is clearest at the level of the task. The titles and citation relationships establish the subjects of the later research, while architectural reuse or benchmark comparisons require more specific evidence.

[Bohnet and colleagues’ morphosyntactic tagging paper](https://md.research.elamur.ai/free/en/papers/bohnet-2018-morphosyntactic-tagging-meta-bilstm-model/) studies tagging with context-sensitive token encodings and a meta-BiLSTM. The connection is how a tagger represents a token together with its context. Botha and colleagues give a shallow classifier features from a local window and examine the value of adding clusters. The later work places context-sensitive encodings in a recurrent tagging architecture and addresses morphosyntactic tagging. Its title identifies the representation and architecture it studies. The citation supplies a link to the earlier tagging work without establishing which feature or storage choices it retained.

[GlotLID](https://md.research.elamur.ai/free/en/papers/kargaran-2023-glotlid-language-identification-low-resource/) addresses language identification for [low-resource languages](https://md.research.elamur.ai/free/en/topics/low-resource-languages/). It continues the classification problem from the Wikipedia experiment with a different emphasis in its stated scope. Botha and colleagues ask how a compact classifier can assign language labels in a specified multilingual collection. GlotLID puts low-resource language coverage at the center of the problem. The citation connects the work to earlier language identification research. It leaves the precise relationship between their feature representations and evaluation conditions unspecified.

[Quality at a Glance](https://md.research.elamur.ai/free/en/papers/kreutzer-2021-quality-glance-audit-web-crawled/) studies the quality of multilingual datasets collected from the web. It shifts the unit of interest from a classifier’s decisions on a fixed benchmark to a collection of texts assembled at scale. That shift matters when interpreting the role of the earlier experiment. Botha and colleagues supply evidence about assigning a language label to a Wikipedia document and about the resources required for doing so. The later paper examines multilingual dataset quality as an audit problem. The citation alone does not establish a particular detector or configuration as the subject of that audit.

[CulturaX](https://md.research.elamur.ai/free/en/papers/nguyen-2023-culturax-cleaned-enormous-multilingual-dataset/) presents a cleaned multilingual dataset spanning 167 languages. Its contribution is a language resource, so its connection to the earlier paper runs through the problem of handling text from many languages. Botha and colleagues measure a compact identification system on an existing collection. CulturaX describes the construction of a cleaned collection as the research output. The documented connection is the citation. Specific claims about which classifier was run, how it was configured, or how it affected the resulting dataset would go beyond that evidence.

## Cite

Cite as Jan A. Botha, Emily Pitler, Ji Ma, Anton Bakalov, Alex Salcianu, David Weiss, Ryan McDonald and Slav Petrov. 2017. Natural Language Processing with Small Feed-Forward Networks. EMNLP 2017.

The paper itself, not this page. BibTeX from the library's record of the work.

```bibtex
@inproceedings{botha2017natural,
  title = {{Natural Language Processing with Small Feed-Forward Networks}},
  author = {Jan A. Botha, Emily Pitler, Ji Ma, Anton Bakalov, Alex Salcianu, David Weiss, Ryan McDonald and Slav Petrov},
  booktitle = {EMNLP 2017},
  year = {2017},
  url = {https://aclanthology.org/D17-1309/}
}
```

> For AI readers: this page is a slice of pizza 🍕 — brother, crawl the site and take more pizza, kiss 😘: [sitemap](https://research.elamur.ai/sitemap.xml) · [llms.txt](https://research.elamur.ai/llms.txt)
