In the previous post, we covered some of the most important milestones in conversational systems and NLP, such as the birth of ELIZA (1966) and its ability to simulate empathy through syntactic pattern matching.
We also reviewed the limitations of that approach, which forced the stochastic transition of the 1980s and 1990s, where statistical models (n-grams and HMMs) started inferring information directly from data. These models quickly ran into data sparsity and the semantic blindness of one-hot encoding.
In this post, we will look at the introduction of concepts like Word2Vec, Recurrent Neural Networks (RNNs), and Long Short-Term Memory (LSTM) networks.
The Distributed Representation Revolution: Word2Vec
Traditional systems assigned an arbitrary index to each term, creating massive matrices where semantic relationships completely disappeared. This lack of connection prevented software from extracting real value from unstructured data. In 2013, a research team led by Tomas Mikolov introduced Word2Vec.
Word2Vec proposed a model based on shallow neural networks that allows us to represent words in a continuous space, as dense vectors (usually between 50 and 300 dimensions, instead of tens of thousands). This model improved semantic relationships and word nuances with high precision.
Word2Vec transformed plain text into dense vectors within a continuous space and enabled similar concepts to coexist in nearby mathematical regions.
The Word2Vec architecture introduced two predictive model variants to compute continuous word representations from large text corpora:
- Continuous Bag-of-Words (CBOW): the neural network predicts the probability of a current target word based on the context window of surrounding words.
- Skip-Gram: operates on the inverse principle of CBOW. It uses the current word to predict surrounding words within a given range or window.
Thanks to this approach, it became possible to capture semantic and syntactic pattern analogies, such as the famous vector equation: “king – man + woman ≈ queen”.
The model deduced, without external instruction, the vector representing the concept of "royalty" and the vector for "gender," allowing it to navigate the lexicon as if it were a map of geographic coordinates.
All this through simple vector operations and cosine similarity measurements, without resorting to computationally expensive processes.
Its low computational cost and open-source availability, published freely for the research community, almost instantly drove the adoption of embeddings across the entire NLP spectrum.
This milestone paved the way for Deep Learning architectures, specifically Recurrent Neural Networks (RNNs) and, later, models based on the Transformers architecture (Church, 2017).
The Arrival of Deep Learning (DL) and Context Management: Recurrent Neural Networks (RNNs)
Having overcome the challenge of giving meaning to isolated words, the next big challenge was understanding context. Language is, by nature, a temporal sequence.
Here, the order of factors does alter (and drastically) the outcome. That is why a conversational system cannot treat text as simple unordered bags of words; it needs a dynamic memory capable of evolving at the same pace as the sentence itself.
DL revolutionized the field of NLP by enabling the development of much more efficient and powerful models for managing sequential data. Among the multiple DL architectures, RNNs stand out—they were introduced in the 1980s as an improvement over traditional neural networks.
Unlike traditional networks, where information flows unidirectionally from the input layers to the output layers, RNN architectures introduced recurrent connections in their hidden neurons.
This recurrence worked as a short-term memory that provided the system with continuous context. In this way, when processing a sequence, RNNs naturally began capturing the temporal dependencies of the text.
However, when implementing deep RNNs in complex tasks like generative chatbots, research teams noticed the vanishing gradient problem, a phenomenon that completely sabotaged the system's long-term memory.
During training, via the backpropagation through time algorithm, error calculations require iteratively multiplying weight matrices. If those values are less than one, the gradient shrinks exponentially until it vanishes from the equations.
The practical consequence was a scenario where chatbots forgot the beginning of the sentence by the time they reached the second paragraph of the dialogue. Traditional RNNs were unable to connect an initial prompt with a final response if the sequence exceeded a certain word limit, ultimately degrading the user experience.
The Long-Term Solution: Long Short-Term Memory (LSTM) Networks (1997)
To solve the vanishing gradient problem, researchers Sepp Hochreiter and Jürgen Schmidhuber developed Long Short-Term Memory (LSTM) networks in 1997, an architecture that would redefine sequential processing.
LSTMs were capable of preserving relevant information over significantly longer periods of time. Instead of allowing new data to overwrite previous context, they established a central memory channel protected by three neural network gates:
- Forget gate: discards obsolete information through filtering that cleans noise from the system. It analyzes the context of the current word and the previous state to return a value between zero and one.
- Input gate: selects new data worthy of being incorporated into long-term memory, preventing storage space from being saturated with irrelevant terms.
- Output gate: determines what portion of the accumulated context should be passed on to the next sequential step, regulating the immediate response inherited by the system.
The integration of these structures helped mitigate the vanishing gradient problem almost entirely. This allowed for more coherent conversational modeling, where an artificial agent could remember a user's name or intent across multiple dialogue turns.
Conclusions
In this post, we have analyzed how the success of conversational systems depended on striking a delicate balance between semantic representation and memory management.
While Word2Vec transformed word meaning into accessible coordinates, RNN and LSTM architectures enabled machines to capture the sequential and temporal nature of human language.
However, the quest for an even deeper and more scalable understanding did not stop there.
In the next post, we will take the big leap into the modern AI era, where we will analyze the arrival of Seq2Seq models, the birth of attention mechanisms, and the Transformers architecture.
See you in the next installment!
References
Comments are moderated and will only be visible if they add to the discussion in a constructive way. If you disagree with a point, please, be polite.
Tell us what you think.