Efficient Sentence Embedding using Discrete Cosine Transform
Paper · 2019 · Nada Almarwani, Hanan Aldarmaki and Mona Diab
Summary
A sentence representation should retain what matters about a sentence while remaining cheap to calculate and convenient to use. Averaging word embeddings offers a particularly simple solution: retrieve a vector for each word and calculate their mean. The difficulty is that this operation discards sequence. Reversing who acts on whom can leave the representation unchanged. “Dog bites man” and “man bites dog” therefore expose a basic weakness of an otherwise useful baseline. Nada Almarwani, Hanan Aldarmaki, and Mona Diab investigate whether a mathematical transform can preserve useful information about order without requiring an elaborate sentence encoder.
Their method applies the discrete cosine transform, or DCT, to the sequence of values within each embedding coordinate. Instead of treating a sentence as an unordered collection, it treats each coordinate as a signal extending across word positions. The transform describes that signal through cosine coefficients. Keeping a small collection of low-order coefficients produces a fixed-size sentence vector that includes both an aggregate component and components sensitive to positional patterns. The transform itself has no learned parameters. Learning happens afterwards, when a classifier uses the resulting representation for a particular task.
The experiments distinguish linguistic information from practical classification performance. On the SentEval probing tasks, which test whether a representation makes particular sentence properties recoverable, the DCT vectors generally retain more information than averaging. The coefficient corresponding to the aggregate signal is especially effective for sentence length and word content. Additional coefficients help with properties such as constituent structure, grammatical number, and disrupted word order. The pattern is not uniform: retaining more coefficients can weaken surface-property results, and semantic oddity detection behaves differently from most of the other probes.
The downstream findings are more restrained. Question classification shows a clear benefit from including positional information: TREC accuracy reaches 89.8 in reported DCT settings, compared with 83.2 for averaging. Several other tasks show smaller gains, mixed results, or an advantage for averaging. A separate comparison using the evaluation conditions of another spectral sentence-representation study finds strong DCT results on topic classification, while sentiment classification remains more favorable to some alternatives. These findings support an efficient representation with useful structural sensitivity; they do not establish a universally superior sentence representation.
The central qualification concerns what “preserving order” means. A cosine coefficient can distinguish differently ordered words without identifying the semantic roles those words express. The paper’s active–passive example makes this visible: a positional pattern can associate “man bitten by dog” more closely with “man bites dog” than with the sentence expressing the same event in active form. DCT provides compact sequence features. Whether those features help depends on the task, the retained coefficients, the input word vectors, and the classifier trained to interpret them.
Interesting ideas
Preserve sequence with a fixed basis. A useful representation need not learn every part of its composition procedure. DCT supplies predetermined positional weights that expose patterns a mean cannot represent. This suggests a broader engineering strategy: before adopting an expensive learned sequence mechanism, test whether a small family of mathematically defined summaries makes the relevant distinctions available.
Treat normalization as part of the representation. The lowest DCT coefficient contains no order information, yet it behaves differently from ordinary averaging because its scaling depends differently on sentence length. Its probing results show why an apparently minor normalization decision deserves its own comparison. This lesson applies whenever aggregation may accidentally suppress, retain, or amplify information about the size of an input.
Evaluate information before explaining usefulness. A downstream score cannot by itself reveal which sentence properties a representation contains. The paper pairs linguistic probes with practical tasks, allowing structural sensitivity and task benefit to be examined separately. The same approach is useful for document summaries, graph representations, and compressed measurements: first ask what can be recovered, then ask whether recovering it improves the intended decision.
Make resolution a controlled choice. Additional coefficients provide a richer description, but they also enlarge the representation and the classifier using it. The results show that more retained information does not automatically produce a better practical system. A compact representation should therefore expose its resolution as an explicit setting, selected against the target task rather than justified by richness alone.
Test the meaning of an apparent success. Distinguishing a reordered sentence is weaker than understanding why its meaning changed. The active–passive illustration is valuable because it reveals this gap directly. Whenever a representation appears to capture syntax or semantics, use contrasting examples that separate positional resemblance, grammatical structure, and equivalence of meaning.
Compare implementations at the level of operations. The paper’s DCT procedure and the earlier DCT* comparison use the same mathematical family but transform different axes. Their results differ substantially. An algorithm name therefore does not specify a reproducible method: the transformed dimension, retained components, normalization, and evaluation conditions all need to be stated.
Deep dive: Efficient Sentence Embedding using Discrete Cosine Transform
How discrete cosine transforms turn word sequences into compact sentence vectors, what their order sensitivity captures, and where it helps. · about 33 minutes to read
How Mova uses it
Mova is a small, transparent language system written in Rust. Its native reading path builds dependency structure, extracts frames, and maintains a world of the text. The connections below are proposals assessed against those mechanisms. The available implementation evidence does not establish a DCT sentence-representation path or a measured application of this paper. A status of “нове” therefore identifies a proposed addition whose implementation is unconfirmed, rather than proving that no related work exists elsewhere in Mova.
Idea: Preserve sequence with a fixed basis. Where: Section 2.2, DCT Sentence Embeddings. Area: mathematics and representation. Mova: нове. A bounded experimental adapter could summarize numerical features across token positions using a declared cosine basis. Its role would be to provide an additional observation for comparison with native frames, rather than to replace the dependency reader. Why Mova: a deterministic transform fits the preference for explicit operations and could test whether inexpensive positional features recover distinctions that current readers miss. Its benefit remains unknown until measured.
Idea: Treat normalization as a separate mechanism. Where: Sections 2.1 and 3.3. Area: mathematics and evaluation. Mova: частково є (deterministic comparisons and regression gates in README.md; confidence analyses in prag/src/eval.rs). The paper’s comparison between averaging and the lowest DCT coefficient suggests an audit of count-sensitive summaries in Mova. A proposed experiment would change scaling while keeping the underlying observations fixed, then inspect which judgments move. Existing evaluation discipline supports this comparison, but no corresponding DCT normalization study is documented.
Idea: Probe recoverable information before claiming understanding. Where: Sections 3.1 and 3.3, Table 2. Area: evaluation. Mova: частково є (native grammar checks, frame evaluation, and fast-reader miss analysis in world/src/knowledge/retention/fastread.rs). Mova could attach narrowly defined probes to an experimental summary and ask whether it preserves length, participant distinctions, or event order. Passing such a probe would establish recoverability under that test, while a separate task would establish practical usefulness. This extends the existing separation between an observation and the interpretation placed on it.
Idea: Make representation resolution explicit. Where: Sections 2.2, 2.3, and 3.3. Area: efficiency and evaluation. Mova: нове. If a cosine summary is explored, its retained coefficient count should be part of the configuration and result identity. The experiment should report both task behavior and representation size rather than assuming that a richer summary is preferable. Why Mova: explicit resolution makes a bounded alternative reviewable and lets an operator compare its resource demand with its actual contribution.
Idea: Separate order sensitivity from semantic equivalence. Where: Figure 1 and Section 2.2. Area: syntax and semantics. Mova: частково є (UD trees, role-bearing frames in prag, and world-state interpretation in world). Mova already represents distinctions that positional summaries do not explicitly encode. The paper suggests a targeted contrast set in which reordered participants, active–passive alternatives, and similar positional envelopes are evaluated separately. Such a test could reveal whether a proposed auxiliary representation supports the native interpretation or merely tracks surface position.
Idea: Specify the transformed axis. Where: Section 3.4. Area: data processing and reproducibility. Mova: частково є (source-bound groupants and explicit observation contracts in docs/hybrid-system.md). A transform description should name whether its input runs across tokens, embedding coordinates, frames, or another ordered object. The DCT versus DCT* comparison makes this an operational requirement: the same mathematical label can conceal different computations. Mova’s existing source and configuration identities provide a place to record that distinction.
Idea: Keep aggregation and sequence evidence separately inspectable. Where: Sections 2.1 and 2.2. Area: interpretability. Mova: нове. An experimental representation could expose its aggregate block separately from its positional blocks, allowing a diagnostic to show which part changed when a sentence was reordered. This would be a numerical explanation of representation behavior, not a proof of meaning. Why Mova: keeping the components visible would preserve the project’s practice of tracing a decision to a specific observation.
Idea: Precompute reusable mathematical terms. Where: Section 2.3, A Note on Complexity. Area: performance engineering. Mova: частково є (compiled seeds and tables in global, and build-time knowledge construction in docs/architecture.md). The paper calculates positional cosine weights in advance rather than repeatedly evaluating them during sentence processing. An analogous implementation could compile or cache a bounded weight family with a declared supported length. The reusable principle already fits Mova’s architecture, although this particular numerical table is not evidenced.
Idea: Account for downstream cost as well as encoder cost. Where: Sections 2.3 and 3.3. Area: resource accounting. Mova: частково є (prospective cost measurement in tools/twin and bounded jobs described in docs/architecture.md). A cheap representation can still enlarge the classifier or comparison procedure that consumes it. A Mova experiment should therefore attribute resources to the complete path, including retained vectors and later decisions. Existing cost-oriented tools offer related machinery; a measured DCT path remains unknown.
Idea: Give short-input padding an explicit contract. Where: Section 2.2. Area: data processing. Mova: нове. The authors add zero vectors when a sentence is shorter than the requested coefficient collection. Any Mova implementation should record that padding occurred and test whether short utterances acquire misleading similarities because of it. Why Mova: brief questions and bounded worker requests should not receive an unexplained numerical interpretation simply because a representation requires a minimum input extent.
Idea: Measure coefficient behavior in the actual domain. Where: Section 2.2. Area: statistics. Mova: нове. The paper reports that coefficient magnitudes in text do not follow the same pattern the authors associate with image compression, apart from the distinctive aggregate component. Mova should inspect the distributions of any proposed numerical transform on its own declared inputs before adopting a compression rationale from another domain. Why Mova: this prevents an attractive mathematical analogy from becoming an unsupported engineering assumption.
Idea: Keep component positions consistent across inputs. Where: Section 2.2. Area: representation design. Mova: нове. Retaining the same ordered coefficient slots gives sentence vectors a shared interpretation. A proposed adapter should preserve that schema instead of selecting unrelated components independently for each sentence without recording what they mean. Why Mova: stable observation fields make comparisons auditable and allow disagreement to be traced to corresponding components.
Idea: Use simple baselines that isolate different information losses. Where: Section 3.2, Experimental setup. Area: evaluation. Mova: частково є (school controls in docs/architecture.md and negative-control principles in README.md). Averaging and coordinate-wise maximum pooling discard position in different ways. A Mova comparison could include both, alongside a native structural path, to determine whether an apparent benefit comes from retaining sequence or from changing aggregation. The general practice of using informative controls already exists; this baseline family would be an extension.
Idea: Include deliberately limited controls. Where: Table 2. Area: evaluation design. Mova: вже є (school report controls and gates required to demonstrate failure in README.md). The probing results include majority and length-only references, making it possible to recognize tasks that can be solved using shallow information. Mova’s existing controls serve a related purpose. The paper reinforces the need to choose controls that expose a specific shortcut rather than merely supplying a weak competitor.
Idea: Select settings on validation evidence. Where: Section 3.2. Area: experimental procedure. Mova: вже є (held-out self-play checks, regression gates, and release assessment boundaries in README.md and docs/architecture.md). The authors tune classifier settings on validation data. For Mova, a proposed representation or rule should likewise be selected before its final assessment. This is an existing methodological connection, not evidence that the paper has already changed Mova’s training process.
Idea: Test the capacity of the downstream interpreter. Where: Sections 2.2 and 3.2. Area: learning and diagnosis. Mova: частково є (separate first-opinion and judge mechanisms described in docs/architecture.md). The paper allows a hidden classifier layer to interpret interactions among fixed numerical features. A Mova investigation could compare a restricted decision rule with a richer interpreter to see whether an observation is absent or merely difficult to use. Such a comparison would remain separate from the native system’s claims of explicit justification.
Idea: Audit dimensionality as a competing explanation. Where: Sections 2.3 and 3.3. Area: statistical controls. Mova: нове. Because retaining more coefficients also expands the classifier input, a proposed Mova study should investigate whether gains arise from positional content, greater capacity, or both. The paper recognizes the capacity issue but does not resolve it with a dimension-matched control. Why Mova: identifying the source of improvement would help choose between a new mathematical representation and a simpler change to an existing decision procedure.
Idea: Expect different tasks to need different summaries. Where: Section 3.3, Tables 2 and 3. Area: task routing. Mova: частково є (domain coverage and transparent routing in layers). The DCT settings that help a structural probe are not uniformly best for sentiment or relatedness. Mova could treat an experimental summary as a capability with a declared domain of use, admitted only where its evaluation supports that role. Existing routing provides a related boundary, while automatic general selection remains development direction.
Idea: Preserve the full result profile. Where: Section 3.3. Area: evaluation reporting. Mova: вже є (per-course reports, retained traces, and dated measurements described in docs/architecture.md). The paper’s mixed task results are more informative than an undifferentiated claim of improvement. Mova should likewise retain unchanged and worsened outcomes when assessing a new representation. Its existing experiment journals and regression gates already support this principle.
Idea: Match input resources when comparing composition rules. Where: Sections 3.2 and 3.4. Area: experimental controls. Mova: частково є (source/version binding in tools/dictindex and fingerprint checks in tools/enrich). The main comparison holds the word embeddings fixed, while the related-method comparison adopts the other study’s evaluation conditions. A Mova experiment should bind its numerical features and source versions so that changes in composition are not confused with changes in input knowledge. The exact comparison remains proposed.
Idea: Keep a numerical similarity separate from admitted knowledge. Where: Section 2.2 and the task-dependent discussion in Section 3.3. Area: knowledge admission. Mova: вже є (reviewed dictionary admission boundaries in tools/dictindex and draft staging in tools/enrich). A representation can make sentences convenient to compare without establishing that they express the same fact. Mova already separates statistical candidates, reviewed labels, and admitted dictionary content. DCT similarity, if introduced, would belong on the candidate side of that boundary.
Idea: Explore positional summaries for dictionary evidence retrieval. Where: Sections 2.2 and 3.3. Area: lexicography and retrieval. Mova: нове. A bounded experiment could compare order-aware numerical summaries with the existing explicit frame and collocate selectors used for dictionary examples. It should retain original sentences, source credit, and exact posting identities, and measure retrieval usefulness rather than infer senses from proximity alone. Why Mova: a complementary selector might expose examples missed by current features while leaving dictionary decisions reviewable.
Idea: Report quality and efficiency as separate claims. Where: Section 2.3 and the conclusion. Area: benchmarking. Mova: частково є (measurement scope and cache distinctions in tools/dictindex, and prediction-versus-measurement boundaries in tools/twin). The paper supplies a complexity argument but does not report an extensive runtime study. Mova should similarly distinguish an operation-count rationale from an observed timing result. Existing measurement contracts already express this distinction in other components.
Idea: Use a fixed mathematical transform as a bounded observation. Where: Section 2.2. Area: mathematical tooling. Mova: частково є (vidtvorants, typed obernants, and source-bound checks in docs/hybrid-system.md). A DCT adapter could declare its input domain, retained information, and expected failure cases as an experimental observation contract. It should not claim to reproduce the native reader’s interpretation merely because some outputs correlate. This fits the existing emphasis on compatible observations while leaving the adapter itself unimplemented in the available evidence.
Idea: Examine information loss through contrasting outputs. Where: Figure 1 and Table 2. Area: diagnosis. Mova: частково є (fast-reader classifications of representation, inference, parameter, and parse failures in world/src/knowledge/retention/fastread.rs). If a positional summary fails a controlled distinction, the failure should be attributed to the representation before changing the decision rule. Conversely, successful recovery under a suitable probe could motivate investigation of the consuming rule. The paper offers a useful way to separate these possibilities, without proving that a particular Mova error belongs to either category.
The problem and its context
The paper addresses a composition problem. A word vector assigns a numerical representation to a lexical item, but many applications need a representation of an entire utterance. A sentence may contain different numbers of words, while a classifier generally expects an input with a consistent shape. The composition procedure must therefore convert a variable-length sequence into something fixed in size. The important question is what information survives that conversion.
The introduction situates this problem within the widespread use of distributed word representations. It names context-independent approaches such as word2vec and GloVe, alongside contextual representations associated with ELMo and BERT. These references establish the input-representation landscape described by the authors. Their own principal experiments use pretrained FastText vectors rather than testing every one of those alternatives as an interchangeable input.
Averaging is attractive because it solves the fixed-size problem with little machinery. Every word contributes to the same coordinates, and the sentence length does not change the output dimension. The authors emphasize that this simple operation is difficult to improve upon consistently across practical tasks. Their cited evaluation of unsupervised compositional representations motivates a skeptical starting point: added architectural complexity needs to earn its cost.
Its weakness is equally clear. An average contains no record of where a contribution occurred. If the same word vectors appear in another order, their sum and mean remain unchanged. This matters when word order determines the relationship between participants or changes sentence structure. The challenge is not simply to include more information, but to include useful sequential information without losing the simplicity that makes averaging competitive.
The introduction describes several alternatives through this tradeoff. Sequential encoders, including Skip-thought and InferSent, can capture richer aspects of sentence organization. The authors nevertheless characterize their practical costs as substantial relative to frequently modest classification gains. They also cite work on paraphrastic sentence embeddings when discussing generalization beyond the domain associated with a more complex composition procedure. These are the paper’s motivations for seeking a simpler alternative, rather than findings newly established by its own experiments.
Another cited alternative is FastSent, introduced in Learning Distributed Representations of Sentences from Unlabelled Data. In the authors’ account, its computational appeal does not solve the order problem. They also discuss tensor-based composition, which can preserve order but is described as tied to restricted grammatical arrangements. A broadly usable sentence representation must accept varying lengths and structures without requiring that every input fit a narrow construction.
DCT enters as a mathematical compromise. The authors draw on its use in signal processing, including image compression and speech recognition, to propose a different way of summarizing an ordered sequence. Rather than learning a sentence-level composition function from scratch, they apply an established transform to pretrained lexical features. The ambition is deliberately practical: retain useful overall positional patterns while keeping computation close to familiar aggregation.
This framing also determines the evaluation. If DCT really contributes information unavailable to averaging, that contribution should appear in tests designed to detect linguistic properties. If it is practically useful, some downstream tasks should benefit. Neither kind of result can substitute for the other. A representation might reveal sentence length with great accuracy yet add little to semantic relatedness, or preserve order patterns that help question classification without delivering a general account of sentence meaning.
The method, step by step
From words to coordinate sequences
The starting point is a sentence containing N words. Each word has an embedding with d coordinates. Placing the word vectors in sentence order gives a matrix whose rows correspond to words and whose columns correspond to embedding coordinates. The crucial operation runs down a column: it follows one coordinate from the beginning of the sentence to its end.
This is easier to understand by separating lexical features from composition. The word embeddings supply the numerical values. DCT does not decide what a coordinate means or learn a new lexical inventory. It reorganizes the values already present across positions. Every coordinate is processed independently, producing a description of how that coordinate varies along the sentence.
The phrase “apply DCT to word embeddings” is therefore insufficient by itself. Transforming across the coordinates inside an individual word would answer a different mathematical question. Here, the sequence being transformed consists of successive words’ values for a fixed coordinate. That choice is what gives the method access to sentence order.
Constructing a DCT sentence representation
The steps in order.
The padding step applies when the sentence is shorter than the requested coefficient collection. The remaining steps describe the same composition rule for ordinary and padded inputs. The final training step belongs to evaluation and downstream use: the transform itself is fixed.
What the transform calculates
The authors use DCT type II. For an input sequence containing N real values, it calculates N coefficients associated with orthogonal cosine basis functions. “Orthogonal” means that these basis patterns are mathematically distinct directions for describing the input. With the complete coefficient collection, the original sequence can be reconstructed through the inverse transform.
The aggregate coefficient is:
c₀ = √(1/N) ∑ₙ₌₀ᴺ⁻¹ vₙ
Here, vₙ is the value at input position n, and N is the number of values in the sequence being transformed. The summation adds every input value. The factor √(1/N) scales the result. The symbol c₀ names the coefficient associated with the constant, lowest-frequency basis pattern.
This component is closely related to averaging because it depends only on the sum. Reordering the input values leaves it unchanged. Its normalization differs from an ordinary mean, however, so it retains a different relationship to sequence length. That difference becomes important in the probing results: a representation can change substantially without gaining any new sensitivity to order.
The remaining coefficients are calculated as:
cₖ = √(2/N) ∑ₙ₌₀ᴺ⁻¹ vₙ cos[(π/N)(n + 1/2)k], 1 ≤ k < N
The symbols vₙ, n, and N have the same roles as before. The index k identifies a nonconstant cosine component. The constant π determines the cosine’s angular scale, and cos denotes the cosine function. The factor √(2/N) supplies the normalization used for these components. Each input value is multiplied by a weight that depends on its position and on the chosen coefficient.
The formula reveals why order now matters. A value placed early in the sequence receives a different cosine weight from the same value placed later. Exchanging words can therefore alter a coefficient even when the collection of word vectors remains identical. Averaging has no comparable positional weighting, so it cannot make that distinction.
Lower-order components describe broad variation across the input. Higher-order components describe more rapidly changing patterns. The proposed representation keeps the former and discards the latter. This is a compression decision, not an assertion that the omitted components contain no useful information.
Turning coefficients into a sentence vector
The same transform is applied independently to every embedding coordinate. For any chosen coefficient index, the result across all coordinates forms a vector block. Concatenating the retained blocks gives the sentence representation.
The paper expresses the output size as:
sentence-vector size = Kd
K is the number of retained coefficient blocks, and d is the dimensionality of each word embedding. The sentence may contain a varying number of words, but fixing K and d fixes the output size. This is the property that makes the result convenient for a classifier.
There is a notation detail worth keeping visible. The method description uses K to discuss how many coefficients are retained, while the result tables name ranges such as c₀:₁ and c₀:₂ by their coefficient endpoints. In those labels, c₀:₁ includes the aggregate component and the next component. Reading the table labels as coefficient ranges avoids confusing a range endpoint with the number of blocks concatenated.
For a sentence shorter than the requested coefficient collection, the authors append zero vectors. This makes the requested representation available even when the original sequence supplies too few positions. Padding is therefore part of the composition procedure, instead of a learned repair for missing words. The paper specifies the rule but does not provide a separate evaluation of its effects.
The authors also distinguish their selection rule from magnitude-based compression. They explain that image applications frequently benefit from a decline in coefficient magnitude as the frequency index rises. Their text observations do not show the same general tendency, except that the aggregate component commonly has a larger absolute value. They nevertheless keep the low-order coefficients because these occupy consistent slots and describe broad positional patterns.
That choice matters for comparison between sentences. A retained component has the same mathematical role across inputs, even though the sentence lengths and lexical values differ. Selecting unrelated large-magnitude components separately for every sentence would require additional information to explain which patterns had been retained. The proposed low-order selection instead keeps a consistent representation scheme.
What the sentence example establishes
The illustrative comparison uses randomly generated word vectors with d = 10. Its purpose is to make the composition behavior visible without relying on a particular pretrained lexical space. The example is an explanation of the operation, not a task-level result.
The aggregate coefficient treats “dog bites man” and “man bites dog” identically because the input vectors are merely reordered. A nonconstant coefficient can distinguish them. This demonstrates that positional information survives the transform.
The passive alternative exposes the limit. In “man bitten by dog,” the participant words occupy a broad positional arrangement resembling “man bites dog.” The coefficient can therefore favor that positional resemblance even though the active sentence with the same event has the reverse participant ordering. The transform responds to patterns of values across positions; it does not explicitly bind a grammatical subject, patient, and agent.
The different verb forms still contribute different word vectors, so the complete representation need not collapse the sentences into the same point. The authors suggest that a downstream classifier can learn useful interactions among these features. That is a possibility supported by the representation’s ingredients, not a guarantee that the appropriate interpretation emerges in every task.
Where learning happens
The principal experiments use pretrained FastText embeddings with size 300, trained on Common-Crawl. These word vectors remain the shared input resource for the DCT, averaging, and maximum-pooling comparisons. Holding the input resource fixed helps isolate the composition procedure.
The authors evaluate with SentEval. For each task, they train a multilayer perceptron, or MLP, on the sentence representation. An MLP is a classifier that can include a learned hidden transformation before producing its task decision. The representation does not acquire task-specific transform parameters, but the consuming classifier does learn from task labels.
Validation selects the hidden-state setting from [0, 50, 100, 200, 512]. It also selects the dropout rate from [0, 0.1, 0.2]. Dropout is part of the classifier’s training configuration. The setting with 0 hidden states corresponds to logistic regression, so the evaluation permits a classifier without a hidden layer as well as richer alternatives.
The authors explore 1 ≤ K ≤ 7. This makes retained resolution an experimental variable rather than a fixed theoretical recommendation. Different tasks can prefer different settings because additional coefficients change both the available information and the size of the classifier input.
Why the computation is inexpensive
The cosine weights depend on sentence length, position, and coefficient index. They do not depend on the particular word values. The authors therefore propose calculating reusable weights in advance.
Their stated count is:
precomputed cosine terms per feature = (K − 1)N̂
N̂ denotes the maximum supported sentence length, while K is the selected coefficient count. The aggregate component does not require the nonconstant cosine weighting, which explains its different treatment in the expression. The formula describes the authors’ precomputation account rather than an independently measured storage result.
At runtime, the operation resembles calculating a small collection of weighted averages. The paper gives a complexity proportional to KN and recommends keeping K small relative to expected sentence length. Since each embedding coordinate is processed independently, parallel execution is also possible.
This efficiency argument has a boundary. The representation becomes larger as K grows, and the classifier consuming it consequently needs more input parameters. Cheap composition does not make all consequences of a larger representation free. The paper explicitly raises this issue when discussing why additional coefficients can eventually harm generalization.
Experiments and results
What the evaluation asks
The empirical study has complementary parts. The probing evaluation asks which linguistic properties can be predicted from the sentence vectors. The downstream evaluation asks whether those vectors support practical classification and relatedness judgments. A further comparison adopts the conditions of a separate spectral-representation study.
The probing suite comes from What You Can Cram into a Single Vector. It contains 10 classification tasks, organized into surface, syntactic, and semantic groups. The surface tasks concern sentence length and word content. The syntactic group examines tree depth, top constituents, and disrupted word order. The semantic group includes tense, participant number, semantic oddity, and inverted coordination.
These labels should be understood as evaluation categories. A successful prediction indicates that the vector supports the corresponding test under the trained classifier. It does not establish a complete symbolic representation of that property, nor does it guarantee that an unrelated downstream classifier will use it.
The principal baselines are AVG, which averages the same input word vectors, and MAX, which takes a coordinate-wise maximum. Both produce a fixed-size aggregate without retaining position. Their different behaviors help show that not every advantage over averaging is necessarily an advantage from order.
Surface information favors the aggregate coefficient
Sentence-length prediction provides the clearest demonstration that normalization alone matters. The lowest DCT coefficient contains no positional contrast, yet it substantially improves this probe over ordinary averaging.
Sentence-length probing accuracy in SentEval
The aggregate DCT component retains length information that ordinary averaging weakens.
The numbers
| System or setting | accuracy % |
|---|---|
| AVG | 64.12 |
| MAX | 62.67 |
| DCT c₀ (this paper) | 98.67 |
Word-content prediction shows a related pattern. AVG scores 82.1, MAX scores 88.97, and c₀ scores 91.11. The authors attribute the aggregate DCT component’s surface-task behavior to its length-dependent normalization. Longer sentences are not scaled down in the same way as under the ordinary mean.
Adding coefficients does not continue that improvement. At c₀:₆, sentence-length accuracy is 91.56 and word-content accuracy is 79.83. The representation contains additional components, but the trained probe recovers these particular surface properties less successfully. The result cautions against treating greater representational size as automatic practical superiority.
The table includes reference controls as well. A classifier supplied only with sentence length scores 100 on the length task, as expected from the nature of its input. Its word-content result is 0.2. The controls make the distinction concrete: a representation that reveals length is not thereby demonstrating broad linguistic competence.
Structural probes benefit from positional components
The word-order probe, BShift, tests whether the representation supports detection of a local order disruption. AVG and MAX remain near their reported baseline region, while the DCT results improve as additional coefficient ranges are retained.
BShift word-order probing accuracy in SentEval
Additional positional coefficients make disrupted order easier for the classifier to detect.
The numbers
| System or setting | accuracy % |
|---|---|
| AVG | 50.16 |
| MAX | 50.31 |
| DCT c₀ | 50.42 |
| DCT c₀:₁ | 52.25 |
| DCT c₀:₂ | 54.84 |
| DCT c₀:₃ | 57.29 |
| DCT c₀:₄ | 60.31 |
| DCT c₀:₅ | 62.01 |
| DCT c₀:₆ (this paper) | 62.59 |
The aggregate component’s behavior is especially informative. It differs from AVG in normalization but still lacks order sensitivity. Its BShift score therefore supplies a useful contrast with the coefficient ranges that include nonconstant positional weights.
Other structural probes show benefits without identical trajectories. Tree-depth accuracy is 36.38 for AVG and reaches 43.35 at c₀:₃. Top-constituent prediction is 68.04 for AVG and reaches 81.60 at c₀:₅. Neither pattern requires that every successive coefficient range improve every task. The broader finding is that the positional summaries expose structural information that averaging makes harder to recover.
Participant-number probes also improve. Subject-number accuracy is 80.89 for AVG and reaches 88.65 in reported DCT settings. Object-number accuracy is 80.24 for AVG and reaches 88.28 at c₀:₆. Tense behaves more conservatively: AVG scores 87.9, while c₀:₄ scores 88.91.
Coordination inversion shows a pronounced contrast. AVG scores 51.95, while c₀:₃ scores 72.01. Semantic oddity detection, SOMO, differs from the dominant pattern: c₀ scores 55.6, whereas c₀:₆ scores 52.07. AVG scores 50.39 on that task. Additional positional detail therefore helps several probes while weakening the best DCT setting for another.
Downstream benefits depend on the task
The downstream suite includes sentiment classification, question classification, and inference. It also covers semantic similarity, paraphrase detection, and subjectivity judgments. The range matters because the proposed representation is not optimized for a single label inventory.
Question classification produces the most conspicuous benefit in the main evaluation. The authors connect this outcome to the usefulness of order information for TREC.
TREC question-classification accuracy in SentEval
Retaining positional components helps question classification, but the largest range is not the best.
The numbers
| System or setting | accuracy % |
|---|---|
| AVG | 83.2 |
| MAX | 76.2 |
| DCT c₀ | 84.8 |
| DCT c₀:₁ | 88.2 |
| DCT c₀:₂ (this paper) | 89.8 |
| DCT c₀:₃ | 88.2 |
| DCT c₀:₄ | 89.8 |
| DCT c₀:₅ | 88.8 |
| DCT c₀:₆ | 86.4 |
The sentiment results are mixed. On MR, AVG accuracy is 78.3 and c₀ reaches 78.45. SST2 favors AVG at 84.13 over the reported DCT settings. SST5 reaches 46.06 with c₀:₁, compared with 44.16 for AVG. CR reaches 80.08 with c₀:₄, while AVG scores 79.6.
MPQA favors the aggregate DCT component among the reported DCT settings: c₀ scores 88.36 and AVG scores 87.94. Subjectivity classification follows a similar pattern, with c₀ at 92.79 and AVG at 92.33. These outcomes do not support a simple rule that order-aware components improve every sentiment-related task.
Paraphrase detection on MRPC reaches 75.07 at c₀:₆, compared with 74.43 for AVG. SICK-E inference reaches 80.56 at c₀:₃, while AVG scores 79.5. These results show useful settings beyond TREC, although the size and direction of the effects differ by task.
The relatedness columns require care. The paper reports SICK-R and STSB scores, but the available account does not explicitly name the correlation convention or scaling used for those columns. SICK-R is 81.95 for AVG and reaches 82.95 at c₀:₂. STSB is 69.26 for AVG, 71.11 for c₀, and 71.57 for MAX. These should be read as the reported relatedness scores, without silently relabeling them as classification accuracy or assigning an unstated correlation metric.
The relatedness and inference data are connected to SemEval’s sentence-level evaluation, while STSB is associated with SemEval-2017 semantic textual similarity. The paraphrase task uses the benchmark associated with Dolan and colleagues’ corpus construction work. These evaluation resources test different relationships between sentence vectors and should not be interpreted as interchangeable measures.
A comparison under another study’s conditions
The additional experiment compares DCT with the systems reported by Kayal and Tsatsaronis. The authors adopt that study’s pretrained embeddings and evaluation framework for SST-5, 20-NG, and R-8. This separates the comparison from the principal SentEval setup.
The distinction between DCT* and the proposed method is central. DCT* transforms across the coordinates of a word embedding. The proposed procedure transforms a coordinate across successive word positions. The comparison therefore concerns different constructions, in spite of the shared transform name.
On 20-NG, the proposed representation has F1 71.73. Averaging has F1 68.25, while DCT* has F1 59.78. The stronger alternatives are closely grouped: p-means has F1 71.79 and EigenSent combined with averaging has F1 71.78. The DCT result is competitive in this comparison, but it is not the highest reported F1.
On R-8, the proposed representation has F1 96.94. Averaging has F1 96.27, DCT* has F1 90.38, and EigenSent combined with averaging has F1 97.14. The proposed DCT result also exceeds the standalone EigenSent F1 of 95.76. This supports the authors’ claim that their sequence-axis construction is a strong alternative within these conditions.
SST-5 gives a different ordering. The proposed representation has F1 34.54, above standalone EigenSent at 33.91 and p-means at 33.26. ELMo reaches F1 41.54, and EigenSent combined with averaging reaches F1 41.81. The DCT method therefore does not dominate the sentiment comparison.
The best coefficient setting is reported as k=3 for SST-5 and k=2 for 20-NG and R-8. These task-dependent choices reinforce the main study’s conclusion that retained resolution should be selected empirically. The comparison supports an effective composition procedure under specific conditions, instead of an unrestricted ranking of all the named systems.
What the ablations show
The aggregate component isolates normalization
The paper’s main controlled analysis varies the retained coefficient range. Its most useful starting point is c₀, because that component has the same permutation invariance as averaging. Any advantage at this setting cannot be attributed to preserving word order.
The surface-probe results therefore provide evidence about scaling. The aggregate DCT representation makes sentence length and word content easier to recover than AVG under the evaluated classifiers. The authors explain this through the different normalization of the sum. That explanation is consistent with the operation itself: word position has not entered the representation.
The downstream c₀ results are also important because they prevent all gains from being attributed to structural information. When c₀ improves a task, the useful change may concern magnitude or length-related behavior. The experiment thus gives a way to separate an aggregation effect from an order-sensitive effect, even though the paper does not fully analyze every downstream decision.
Retaining more components changes several things
The coefficient sweep demonstrates that nonconstant components contribute useful information. BShift, constituent prediction, and participant-number probes become more successful under richer DCT settings. This supports the claim that the transform retains aspects of sequential organization.
The same sweep also changes dimensionality. A classifier receiving more coefficient blocks has more input values and potentially more parameters. The authors acknowledge the possibility of overfitting when K grows. Accordingly, the results do not isolate positional information from classifier capacity as cleanly as a dimension-matched experiment would.
This qualification does not erase the order argument. The formulas establish that the nonconstant components are position-sensitive, and the probes show behavior consistent with that property. It does limit the strength of a causal explanation for every numerical gain. Some effects may depend on the interaction between new information, input size, regularization, and the selected classifier.
The absence of a universal monotonic trend is informative. Surface tasks weaken as more components are included. SOMO favors the aggregate setting over the larger retained ranges. Several downstream tasks fluctuate or deteriorate. The representation’s additional detail is therefore useful selectively, rather than functioning as a general improvement knob.
The examples test what order sensitivity means
Figure 1 is an analysis rather than an ablation. It shows the consequences of the composition rule on controlled sentence arrangements, using random lexical vectors.
Its strongest lesson is conceptual. A representation may distinguish participant reversal while still grouping an active–passive alternative according to positional resemblance. The test separates sensitivity to order from understanding of grammatical roles. That distinction is especially valuable because the paper’s motivation uses syntactic structure, while the actual transform operates directly on numerical sequences.
The illustration also explains why the classifier matters. Lexical differences and multiple coefficient blocks can provide cues beyond a single broad pattern. A downstream learner may exploit those cues, but the transform does not guarantee the appropriate interpretation on its own.
The axis comparison is informative but not a perfect isolation
The comparison with DCT* highlights the importance of applying the transform across word positions. Its much weaker results under the reported external framework show that using a cosine transform somewhere in the pipeline is not enough.
Nevertheless, this is not presented as a complete factorial experiment in which every implementation detail is independently varied. The authors reproduce comparison conditions and report their own construction alongside the earlier systems. The result strongly motivates attention to the transform axis, while leaving room for other procedural details to influence performance.
The paper also discusses correlations between linguistic probes and downstream tasks by referring to earlier probing research. It does not present a new causal analysis proving that a particular probe improvement produces a particular downstream gain. The observed TREC pattern is compatible with the authors’ structural explanation, but compatibility should remain distinct from a fully isolated causal demonstration.
Limitations
Limits the authors identify
The authors recognize that more coefficients can harm generalization. Increasing the retained range expands the sentence vector and the input parameter count of the classifier. The method’s inexpensive transform does not remove this statistical cost.
They also report a mismatch between the familiar image-compression intuition and their text observations. Except for the aggregate component, coefficient magnitude does not generally decline in the expected way. Keeping low-order coefficients is therefore justified as a consistent summary of broad sequence patterns, not demonstrated as an optimal magnitude-based compression rule for text.
Their own illustration identifies a semantic weakness. A positional pattern can align an active–passive sentence with a semantically different arrangement. The transform preserves aspects of sequence while lacking an explicit account of who did what to whom. The authors suggest that downstream learning can exploit remaining lexical and coefficient differences, but this is not the same as eliminating the problem.
The empirical discussion is also task-dependent. The authors do not find that larger coefficient ranges improve every probe or every downstream benchmark. They specifically note the distinct behavior of SOMO and discuss why tasks that do not benefit from structural features may favor simpler aggregation.
Limits visible in the evaluation setup
The principal experiments test sentence vectors through trained classifiers. A probe’s success shows that a particular learned decision procedure can recover information from the representation. It does not show that the representation exposes that property in an immediately interpretable coordinate or that every consuming system can use it.
The classifier is therefore part of the practical result. Hidden-state count and dropout are selected on validation data, and the available classifier family includes both logistic regression and hidden-layer alternatives. Performance reflects the interaction between composition and the trained interpreter, not an isolated property of the transform alone.
The study does not provide a dimension-matched control for the larger coefficient collections. Retaining additional components increases both positional information and vector size. The experiments support the usefulness of the resulting representations, but they cannot assign every gain exclusively to the newly preserved order information.
The efficiency claims rest mainly on the operation structure and precomputation argument. The paper does not supply a broad timing comparison across hardware, sentence lengths, batch sizes, and classifier configurations. Its account makes the computational appeal understandable, while leaving actual deployment latency to be measured.
The reported experiments also do not establish how the method behaves across languages, specialized domains, or arbitrary embedding resources. The principal setup uses a particular pretrained lexical resource, and the separate comparison adopts another study’s conditions. These are useful tests, but they do not demonstrate universal robustness.
No dedicated analysis examines the padding rule. Zero-padding is specified for inputs shorter than the desired coefficient collection, yet the paper does not isolate its effects on short sentences. A practical implementation should preserve that distinction when interpreting results for brief utterances.
The paper does not provide a reconstruction-error study for the truncated sentence representations. Full DCT is invertible, but the proposed sentence vector discards coefficients. Exact invertibility of the complete transform does not imply exact retention of the original sequence after truncation.
Nor does the paper demonstrate that low-order coefficients are the optimal subset for all text tasks. The authors choose them to describe overall patterns consistently. Alternative selection rules are not systematically evaluated, so the reported results establish a useful design instead of a proven optimum.
What the numerical results cannot settle
The result tables provide point estimates without uncertainty intervals or reported significance tests for the main comparisons. Close scores should therefore be read cautiously. A numerical ordering in a table does not on its own establish that the ordering would persist under repeated training or another sample.
The probing references include human and deliberately limited controls, which help place the tasks in context. Those references do not transform a classifier’s success into a complete measure of linguistic understanding. A task can reveal a useful capability while leaving many distinctions untested.
The relatedness columns are another reporting boundary. Their values are available, but the paper’s account does not explicitly identify the precise scoring convention. Assigning a more specific metric name than the authors provide would create an unsupported degree of precision.
The separate comparison also should not be merged numerically with the principal SentEval results. The authors change conditions to match the comparison study. A score from that setup answers a question about performance under those conditions, rather than supplying another interchangeable measurement from the main experiment.
Finally, the work is about representation and classification. It does not demonstrate reasoning over an explicit world, factual verification, or transparent derivations of sentence meaning. Its contribution is narrower and useful on its own terms: an efficient way to make some sequence information available inside fixed-size sentence vectors.
What came after
A subsequent research trajectory cannot be established from the works documented alongside this paper. No later citing study is identified with enough information to describe how it adopted, modified, or rejected the method. It would therefore be unwarranted to claim an established line of successors.
The closest related spectral work discussed by the authors is EigenSent, which uses higher-order dynamic mode decomposition to derive sentence representations. The paper explicitly treats that work as independent and parallel. It belongs in the comparison of approaches, rather than being presented as a development caused by this DCT proposal.
The distinction matters because the shared use of spectral analysis can obscure differences in construction. EigenSent summarizes sentence dynamics through a different procedure, while DCT* transforms within word-vector coordinates. The proposed method instead follows each coordinate across word positions. These neighboring approaches show that spectral techniques can be applied to sentence representation in materially different ways; they do not establish a later history of this particular construction.
The unresolved questions remain concrete. The experiments motivate closer controls for dimensionality, direct runtime measurement, and tests that separate positional resemblance from semantic equivalence. They also leave open whether the same low-cost composition rule remains useful under other input representations and task conditions. Those are implications of the paper’s evidence and limits, not claims that later work has already answered them.
Cite
Cite as Nada Almarwani, Hanan Aldarmaki and Mona Diab. 2019. Efficient Sentence Embedding using Discrete Cosine Transform. Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP).
@inproceedings{almarwani2019efficient,
title = {{Efficient Sentence Embedding using Discrete Cosine Transform}},
author = {Nada Almarwani, Hanan Aldarmaki and Mona Diab},
booktitle = {Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP)},
year = {2019},
doi = {10.18653/v1/d19-1380},
url = {https://doi.org/10.18653/v1/d19-1380}
}This page in Markdown https://md.research.elamur.ai/free/en/papers/almarwani-2019-efficient-sentence-embedding-discrete-cosine/