LangGragh
LangGragh
Recurrent Neural Network The most commonly used neural network is the
recurrent neural network (RNN), which can store the historical information of
the current word through learning. The probability of the next word’s occurrence
is calculated according to the whole context, so as to overcome the disadvantage
that the N-Gram language model cannot use the remote context information
in the sentence[10]. Recurrent neural network (RNN) is adopted by Socher in
syntactic parsing[11]. It is a typical three-layer deep learning model[12], which is
composed by Irsoy and Cardie. Recurrent neural network has been proved to be
effective in solving serialization problems, able to use context information and
has achieved good results in machine translation and other fields. However, the
problem of gradient explosion and disappearance exists in the process of solving
Recursive neural networks, which is not good enough for long text processing.
The long-term and short-term memory proposed later solves the long-sequence
problem well.
The output layer, the input layer, and the hidden layer constitute the tradi-
tional neural network structure. There is a close connection between layers and
no connection between nodes. RNN means that the current output of a sequence
is related to the previous output. See Figure 1 for a detailed explanation.
In the field of natural language processing, large language models (LLMs) such
as GPT-4o, Llama 3.2, ERNIE-4, and GLM-4 have demonstrated exceptional
language processing capabilities due to their training on vast corpora and their
large number of parameters. These models are not only capable of understanding
complex human instructions and performing a variety of tasks, including machine
translation, but they also possess abilities such as in-context learning and chain-
of-thought, which allow them to optimize predictive results through contextual
information. Recent research indicates that advanced LLMs like ChatGPT have
surpassed traditional supervised learning models in certain language pairs. LLMs
show great potential in multilingual translation, bringing new opportunities and
challenges to the field of machine translation. Enhancing their capabilities in
multiple languages is crucial for establishing new translation paradigms.
3 Experimental design
This experiment trains and tests the model with the help of English and French
datasets, whose form is English and French sentence pairs. After importing
the processed data into the language model package, the model is going to be
trained, and the machine translation model and evaluation model are estab-
lished. Then, the results are compared to continuously optimize the machine
translation model. Finally, the experimental results are obtained.
In the experiment, the data input sequence is defined as X, in which each word
is x, then an input sequence statement can be represented as (x1 , x2 , . . . , xT ).
The output statement sequence translated by the RNN model is defined as Y ,
then the output sequence statement can be represented as (y1 , y2 , . . . , yT ). The
sequence-to-sequence network used in this experiment is a neural network model
composed of 2 hidden layers, 256 hidden nodes, and 2 RNNs, which is used to
train processed data texts to achieve the effect of mutual translation between
English and French.
y = W yt ht (3)
The training results and translation results are obtained through the training
model. After processing the data, 75,000 words are finally selected for experi-
ment. By comparing the target sentences and the exact sentences, it can be seen
that the translation effect is still good.
The progress and average loss of training statements are shown in Figure 4.
Fig. 4. Training Status Table.
Taking two simple sentences from Fig 5 to Fig 6 for example, the x and y
axes represent the words of the source and target sentences respectively. Each
pixel represents the weight size of the source statement to the target statement,
that is, the expression of attention mechanism. The right bar graph is weighted
from 0.0 to 1.0 (0.0 is black, 1.0 is white).
The evaluation criteria of machine translation include BLEU [15], NIST [16],
METEOR [17] and TER [18]. The above criteria used to evaluate machine trans-
lation are all used to measure the quality of machine translation, the quality of
Fig. 6. Training Statement (2)
1. The model structure is relatively simple and the number of hidden layers in
RNN is not sufficient, and the training is imperfect.
2. The number of data sets is insufficient with single direction is single, which
cannot cause the model study well, resulting in poor translation effect.
4.4 Discussion
Although this study has achieved positive results, there are still several areas
that require further exploration and improvement:
1. Expanded Context Handling: Demonstrate LangGraph’s ability to retain
long-term context across paragraphs or entire documents rather than isolated
sentences.
2. Dynamic Agent Adaptation: Showcase how agents can dynamically adapt
to different domains or contexts using LangGraph, e.g., switching from casual
conversational translation to technical or formal translation styles.
3. Interactive Features: Implement interactive feedback loops where users can
provide corrections, and agents learn and adapt over time.
4. Human in the loop:Delve into the application of Human-in-the-loop within
the LangGraph framework, setting breakpoints during the graph execution pro-
cess to permit human intervention and adjustment. Engage in state editing and
human feedback, modify the state of the graph during execution and adjust
the workflow based on human input. Utilize the time travel feature, review the
execution state of the graph by retracing its steps to facilitate debugging and
optimization. This sets a course for future research in this domain.
5 Conclusion
References