## 4 Implementation and Experiments
### Training Procedure and Evaluation Metrics
#### 4.3.3 NutriLLM Training and Evaluation Framework  
The training process of Llama 3 fine tuning utilized the following parameters in Table 8: batch size, learning rate, number of epochs, choice of optimizer, and the selection of an appropriate loss function.  
Cross-entropy loss is one of the most commonly used loss functions in natural language processing, particularly in generation tasks, such as machine translation and text summarization. It measures the difference between the probability distribution predicted by the model and the probability distribution of the actual labels.  
In the testing phase, we used the following metrics to evaluate the sentences generated by the LLM.  
Bilingual Evaluation Understudy (BLEU-4) is a metric for evaluating the quality of machine translations by comparing the similarity between machine-generated and human translations. BLEU-4 specifically focuses on matching sequences of four consecutive words (4-g). Scores range from 0 to 1, with higher scores indicating closer resemblance to human translations. Its calculation involves two main steps: n-gram precision and brevity penalty (BP). The detailed definition is as follows:  
\[BLEU=BP\times exp\left({\sum}_{n=1}^{4}w_{n}logp_{n}\right) \tag{13}\]  
\begin{table}
\begin{tabular}{c c} \hline \hline \multicolumn{2}{c}{**Experimental Setup**} \\ \hline Batch size & 16 \\ Learning rate & \(1\times 10^{-3}\) \\ Number of epochs & 50 \\ Optimizer & Adam \\ Loss function & Mean Square Error (MSE) \\ \hline \hline \end{tabular}
\end{table}
Table 7: Multi-view stereo training parameters.  
\begin{table}
\begin{tabular}{c c} \hline \hline \multicolumn{2}{c}{**Experimental Setup**} \\ \hline Batch size & 8 \\ Learning rate & \(1\times 10^{-5}\) \\ Number of epochs & 20 \\ [PERSON] & AdamW \\ Loss function & Cross-entropy loss \\ \hline \hline \end{tabular}
\end{table}
Table 8: Llama 3 fine-tuning parameters.  
The following is a description of the parameters in the BLEU calculation test. \(p_{n}\) is the n-gram precision, and it is defined as follows:  
\[p_{n}=\frac{Total\ number\ of\ n-gram\ sin\ the\ generated\ text}{Number\ of\ matching\ n-gram\ sin\ the\ generated\ text} \tag{14}\]  
\(w_{n}\) is the weight, which is typically equal for each n-gram, such as \(w_{n}=0.25\).  
Brevity penalty (BP) means that if the length of the generated text is less than the reference text, a penalty is applied.  
\[I\ am\ running\ a\ few\ minutes\ latemy\ previous\ meeting\ is\ running\ over.\]  
where \(c\) is the length of the generated text and \(r\) is the length of the reference text.  
Recall-Oriented Understudy for Gisting Evaluation (ROUGE-N).  
* ROUGE-1 mainly measures the overlap of unigrams (single words) between the generated text and the reference text. It focuses on recall by measuring the number of words in the reference text that the model predicts.
* ROUGE-2 is similar to ROUGE-1 but focuses on bigrams (two-word sequences), measuring the overlap of consecutive word pairs in the generated text and the reference text.
* ROUGE-L is based on the longest common subsequence (LCS). This metric considers the most extended sequence of words that appear in the generated text and the reference text in the same order, which relates to the overall structure similarity. It takes into account both precision and recall.  
The metric for Evaluation of Translation with Explicit Ordering (METEOR) is a machine translation evaluation metric that considers basic word matching, synonyms, and word order matching. METEOR is designed to address some of the shortcomings of BLEU, handling synonyms and syntactic variations better, and providing a more balanced evaluation by considering precision and recall.