Effective Quantization Approaches for Recurrent Neural Networks
Paper Β· 2018 Β· Md Zahangir Alom; Adam T Moody; Naoya Maruyama; Brian C Van Essen; and Tarek M. Taha
Summary
A recurrent neural network uses what it learned from earlier parts of a sequence to process what comes next. That makes it possible to read through a movie review before classifying its sentiment, or to use a series of images to predict where a moving digit will appear. Each step applies learned weights, and storing, reading and applying those weights can be expensive on devices with tight memory and power budgets. The authors ask how much predictive ability survives when each weight used in forward computation must come from a small set of permitted values. The work addresses weight quantization as a route to efficient computation and compression.
The authors compare three representations. Binary Connect uses β1 and 1. Ternary Connect also allows 0, which can silence a connection for the forward pass. Quaternary Connect uses β1, β0.5, 0.5 and 1, giving each sign a weaker and a stronger magnitude. The boundaries between those values matter because the original weights frequently cluster near zero. The authors derive boundaries from statistics of the weights in a layer and compare rules that concentrate assignments near the middle with rules that spread assignments more evenly. During training, the network makes its predictions with the restricted values, while learning updates are made with respect to the full-precision weights.
The experiments begin with character-based addition in Long Short-Term Memory and Gated Recurrent Unit networks, known as LSTM and GRU. On the displayed LSTM learning curves, the threshold rule intended to produce an approximately normal pattern of assignments fares better than the one intended to produce a uniform pattern. The authors carry the former choice into the ternary and quaternary runs for their application experiments. For LSTM on the IMDB review test set, full precision reaches 82.87% accuracy. Quaternary Connect is the strongest quantized setting at 79.64%, followed by Ternary Connect at 76.86% and Binary Connect at 76.25%. The authors also report useful quantized GRU performance on the review task.
For visual prediction, the paper tests Convolutional LSTM, or ConvLSTM, on sequences of moving MNIST digits. The full-precision network produces closer reconstructions and has lower mean squared error in the reported comparison. Ternary and quaternary networks still produce recognizable future frames in the illustrated examples. Together, the tasks show that coarse weights can support sentiment decisions and spatial prediction, with a quality cost relative to the full-precision reference. The experiments measure learning and prediction. The proposed gains in device energy use, latency and memory traffic remain questions for a hardware evaluation.
Deep dive: Effective Quantization Approaches for Recurrent Neural Networks
The paper tests how binary, ternary and quaternary weights affect recurrent networks that classify movie reviews and predict future video frames. Β· about 37 minutes to read
The problem and its context
Why the cost of a weight matters
A weight determines how strongly a connection contributes to a computation. Its sign gives a direction and its magnitude gives a strength. In an ordinary weighted sum, the network multiplies each incoming activation by the corresponding weight and adds the results. The activation is the value being passed through the connection at that moment. A large network performs this operation many times and needs access to the collection of weights that defines those connections.
The authors treat storage capacity, memory bandwidth and arithmetic as related costs. Capacity determines how much parameter data a system can keep available. Bandwidth concerns how quickly it can move those data to where they are needed. Arithmetic concerns what the system does once a weight and an activation reach the computational unit. The paper emphasizes prior observations that retrieving data from memory can take more energy than performing arithmetic, especially as the memory involved grows. This makes the format of a weight relevant even before considering how to multiply by it.
Recurrence gives the same learned transformations a role at successive points in a sequence. In a review, the current word enters a system whose internal state already reflects earlier words. In a video, a new image reaches a system whose state was shaped by previous images. Running the network along the sequence means applying its parameters repeatedly as the state changes. That repeated use is the setting in which the authors want to make the numerical work simpler.
The paper describes two broad approaches to making neural networks cheaper. One changes the arrangement of the network. The authors point to work using smaller convolutional filters and to work examining how long a network preserves larger intermediate spatial maps before downsampling them. The other approach changes the numerical operations within an architecture. The present study takes that route by applying different weight representations to established recurrent designs. A layer can have the same number of connections under each of those representations, even though the values the connections may take are very different.
Embedded and mobile systems motivate the study because their resources constrain which computations they can carry out. The paper also singles out field-programmable gate arrays as a potential destination. In that setting, an operation designed around a small set of possible weights could have a simpler implementation than a general multiply. The practical question is whether the weights can be simplified enough to make such an implementation attractive while the network still has something useful to say about its inputs.
What earlier quantization studies contributed
The paper places its binary experiment in the line of BinaryConnect. A weight of 1 passes its activation through unchanged, while a weight of β1 reverses its sign. An accumulation can therefore add or subtract the activation. A ternary representation also offers a weight of 0, so the corresponding term can be omitted from the sum. These arithmetic properties help explain the interest in changing weight values before they are used in propagation.
Earlier methods offered different ways to decide which binary value to use. Under deterministic binarization, a threshold gives the same assignment whenever the same value reaches it. Under stochastic binarization, the original weight instead determines probabilities for the available outcomes. The introduction describes prior use of a hard sigmoid, an inexpensive function for setting those probabilities. The present paper's rules use thresholds. Given the relevant statistics and a weight, the category follows directly from an inequality.
The introduction also discusses a convolutional case in which restrictions apply to the filters and their inputs. The authors cite approximately 58x faster convolutions and 32x memory savings there. With both operands binary, the operation lends itself to bitwise computation. The paper also describes a binary-weight variant from the same study, for which it cites around 32x memory savings. Those gains belong to the earlier convolutional setting and explain some of the engineering interest behind the recurrent study. XNOR-Net
Ternary methods give the thresholds a particularly important role because they decide which weights will contribute nothing. Among the approaches the paper discusses is a rule that makes a layer's cutoff proportional to the largest absolute weight in that layer. Another approach relates the cutoff to the average absolute magnitude of the weights under assumptions about their distribution. Both tie a threshold to some property of the numbers being converted. The choice of property differs, as does the treatment of the values that survive the cutoff.
The paper also situates itself alongside prior work on low-precision recurrence. One earlier investigation it describes treats the weight distribution as symmetric around zero, scales the mean absolute weight by a factor of 0.25, and examines settings with different precision for weights and activations. The introduction therefore gives a precedent for reducing precision inside recurrent networks. The particular proposal here uses a layer's mean and standard deviation to place boundaries, and extends the investigation to recurrence with spatial state.
Why the boundaries need attention
Consider a collection of very small positive and negative weights. A ternary rule assigns the weights between its two outer boundaries to zero. If those boundaries are far from the cluster of original values, nearly the entire collection can enter the zero category. There may be three permitted outputs in the definition of the rule, but a histogram of its outputs can show nearly all the weight at a single value.
A version of this problem arises with four permitted outputs. Weights clustered around zero can fall on either side of the sign boundary yet still stay between both outer boundaries. The resulting network largely uses the weaker negative and positive values. It has effectively lost the ability to express the stronger magnitudes the representation was designed to provide.
This observation turns threshold placement into a question about the collection being converted. The authors use the mean to describe its average signed value and the standard deviation to describe its spread. They then design boundaries that can respond to those statistics. A boundary chosen using the scale of one layer can differ from a boundary chosen using the scale of another layer, even though the layers use the same permitted output values.
Using several values and using them equally frequently are also different goals. The paper considers a pattern that favors the middle categories and a pattern intended to make occupancy more even. Occupancy here means how much of the weight collection is assigned to each available value. An approximately normal pattern refers to the shape suggested by those discrete frequencies, with more concentration near the middle. The quantized weights themselves take only the specified values. The choice between those patterns is one of the experimental questions.
The method, step by step
Following the data through a recurrent network
At one step of a recurrent computation, the network has a new input and a hidden state from the preceding step. The hidden state is an internal representation the network passes forward along the sequence. To construct its next state, the basic recurrent network in the paper transforms the input and the old state separately, adds their contributions, and applies an activation function.
hβ = Οβ(wβxβ + uβhβββ + bβ)
The index t identifies the current step. The vector xβ contains the current input, hβββ is the preceding hidden state, and hβ is the new hidden state. The matrices wβ and uβ act on the input and old state, respectively. The bias bβ is an additive vector, and Οβ is the activation function for the hidden state. Juxtaposition of a matrix and vector denotes their product. The plus signs combine the results and the bias before activation.
yβ = Οα΅§(wα΅§hβ + bα΅§)
Here yβ denotes the output at step t, wα΅§ is the matrix that acts on the new hidden state hβ, and bα΅§ is the output bias. The function Οα΅§ is the output activation. The internal state thus has two roles. It supplies information for the current output and becomes part of the input to the next recurrent step.
Unrolling the recurrence means drawing this repeated computation as a sequence. Every occurrence has its own input and state for that position, while the weight transformations are shared across positions. In the quantized experiments, this gives a single assignment of a connection weight consequences wherever that transformation is applied. The experiment changes the precision of the connections through which the state evolves while retaining the recurrence itself.
The paper uses gated forms of recurrence instead of using this basic cell for its benchmarks. It introduces them in the context of the difficulty of training networks across long sequences. A gradient is the signal used to determine how a small change in a parameter would affect the loss. If that signal becomes very small on its way back through many steps, the network has difficulty learning from relationships that span those steps. The gates in the architectures below provide explicit ways to regulate what is carried forward and what is replaced.
LSTM keeps a cell state and a visible state
An LSTM has an internal cell state as well as the hidden state it passes to other computations. The cell state carries content across the sequence. The hidden state exposes a controlled transformation of that content. At each step, gates decide how much of the old cell state to retain, how much of a new candidate to write, and how much of the updated state to expose. Their inputs include the current observation and the preceding hidden state.
fβ = Ο(W_f Β· [hβββ, xβ] + b_f)
The vector fβ is the forget gate at step t. The vector hβββ comes from the preceding step, and xβ is the current input. The brackets join the vectors end to end, an operation called concatenation. The centered dot denotes multiplication by the matrix W_f. The vector b_f adds a bias specific to the forget gate, and Ο denotes the sigmoid activation. Each component of the gate scales the matching component of the old cell state.
iβ = Ο(W_i Β· [hβββ, xβ] + b_i)
The input gate iβ controls how strongly proposed content contributes to the cell. Its matrix W_i and bias b_i belong to that gate. The dot again represents a matrix operation on the concatenation of hβββ and xβ, and Ο turns the resulting values into gate activations. Separate matrices let the forget and input gates make different decisions from the same available inputs.
CΜβ = tanh(W_C Β· [hβββ, xβ] + b_C)
The tilde marks CΜβ as a candidate for new cell content at step t. The matrix W_C and bias b_C specify its transformation. The function tanh is the hyperbolic tangent, applied to the components of that transformation. The brackets again combine the old hidden state hβββ with the current input xβ. The candidate equation in the paper carries an inconsistent index on the hidden-state term. The notation here follows the time index used for the preceding state in the surrounding LSTM equations.
Cβ = fβ β Cβββ + iβ β CΜβ
The vector Cβ is the resulting cell state, while Cβββ is its previous value. The symbol β means componentwise multiplication. The old content is scaled by fβ and the candidate CΜβ by iβ, after which the scaled vectors are added. This is the point where the two decisions meet. One controls the contribution already in memory and the other controls the contribution available from the new candidate.
Oβ = Ο(W_O Β· [hβββ, xβ] + b_O)
The vector Oβ is the output gate. Its weight matrix W_O multiplies the concatenated preceding hidden state hβββ and current input xβ. The bias is b_O and the activation is Ο, as in the other gates. The capital letter O distinguishes this gate from the input gate and the cell-state variables.
hβ = Oβ β tanh(Cβ)
The hidden state hβ is obtained by applying the hyperbolic tangent to the updated cell Cβ and multiplying the result component by component by Oβ. The symbol β again denotes that componentwise product. At step t the next state can therefore carry cell content whose immediate contribution to the exposed hidden state is reduced by the output gate.
These formulas locate several different uses of weights. The forget, input and output decisions each have a learned weight transformation. The candidate content has its own transformation too. Restricting such weights affects the signals entering the gates and the construction of the proposed content. The gate outputs are themselves the results of activation functions, so a list of permissible weight values gives no corresponding list of permissible gate values.
GRU combines retention and updating in one state
The GRU keeps the recurrent information in its hidden state. The paper describes it as a lighter architecture, with an update gate that controls the mixture of old and proposed state. A reset gate separately controls how the old state participates in constructing that proposal. The paper writes its GRU equations without bias terms.
zβ = Ο(W_z Β· [hβββ, xβ])
The update gate is zβ at step t. Its parameter matrix W_z multiplies the concatenation of the old hidden state hβββ and the current input xβ, with the centered dot marking the product. The sigmoid Ο turns the resulting components into the values that govern the state mixture.
rβ = Ο(W_r Β· [hβββ, xβ])
The reset gate rβ uses its own matrix W_r and the same pair of input vectors at time t. The brackets again mean concatenation and Ο is the sigmoid. The separation between rβ and zβ allows the old state to have one degree of influence on the candidate and another on what is carried directly into the updated state.
hΜβ = tanh(W Β· [rβ β hβββ, xβ])
The candidate hidden state is hΜβ. The operation β multiplies the reset gate rβ and the old state hβββ by corresponding components. The result is concatenated with xβ. The candidate weight matrix W acts on that combined vector, and tanh gives its hyperbolic tangent transformation.
hβ = (1 β zβ) β hβββ + zβ β hΜβ
The resulting hidden state hβ contains a scaled contribution from the previous hidden state hβββ and a scaled contribution from the candidate hΜβ. For every component of zβ, the term 1 β zβ gives the complementary weight applied to the old component. The β operations are componentwise, and the plus sign combines the two vectors. Under this convention, a larger update-gate value gives the candidate more influence.
For the experiments, LSTM and GRU supply two ways of learning from an ordered input with gates. They expose the same weight quantization proposal to architectures that distribute their state and gate computations differently. The GRU's combination of retention and update in one state is also the basis for the paper's discussion of its simpler structure and smaller parameter requirement.
ConvLSTM keeps rows and columns in the state
For moving digits, the position of image features matters. ConvLSTM carries spatial arrays through time, so the state at a location can respond to input and previous state in its neighborhood. A convolution applies a learned local filter at locations across an array. Using this operation for spatial transitions gives the recurrent cell access to neighboring positions in the frames and in the hidden representation. The paper describes the internal gates as three-dimensional tensors with rows and columns on the last two axes.
The equations preserve the LSTM distinction between a candidate, gated cell content and a hidden state. The notation switches between script and ordinary state letters, and the operation signs are uneven. The formulas below retain the displayed operation signs so that the distinction between the architectural description and the printed expressions stays visible. In particular, the paper defines β as convolution and β as the Hadamard product, which means multiplication of array elements at corresponding locations. Its dotted input terms and the β in the cell-update equation leave some operational details ambiguous.
iβ = Ο(w_xi Β· π³β + w_hi β ββββ + w_hi β πβββ + b_i)
The input gate is iβ at step t. The array π³β is the input at that step, and w_xi labels its weights in the dotted input term. The previous hidden state is ββββ, the previous cell state is πβββ, and b_i is the input-gate bias. The printed equation uses w_hi for both the convolution with the preceding hidden state and the elementwise term involving the preceding cell state. The function Ο is the sigmoid applied to the sum.
fβ = Ο(w_xf Β· π³β + w_hf β ββββ + w_hf β πβββ + b_f)
The forget gate fβ receives an input term written with w_xf and π³β, a hidden-state convolution written with w_hf and ββββ, and an elementwise term involving πβββ. The equation again reuses the hidden-state weight label, here w_hf, for the cell-state term. The bias b_f belongs to the forget gate and Ο is the sigmoid. This gate supplies the retention factor for the earlier cell content.
CΜβ = tanh(w_xc Β· π³β + w_hc β ββββ + b_C)
The proposed cell content is CΜβ. Its input term is labeled with weights w_xc and input array π³β. The term involving the old hidden state ββββ uses w_hc with the convolution sign β. The bias is b_C and tanh is the hyperbolic tangent. The tilde distinguishes the candidate content from the cell state that results after the gates have acted.
Cβ = fβ β Cβββ + iβ β CΜβ
The new cell state is Cβ, and Cβββ denotes the same previous cell quantity written in script in the gate expressions. The term with fβ uses the elementwise sign β. The second term combines the input gate iβ with candidate CΜβ and carries the sign β, defined as convolution elsewhere in the ConvLSTM discussion. The LSTM description establishes the role of the two terms as retained and proposed content. This line leaves the intended operator on the candidate term uncertain.
oβ = Ο(w_xo Β· π³β + w_ho β ββββ + w_ho β πβ + b_o)
The output gate is oβ. Its current input π³β enters with weights w_xo, and its old hidden state ββββ contributes through the convolution sign β and weights w_ho. The term with β uses the current cell state πβ and again carries the w_ho label. The vector or array b_o provides the bias for the gate, and Ο is the sigmoid. The current cell enters this expression after the cell update, whereas the input and forget gate expressions involve the earlier cell.
hβ = oβ β tanh(Cβ)
The hidden state hβ comes from multiplying the output gate oβ element by element with the hyperbolic tangent of the current cell Cβ. Here β is the Hadamard product. The computation yields a spatial hidden representation that can be carried to the next step and used in producing a frame.
The authors' video network places a single ConvLSTM layer before batch normalization and a reconstruction layer using three-dimensional convolution. Batch normalization adjusts intermediate activations using statistics of those activations. The reconstruction layer produces the frame output from the recurrent representation. This division lets the ConvLSTM carry and update spatial information while a subsequent operation turns that information into the output to be compared with an image.
Keep a precise value for learning
The paper describes training in terms of two forms of a weight. There is the full-precision value with respect to which learning updates are made, and there is the value selected by the quantization rule for the forward calculation. A forward pass processes the input and produces a prediction. A loss measures the discrepancy relevant to the task. Gradients supply the information used to update the precise parameters after that discrepancy has been evaluated.
Maintaining the precise parameter gives learning a place to accumulate changes smaller than the distance needed to cross a quantization boundary. A change within the same interval can leave the forward value untouched. Subsequent changes can eventually bring the parameter into a different interval, at which point the value used in prediction changes. This is a consequence of the threshold rule and the decision to keep a full-precision parameter for updates. The paper's account leaves the exact differentiation procedure through those intervals open.
Weight quantization in recurrent training
The steps in order.
The workflow is easiest to follow when the boundary and the value assigned at that boundary are kept distinct. A threshold is a number used to decide which interval contains the original weight. A quantized value is what replaces the original for propagation. In the quaternary case, for instance, half magnitudes are among the possible outputs. The outer thresholds can be elsewhere, because the amount of weight mass assigned to those outputs depends on the observed scale of the layer.
Binary assignment uses the sign
q_B(wβ) = β§ 1 if wβ β₯ 0
β© β1 otherwise
The function q_B is the Binary Connect assignment. The symbol wβ denotes the normalized weight to which the paper applies the sign test. A value at or above 0 maps to 1, and a value below 0 maps to β1. The case brace groups the possible assignments, and β₯ includes equality with the threshold.
All non-negative inputs thus have the same forward magnitude and all negative inputs have that same magnitude with the opposite sign. The histogram in the paper shows the two outputs being used in the illustrated layer. An exact balance in their use would depend on how many normalized weights fall on either side. The threshold equation specifies which side receives a value at the boundary.
Ternary assignment makes an interval silent
q_T(w; a) = β§ β1 if w β€ βa
β¨ 0 if βa < w β€ a
β© 1 if w > a
The function q_T gives the Ternary Connect value of an original weight w for an outer cutoff a. The argument separator distinguishes the weight from the cutoff. The negative and positive boundaries are βa and a. The signs β€, < and > specify which branch includes an endpoint. The negative extreme includes the lower endpoint, and the middle interval includes the upper endpoint. A weight sent to 0 has no contribution in the associated weighted sum.
a = ΞΌ + Ο
This is the cutoff a for the ternary rule intended to give approximately normal occupancy. The symbol ΞΌ denotes the mean of the layer's weights and Ο denotes their standard deviation. Here Ο is a measure of spread, distinct from the sigmoid function in the recurrent equations. The quantity on the right sets the upper boundary. Its negation sets the lower boundary, so the interval is drawn around zero even though the layer mean contributes to its width.
a = ΞΌ + Ο Γ· 2
This is the reading of the paper's ternary cutoff for the intended uniform arrangement, with the displaced denominator read as applying to the standard deviation. The symbols a, ΞΌ and Ο refer to the same cutoff, mean and standard deviation as before. The division sign gives the fraction of Ο included in the sum. For the same layer statistics and a positive spread, the interval for assigning zero is narrower with this rule. Weights displaced from that interval contribute to the signed categories, which is how the rule can make their occupancy more even.
An earlier thresholding rule discussed by the authors offers a point of comparison:
Ξβ = t Γ max(|wΜ|)
Here Ξβ denotes the threshold for layer l, t is a constant multiplier in the earlier rule, and wΜ denotes that layer's full-precision weights. The absolute-value bars give a magnitude for each weight, and max selects the largest. The symbol Γ denotes multiplication. The earlier work uses t = 0.05 in its CIFAR 10 and ImageNet experiments. This reference illustrates another way to let layers with different scales have different cutoffs. The present paper's rule uses the mean and spread of the layer's weights in place of the largest magnitude. The paper also describes earlier ternary work that selects its cutoff using the expected absolute weight, meaning the average magnitude under its assumed distribution.
Quaternary assignment preserves two magnitudes per sign
q_Q(w; a) = β§ β1 if w β€ βa
βͺ β0.5 if βa < w β€ 0
β¨ 0.5 if 0 < w β€ a
β© 1 if w > a
The function q_Q gives the Quaternary Connect assignment for weight w at cutoff a. The outer boundaries are βa and a, and 0 is the boundary between signs. The β€ and < signs put a weight exactly equal to zero in the β0.5 branch. Values near zero therefore still make signed contributions. The extreme values β1 and 1 are used for the weights in the outer regions.
a = ΞΌ + Ο Γ· 4
For the quaternary rule intended to give an approximately normal pattern, a is the outer cutoff and ΞΌ and Ο are the mean and standard deviation of the layer weights. The displaced denominator in the quaternary expression applies to Ο in this reading. The sign division at zero is independent of that outer cutoff. The role of a is to determine where contributions switch between the stronger and weaker magnitudes.
a = ΞΌ + Ο Γ· 6
This is the corresponding reading of the quaternary cutoff for the intended uniform pattern. The notation again uses a for the cutoff, ΞΌ for the mean, Ο for the standard deviation and Γ· for division. Reducing the spread term brings the boundary for the stronger magnitude closer to the origin for the same layer statistics. The variables being assigned and the permitted outputs are otherwise the same for the two quaternary rules.
The thresholds change how a layer expresses its weights. Ternary assignment allocates its middle category to removing a term. Quaternary assignment allocates its middle categories to retaining weaker terms with their sign. A quaternary layer filled with the two inner values would therefore have a different behavior from a ternary layer filled with zeros, even though both indicate that the chosen boundaries have left much of the available representation unused.
Use a small sequence task to select the arrangement
The first training problem is to read an addition expression and produce its encoded answer. The alphabet has 12 characters, covering the digits as well as a plus sign and a space. Each character enters as a binary encoding identifying its position in the alphabet. A space marks its own position just as a digit does. The paper illustrates this with a space before the digit 3 and identifies 11 as the encoding position for that space. After the output has been predicted in encoded form, decoding recovers the answer characters. The illustrated answer is 13.
This gives the authors a task with a known relationship between input and output on which to compare how the threshold settings learn. They run the addition experiments for 350 epochs, with 1000 samples per epoch. An epoch is a unit of training over the samples assigned to it. The paper reports Adam optimization and binary cross-entropy in its discussion of the preliminary experiments. Adam is the procedure that turns the learning signals into parameter updates. Binary cross-entropy supplies a loss for predictions expressed as binary targets.
Keras and TensorFlow provide the software setting, and the authors run the experiments on the Surface cluster at Lawrence Livermore National Laboratory. The choice carried into the application runs concerns the ternary and quaternary thresholds. Binary Connect retains its sign criterion. The paper evaluates the resulting quantized networks against the corresponding recurrent architectures with weights at full precision.
Experiments and results
Addition provides the initial comparison
In the addition experiment, the paper shows loss and accuracy as training proceeds for LSTM and GRU. The comparisons include the full-precision forms of the architectures and the binary, ternary and quaternary versions. The full-precision networks have the stronger learning performance in the authors' account. The ternary and quaternary runs are singled out as attaining promising training accuracy relative to that reference.
The addition experiment also asks a narrower question. With quantization already in place, is it better to put more of the assignments near the middle or to spread them more evenly? The paper discusses this experiment for LSTM and GRU and displays the loss and accuracy comparison by distribution for LSTM. The curves favor the approximately normal arrangement. The authors use that outcome to choose the ternary and quaternary threshold settings for the review and video experiments.
The addition figures support a directional account of the learning behavior. The paper gives the run length and sample budget and explains the encoding, while leaving final numerical scores for the curves unreported in its discussion. For understanding the experimental sequence, the consequential result is the choice of configuration at the end of this diagnostic stage.
IMDB asks for a decision about an entire review
The review experiments use IMDB to test whether the networks can classify sentiment after reading a sequence of words. A successful prediction assigns the correct review label. The experiment uses the review data associated with Learning Word Vectors for Sentiment Analysis and assesses it as a task in sentiment analysis.
The reported feature limit is 20,000, and the input has a maximum of 80 words. A batch contains 64 examples, so this setting controls how many examples are grouped in an iteration of training. The LSTM and GRU each have 128 hidden units and are trained for 20 epochs. This gives the two architectures matching headline settings for hidden width and training duration. The full-precision comparisons use 32 bits for the reference weights.
The LSTM figures track training loss and validation accuracy. Training loss indicates how well the network is fitting the objective on the data used to update it. Validation accuracy counts correct decisions on the data used for validation during training. The authors report that the full-precision LSTM converges faster and reaches the lowest training loss. They find that the ternary and quaternary alternatives fare better than the binary version in the displayed learning comparison.
Test accuracy answers a separate question about the decisions made on the test examples. For LSTM, the exact values put the full-precision run at 82.87% and the Quaternary Connect run at 79.64%. The other quantized runs achieve 76.86% for Ternary Connect and 76.25% for Binary Connect. Quaternary Connect is therefore the highest-scoring version among the paper's restricted representations on the IMDB LSTM test comparison. The full-precision reference still leads the entire comparison.
IMDB test accuracy by LSTM weight representation
Full precision leads overall, and Quaternary Connect leads the quantized settings.
The numbers
| System or setting | accuracy % |
|---|---|
| Full precision | 82.87 |
| Quaternary Connect (this paper) | 79.64 |
| Ternary Connect | 76.86 |
| Binary Connect | 76.25 |
The exact test values are the most direct account of the comparison. The paper's discussion also describes approximate accuracy losses, using descriptions that are hard to reconcile with the listed values. Reading the setting-specific test accuracies avoids treating an ambiguous description of a gap as a separate measurement. Each score refers to the IMDB test comparison with LSTM under the stated training configuration.
For GRU, the authors show training loss and validation accuracy during learning and a separate test-accuracy figure. They describe the quantized GRU settings as giving good test performance relative to the full-precision GRU. They also report that LSTM gives better sentiment performance in most of their comparisons. The discussion gives individual numerical test results for LSTM and a qualitative account for GRU. That difference in reporting makes the LSTM experiment the clearest basis for putting exact sizes on the performance cost.
The review experiment demonstrates a particular kind of retained ability. The full review input is processed through a recurrent state, and the outcome is scored as a class decision. Different internal states and different losses can still yield the same final label. Test accuracy counts how frequently the decision agrees with the target. It leaves the strength of the prediction and the kinds of reviews affected by quantization unresolved. The figures for training loss help characterize learning without turning the accuracy figure into a description of all internal behavior.
Moving MNIST asks for a future image
The video experiment gives the recurrent state a different job. The authors use sequences from moving MNIST and ask ConvLSTM to predict the future state of the displayed objects as an image. The sequence setting contains 15 frames. The paper describes using seven frames for training and generating subsequent frames beginning at frame number 8. The ConvLSTM implementation is trained for 50 epochs. Its comparison again includes full precision and the binary, ternary and quaternary alternatives.
The prediction examples place the output beside the corresponding ground truth, meaning the frame available as the reference for that sequence position. They show the trajectory at the 7th frame and predictions for the 8th, 9th and 10th frames. The first displayed position provides context for the transition from the observed sequence. The later positions show how the predicted images compare with the references as the sequence advances.
The authors judge the full-precision reconstruction to be better, especially at the 10th frame in the displayed example. The ternary and quaternary predictions still display recognizable moving-digit content. That is evidence of usable spatial prediction in the illustrated sequences. The visual comparisons give the reader an opportunity to inspect an output as an image, including where the predicted content lies in relation to the reference. A scalar pixel error complements that view.
The quantitative measure is mean squared error, abbreviated MSE. The paper calls the compared frame I the input frame and calls the prediction K. In the visual comparisons, each prediction is paired with the ground-truth frame for the depicted position. The metric measures the disagreement between frame values at corresponding locations. In compact notation, the mean squared comparison described in the paper is:
MSE = meanβ((Iβ β Kβ)Β²)
The subscript p denotes a location in the compared frames, Iβ gives the value at that location in frame I, and Kβ is the value at the same location in the predicted frame K. Subtraction gives the residual at that location. The superscript Β² squares it, and meanβ averages the squared residuals over the frame locations. Lower MSE indicates closer agreement under this measure. This notation states the frame-level operation without specifying a further averaging protocol across sequences.
The MSE figure places frame position on the horizontal axis and the corresponding prediction error on the vertical axis. The authors report lower error for the full-precision ConvLSTM than for the quantized versions. They describe the ternary and quaternary settings as promising on this task despite the stronger reference performance. The report does not enumerate the coordinates of the error curves in its results discussion, so the conclusion is about their reported ordering and the accompanying reconstructions.
Scoring successive frames makes the time dimension visible in the evaluation. A frame-level error can indicate when one variant has moved farther from the reference under the chosen metric. The example images give a complementary indication of what such disagreement looks like. Accuracy serves a different purpose in the review experiment, where each example terminates in a categorical decision. Together the comparisons establish that the weight restrictions can be applied to these distinct recurrent workloads and show the predictive quality they achieve under each workload's own measures.
What the ablations show
The same outputs can be assigned in different proportions
The most direct test of a choice within the quantizer is the comparison of the approximately normal and uniform arrangements. The permitted outputs for each representation stay the same. The thresholds move, so weights near the shifted boundaries can receive a different assignment during propagation. For ternary weights this changes which connections contribute zero. For quaternary weights it changes which ones use the weaker or stronger available magnitude.
The displayed LSTM curves on addition favor the approximately normal setting on the training measures used in the comparison. The experiment gives the authors a reason to use that setting in the next stage. It gives a more specific answer than the comparison with full precision because both settings already restrict weights, and the choice at issue is how the restricted values are distributed by the thresholds. The outcome applies to the particular threshold formulas and training problem that were compared.
Moving the boundary and changing category frequencies happen together in this experiment. Consider a weight near the edge of the ternary zero interval. A change in threshold can cause that weight to contribute a signed value and, at the same time, add another assignment to the corresponding tail of the histogram. The downstream result combines that local change with changes elsewhere in the network and with their effects on learning. The paper offers no separate measurements that assign the advantage to a particular gate, layer or part of the histogram.
The design also leaves the relative performance of the alternative distributions on the application tasks open. After the diagnostic comparison, the authors use the selected arrangement for ternary and quaternary weights. The IMDB and moving MNIST outcomes therefore show how that chosen setting works on those tasks. The distribution choice itself receives its most direct empirical test on the addition task.
Fixed boundaries reveal how assignments can collapse
The original-weight visualization motivates the threshold rules by showing weights concentrated near zero. The ternary histogram for fixed boundaries at β0.5 and 0.5 shows what can happen when the central interval is broad relative to the weights. Almost the whole collection is assigned zero. Under the adaptive rules, the illustrations show appreciable use of signed values as well as the middle. The distinction is visible before examining any loss or accuracy curve.
The quaternary illustration asks a related question with fixed boundaries at β0.5, 0 and 0.5. With the displayed weight concentration, the sign boundary divides the assignments, but the outer thresholds are rarely reached. The resulting weights mainly occupy β0.5 and 0.5. In those illustrations, the adaptive quaternary boundaries make the stronger magnitudes available in practice as well as in the definition of the quantizer.
The binary histogram has a simpler purpose. It shows that both signs are used when the normalized values in the example are split at zero. It is possible to see from the rule itself that a layer with a different sign balance would yield a different histogram. The plot is evidence about the weight collection shown. The distribution rules for ternary and quaternary weights offer an additional degree of control because there are boundaries beyond the sign choice.
These visual comparisons establish that the placement of the threshold changes which outputs are actually used. The learning comparisons answer what happens when those assignments enter recurrent computation. The fixed-boundary examples are presented as histograms, so they do not give a full head-to-head evaluation of fixed and adaptive boundaries on held-out reviews or future frames. Their role in the argument is to make the failure mode concrete.
Changing the alphabet changes what a connection can express
The LSTM test results on IMDB put the quaternary, ternary and binary variants in an order consistent with an advantage for the particular richer representations the authors test. The quaternary option can give two connections with the same sign different magnitudes. Binary Connect gives them the same magnitude. Ternary Connect can select a zero contribution, a qualitatively different operation from choosing an inner magnitude.
This makes the comparison informative at the level of complete quantizers. The ternary result reflects its choice of output values and the thresholds that decide which weights are suppressed. The quaternary result reflects a different set of boundaries as well as the meanings of its outputs. The results leave open how much of the ordering could be attributed solely to the number of available values. Separating that question would need a comparison in which the other properties of the rules were controlled.
The full-precision comparison on the same task shows another aspect of the change. In LSTM training, the full-precision version learns faster in the authors' account and reaches lower training loss. The test comparison then measures the eventual decisions under the reported epoch budget. Together these provide evidence that quantization can affect the learning trajectory and the outcome delivered at the end of that trajectory. The authors do not track whether a longer run would change the relationship.
Architecture and frame position provide additional comparisons
The GRU results show that the use of restricted weights extends to a recurrent design with a different state update. LSTM generally fares better in the authors' sentiment comparisons, while the GRU curves and test figure show it remains capable of review classification with the proposed assignments. Setting both architectures to the same hidden width helps define the comparison. The paper's own account of their structures explains why hidden width alone would leave differences in the number and nature of the learned transformations.
For ConvLSTM, the frame examples and error curves supply an analysis over time. The 10th frame is singled out as an example where the full-precision reconstruction is visibly better. It illustrates the relevance of looking past the first future image when evaluating recurrence. The study evaluates the combined spatial recurrence and reconstruction process. It provides no separate intervention on the hidden-state transitions or reconstruction stage that would locate the cause of the error in one component.
The analyses thus answer questions at different levels of the experiment. The histograms reveal the immediate numerical effect of changing a boundary. The addition curves assess alternative boundary choices during learning. The application comparisons measure the consequences of complete representations for sentiment decisions and future frames. The evidence for choosing a particular assignment pattern is most focused in the preliminary task, while the application results establish feasibility for the selected rules.
Limitations
What the authors identify as preliminary or unfinished
The authors describe their sentiment results as preliminary. The reported experiment establishes how two recurrent architectures behave for a particular review-processing setup, with stated limits on input length, width and training time. The strongest numerical evidence is the LSTM test comparison under those conditions. The paper's characterization leaves room for a broader account of performance under different configurations.
For ConvLSTM, the authors explicitly point to testing on more complex data as future work. They present the moving MNIST experiment as an initial evaluation of quantized ConvLSTM for generating frames. Its images and error curves concern trajectories of moving digits. A more complex dataset would extend the question to other spatial and temporal demands. The paper's conclusion leaves that extension for further evaluation.
The results themselves also delimit the feasibility claim. Full precision gives the strongest LSTM test accuracy, and it gives the stronger reconstruction and error performance in the ConvLSTM comparison. The authors describe the restricted alternatives as promising. Those outcomes support the possibility of using very coarse weights within the studied settings, with the observed deterioration in quality still part of the result.
Limits visible in the deployment evidence
The experiments report what the representations do to training and predictive performance. The paper's interest in lower power, reduced memory demand and simpler computation motivates how it chooses the values. A deployment claim would also need measurements of what happens on the device that stores and applies those values. The experiments identify a cluster and general-purpose training software, and provide no corresponding latency, energy or memory-traffic measurements for the proposed recurrent implementations.
The distinction is concrete. An activation multiplied by a sign can be handled as an addition or subtraction in a suitably designed accumulation. An activation associated with a ternary zero can be omitted if the implementation takes advantage of that assignment. Those are properties of the available arithmetic. The actual timing and memory cost depend on how the weights are stored, brought into computation and decoded or applied. The paper's prediction metrics leave those implementation outcomes undetermined.
Training has its own resource boundary. The method keeps full-precision parameter values for updates. Its memory use during training therefore includes those values, quite apart from the restricted versions applied during propagation. The authors' argument for convenient forward arithmetic does not quantify the full cost of training, which also includes its gradients and intermediate quantities. The paper supplies no separate measurements for these parts of the computation.
There is also a distinction between precision and workload when comparing architectures. The stated LSTM and GRU widths define their configuration for the review task. The paper describes the GRU as using fewer parameters by design, while the reported accuracy comparison leaves the exact computational loads of those runs unmeasured. Their relative accuracy consequently cannot by itself resolve which would give a better tradeoff for a device.
Limits visible in the task measurements
The IMDB test accuracies are precise enough to identify the ordering among the reported LSTM settings. The paper gives no spread across repetitions or intervals expressing uncertainty. It is therefore possible to state the results of the reported comparison, while the size and stability of those differences across additional runs remain unknown. The paper also leaves aspects of the training and data procedure unspecified, including the details of the validation split and of initialization. These affect how readily an independent experiment could reproduce the curves or examine the sensitivity of the final scores.
The GRU comparison is less numerically explicit in the discussion than the LSTM one. The paper reports a test figure and characterizes the results, with no matching list of test accuracies. This makes the direction of the authors' assessment available while limiting a detailed quantitative comparison between architectures or among the restricted GRU variants.
For addition, the paper reports the character encoding, the sample budget and the training curves. Its description does not define a detailed held-out protocol for assessing which input patterns the networks can generalize to. The distribution comparison therefore has its clearest interpretation as evidence for a choice made during experimental development. A wider claim about learned arithmetic would require more information about how examples used to measure that ability were selected.
In moving MNIST, the frame examples compare particular reconstructions and the MSE curves give a numerical measure by frame. A squared pixel error can reflect displacement as well as differences in the appearance of a digit. The paper supplies no additional metric that distinguishes those sources of disagreement. It also leaves details of aggregation and evaluation across sequences open in the error discussion. The qualitative inspection and the metric complement each other, but the experiment does not identify a separate error mechanism for each quantized setting.
The video procedure says that generation begins after the initial frames and illustrates several later positions. This specifies where the reported prediction begins. It leaves details of the prediction protocol, including exactly which inputs are supplied as successive forecasts are made, insufficiently specified to attribute the reported differences to accumulated feedback error. The evidence covers the combined prediction procedure used for the figures.
Limits visible in the mathematical specification
A thresholding rule is discontinuous when a small change carries a weight across a category boundary. The paper clearly describes forward use of quantized weights and updates with respect to full-precision parameters. It discusses a straight-through estimator, a device for passing a learning signal through a discrete operation, in connection with earlier recurrent quantization work. The precise gradient treatment in its own implementation is left open. This matters if the objective is to reproduce the learning behavior, because the treatment determines how the loss influences the underlying weights.
The equations also require care as a specification. The threshold formulas contain fractions whose placement has to be read across the case expressions, and the ternary discussion repeats an equation reference where the adjacent captions distinguish the two rules. The failure modes in the weight histograms and the distinction between the two target occupancies are clear. Reproducing the exact rules requires resolving the placement and reading each boundary consistently across the cases.
The layer statistics give the quantizers a way to respond to weight scale. Some assumptions behind that use remain implicit. The paper illustrates weights clustered near zero and uses symmetric boundary positions for the outer cutoffs. It does not characterize the rule's behavior for layers with markedly different weight distributions or track how category occupancy changes through training. As a consequence, approximate normality describes the intended assignment pattern and the illustrative evidence, and exact occupancy for a given layer would depend on its actual weights.
The ConvLSTM equations present a different kind of uncertainty. The architectural account says that convolution brings in spatial neighborhood information, while the written expressions mix a dot, a convolution sign and an elementwise sign in ways that leave particular operations unclear. Several gate terms reuse weight labels. The network stack and its role in the experiment are intelligible in spite of those issues. An exact implementation of every gate operation would require details beyond the equations as printed.
Finally, the preference for the approximately normal arrangement has the scope of the comparison that established it. The change combines boundary movement, changed category use and the response of training to those assignments. The paper measures their combined effect on addition and carries the chosen setting forward. It leaves open whether the same preference would hold across other weight distributions, recurrent tasks or training procedures.
What came after
The paper's closing direction is to evaluate quantized ConvLSTM on more complex datasets. That proposal follows from the evidence it has for moving digits. The spatial network can predict future frames under ternary and quaternary weight assignments, while the full-precision network retains an advantage in reconstruction. A follow-up on more complex data would ask how that relationship changes as the prediction problem changes.
The subsequent citation record available for this paper identifies no specific follow-up to describe. The authors' proposed extension therefore remains the documented next question, with no later result to report for it. The earlier quantization studies discussed in the paper establish its technical background. A later account of its influence would need a study that can be identified and tied to the statistical thresholds or recurrent experiments developed here.
Cite
Cite as Md Zahangir Alom; Adam T Moody; Naoya Maruyama; Brian C Van Essen; and Tarek M. Taha. 2018. Effective Quantization Approaches for Recurrent Neural Networks. arXiv:1802.02615.
@misc{essen2018effective,
title = {{Effective Quantization Approaches for Recurrent Neural Networks}},
author = {Md Zahangir Alom; Adam T Moody; Naoya Maruyama; Brian C {Van Essen;} and Tarek M. Taha},
year = {2018},
doi = {10.48550/arxiv.1802.02615},
eprint = {1802.02615},
archivePrefix = {arXiv},
url = {https://doi.org/10.48550/arxiv.1802.02615}
}This page in Markdown https://md.research.elamur.ai/free/en/papers/alom-2018-effective-quantization-approaches-recurrent-neural/