This exact-substring-matching criterion, while conceptually simple, is computationally prohibitive with naive (quadratic) all-pair matching. To improve the efficiency, we concatenate all the examples of the entire dataset \(D\) into a giant sequence \(\mathcal{S}\), and construct a Suffix Array \(\mathcal{A}\) of \(\mathcal{S}\). A suffix array [20] is a representation of a suffix tree [20] that can be constructed in linear time in \(\|\mathcal{S}\|\)[13] and enables efficient computation of many substring queries; in particular, they allow us to identify duplicated training examples in linear time. Suffix arrays have the advantage over suffix trees in that they are 10-100\(\times\) more memory efficient [21], requiring just 8 bytes per input token, though they are asymptotically less efficient for some query types. They have been used widely in NLP, such as for efficient TF-IDF computation [22] and document clustering [23].