Corregir en lenguaje formal y técnico para un artículo científico el siguiente párrafo. El texto es el siguiente:"Optimizar la configuración de hiperparámetros permite al sistema RAG con LLM mejorar no solo en términos de precisión y relevancia de las respuestas, sino también en consistencia y sensibilidad cultural. En escenarios de alta responsabilidad, una configuración subóptima podría traducirse en respuestas ambiguas, sesgadas o incluso perjudiciales, lo cual es inaceptable en contextos de apoyo a personas vulnerables. Por tanto, una correcta optimización permite minimizar el riesgo de errores o malentendidos, ofreciendo respuestas más seguras y confiables adaptadas a las necesidades específicas de los usuarios. Esto garantiza un balance óptimo entre precisión, adaptabilidad y eficiencia, lo que resulta en sistemas más robustos y seguros para responder a las demandas complejas de usuarios en situaciones de alta vulnerabilidad."
Assistant
La optimización de la configuración de hiperparámetros en el sistema RAG con modelos de lenguaje de gran tamaño (LLM) no solo mejora la precisión y relevancia de las respuestas, sino que también incrementa la consistencia y sensibilidad cultural del sistema. En contextos de alta responsabilidad, una configuración de hiperparámetros que no sea óptima podría resultar en respuestas ambiguas, sesgadas o potencialmente perjudiciales, situaciones que son inaceptables en entornos diseñados para apoyar a personas vulnerables. Por consiguiente, una optimización adecuada es esencial para minimizar el riesgo de errores o malentendidos, asegurando respuestas más seguras y confiables que se adaptan a los requerimientos específicos de los usuarios. Esta práctica garantiza un equilibrio óptimo entre precisión, adaptabilidad y eficiencia, contribuyendo a la creación de sistemas más robustos y seguros, aptos para abordar las complejas demandas de usuarios en situaciones de alta vulnerabilidad.
User
Corrige en un inglés formal y técnico para un artículo científico el siguiente párrafo. Utiliza el mismo estilo para todo el texto. El texto es el siguiente:" La optimización de la configuración de hiperparámetros en el sistema RAG con modelos de lenguaje de gran tamaño (LLM) no solo mejora la precisión y relevancia de las respuestas, sino que también incrementa la consistencia y sensibilidad cultural del sistema. En contextos de alta responsabilidad, una configuración de hiperparámetros que no sea óptima podría resultar en respuestas ambiguas, sesgadas o potencialmente perjudiciales, situaciones que son inaceptables en entornos diseñados para apoyar a personas vulnerables. Por consiguiente, una optimización adecuada es esencial para minimizar el riesgo de errores o malentendidos, asegurando respuestas más seguras y confiables que se adaptan a los requerimientos específicos de los usuarios. Esta práctica garantiza un equilibrio óptimo entre precisión, adaptabilidad y eficiencia, contribuyendo a la creación de sistemas más robustos y seguros, aptos para abordar las complejas demandas de usuarios en situaciones de alta vulnerabilidad. Therefore, the optimal hyperparameter configuration (T^*) is the one that maximizes the objective function (f(T)) while adhering to the constraints (\mathcal{C}). This can be formalized as follows:
Assistant
The optimization of hyperparameter configuration in the Retrieval-Augmented Generation (RAG) system with large language models (LLMs) not only enhances the precision and relevance of responses but also improves the system's consistency and cultural sensitivity. In high-stakes contexts, suboptimal hyperparameter settings might lead to ambiguous, biased, or even harmful responses, which are unacceptable in environments designed to support vulnerable individuals. Therefore, appropriate optimization is crucial to minimize the risk of errors or misunderstandings, ensuring safer and more reliable responses tailored to the specific needs of users. This practice ensures an optimal balance between precision, adaptability, and efficiency, thereby contributing to the development of more robust and secure systems capable of addressing the complex demands of users in high-vulnerability situations. Consequently, the optimal hyperparameter configuration (T^*) is defined as the one that maximizes the objective function (f(T)) while satisfying the constraints (\mathcal{C}). This is formalized as:
Sustituye "Therefore" en la siguiente oración por alguna similar para el contexto. La oración es la siguiente: "Therefore, appropriate optimization is crucial to minimize the risk of errors or misunderstandings, ensuring safer and more reliable responses tailored to the specific needs of users. "
Assistant
Hence, appropriate optimization is crucial to minimize the risk of errors or misunderstandings, ensuring safer and more reliable responses tailored to the specific needs of users.
User
Elabora un hipótesis para la investigación de un artículo científico en la que se trabaja con MCDM y el objetivo principal sería: "mejorar la integración de los sistemas RAG con LLM en las aplicaciones de HCAI que apoyan a personas vulnerables incluyendo migrantes y refugiados."
Assistant
Hipótesis: La implementación de métodos de decisión multicriterio (MCDM) para optimizar la integración de sistemas de Recuperación y Generación Automatizada (RAG) con Modelos de Lenguaje de Gran Tamaño (LLM) en aplicaciones de Inteligencia Artificial Centrada en el Humano (HCAI), mejorará significativamente la efectividad y personalización del soporte brindado a personas vulnerables, incluyendo migrantes y refugiados, mediante una evaluación más precisa y equitativa de necesidades multicriterio, que incluirá factores culturales, lingüísticos y contextuales.
User
Assistant
Hypothesis 1:
The integration of Multi-Criteria Decision-Making (MCDM) methods in optimizing hyperparameters of Large Language Models (LLMs) and Retrieval-Augmented Generation (RAG) systems will enhance the effectiveness and ethical alignment of Human-Centered Artificial Intelligence (HCAI) applications. This integration is expected to result in fair and contextually appropriate responses tailored to the needs of vulnerable populations, such as migrants and refugees, within the European Union. The holistic evaluation of linguistic, technical, and social metrics will lead to more inclusive AI systems that promote better social integration.
Hypothesis 2:
Utilizing Large Language Models (LLMs) combined with Augmented Retrieval Generation (RAG) in Human-Centered Artificial Intelligence (HCAI) can significantly improve the support and integration of vulnerable groups, particularly migrants and refugees, by effectively addressing language-related and procedural barriers prevalent in existing support systems. The optimized tuning of these AI technologies via Multi-Criteria Decision-Making (MCDM) methods will ensure the minimization of bias and promote equitable access to information, thereby enhancing the overall social inclusion and decision-making autonomy of these populations.
Elabora dos hipotesis científicas a partir del siguiente artículo de investigación científica. El texto de los artículos es el siguiente: "\abstract{The enhancement of mechanisms to protect the rights of migrants and refugees within the European Union represents a critical area for Human-Centered Artificial Intelligence (HCAI). Traditionally, the focus on algorithms alone has shifted towards a more comprehensive understanding of AI's potential to shape technology in ways that better serve human needs, particularly for disadvantaged groups. Large Language Models (LLMs) and Augmented Retrieval Generation (RAG) offer significant potential to bridge gaps for vulnerable populations, including immigrants, refugees, and individuals with disabilities. Implementing solutions based on these technologies involves critical factors that influence the pursuit of approaches aligning with humanitarian interests. This study presents a proof of concept utilizing the open LLM model LLAMA 3 and a linguistic corpus comprising legislative, regulatory, and assistance information from various European Union agencies concerning migrants. We evaluate generative metrics, energy efficiency metrics, and metrics for assessing contextually appropriate and non-discriminatory responses. \textcolor{green}{Our proposal involves the optimal tuning of key hyperparameters for LLMs and RAG through multi-criteria decision-making (MCDM) methods to ensure the solutions are fair, equitable, and non-discriminatory. The findings suggest that by employing the appropriate methodologies and techniques, it is feasible to implement HCAI systems based on LLM and RAG without undermining the social integration of vulnerable populations}.
\section{Introduction}
\label{sec:Intro}
The protection of the rights of migrants and refugees within the European Union is an area of significance for Human-Centered Artificial Intelligence (HCAI). We are in an era of creating tools to amplify the human mind without compromising human values \cite{schmidt2020interactive}. Currently, society is shifting its focus towards a more people-centric perspective rather than solely on algorithms. HCAI is deemed suitable as it views technology primarily as a tool to empower, augment, and enhance human agency, aligning with ethics and the science of human flourishing \cite{Dshneiderman2020human}.
Large Language Models (LLM) and Retrieval-Augmented Generation (RAG) are technologies that serve to bridge gaps for vulnerable populations, such as immigrants, refugees, or individuals with disabilities \cite{naveed2023comprehensive}. When combined with Human-Centered Artificial Intelligence (HCAI), these models can become even more effective. HCAI focuses on human interaction and decision-making, which can benefit from the high-quality text generation of LLMs and the precision of RAGs \cite{tahaei2023systematic, zhao2024retrieval}. Together, they can provide a richer, more human-centered user experience. When implementing solutions based on these technologies, it is crucial to consider critical factors to ensure that the approaches align with the interests of individuals \cite{schmager2023defining}. Therefore, it is not only necessary to identify and optimize technical criteria or metrics but also to consider those within the human and social domain.
\textcolor{green}{There is a need for proposals that identify and mitigate biases in models, ensuring that responses and recommendations are fair and non-discriminatory. It is crucial to ensure that technologies do not perpetuate pre-existing biases, but actively work to reduce disparities. These tools should enable users to understand and effectively utilize information for decision-making, without the need for intermediaries. It is essential that these tools value vulnerable individuals as equals. This need should be based on experimental results that allow for the identification of the quality of the assistance provided or the responses to their questions in new systems to be built or in production.}
The inclusion of Multi-Criteria Decision-Making (MCDM) methods is crucial for identifying optimal solutions according to decision-makers, particularly in contexts involving advanced technologies such as Large Language Models and Retrieval-Augmented Generation. These methods enable the simultaneous evaluation of multiple criteria, integrating technical, human, and social aspects, which is essential for ensuring that the solutions adopted are best suited to the needs of vulnerable populations, such as immigrants or individuals with disabilities \cite{mardani2015multiple}. Through the application of MCDM, decision-makers can weigh and prioritize different factors, such as equity, usability, and social impact \cite{ishizaka2011review}, ensuring that technologies are not only technically effective but also promote a fair and inclusive approach. Thus, MCDM serves as a critical tool for aligning technological capabilities with human values and priorities, facilitating decisions that genuinely benefit people in vulnerable situations \cite{aruldoss2013survey}.
In this study, we conducted a proof of concept using the open language model LLAMA 3.0 (Large Language Model Meta AI) and a linguistic corpus containing legislative, regulatory, and assistance information from various agencies in the European space related to immigrants \cite{dubey2024llama}. The proposal involves the optimization of the hyperparameters of both the LLM and RAG. Metrics such as ROUGE (Recall-Oriented Understudy for Gisting Evaluation) Score, perplexity, BLEU (Bilingual Evaluation Understudy) Score, hate bias, stereotypes, and carbon footprint are analyzed to evaluate contextually appropriate responses \cite{lin2004looking, papineni2002bleu, dhamala2021bold, zekun2023towards, castellanos2023improving, castellanos2024strategies}. This framework is designed to enhance Human-Centered Artificial Intelligence systems, leveraging both LLM and RAG models, with the ultimate goal of promoting the integration of the most vulnerable individuals into society through the use of AI.
In this paper, we are pleased to announce that we have made a series of significant contributions, which we will detail in the following sections:
\begin{itemize}
\item A proof of concept is presented in the field of HCAI systems based on LLM and RAG models, with the aim of enhancing the integration of the most vulnerable individuals into society.
\item We have delved into the application of technical, bias, and environmental sustainability metrics to evaluate and enhance the identification and mitigation of biases in algorithmic models, with the aim of ensuring precise, fair, and non-discriminatory responses and recommendations.
\item A set of best practices and recommendations are defined for the development of HCAI systems supported by LLM and RAG to ensure that these technologies do not perpetuate existing biases and actively work to reduce disparities.
\item Multicriteria decision-making methods are integrated into the proof of concept, enabling the simultaneous evaluation of multiple criteria encompassing technical, human, and social aspects.
In the following State of the Art section, we will review the current advancements and challenges in HCAI systems, LLMs, and RAG. Subsequently, in Section 3, we will analyze the main technical metrics, biases, and the optimization of model hyperparameters. In Section 4 introduces RIM, TOPSIS, and VIKOR as multi-criteria decision-making tools. The materials and methods used in our study will be described in Section 5. The results and their discussion are presented in Section 6. Finally, we will summarize our main conclusions and propose future research directions in Section 7.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{State of the Art}
\label{sec:StateArt}
The research delineated by \cite{ozmen2023six} postulates that the pervasive integration of AI inadvertently engenders detrimental repercussions, notably the exacerbation of societal disparities. As a countermeasure, the study introduces six pivotal challenges to the scientific fraternity, underscoring the imperative of cultivating an AI system that is not only centered around human needs and ethics, but also equitable, thereby augmenting the human condition.
Shneiderman \cite{shneiderman2020human} has proposed a widely accepted definition of Human-Centered Artificial Intelligence, which focuses on enhancing human performance by ensuring that systems are reliable, safe, and trustworthy. Complementarily, Vassilakopoulou and Pappas \cite{vassilakopoulou2022ai}, in their study on the interaction between chatbots and human agents, define HCAI as an emerging discipline for AI-driven systems that amplify human abilities while preserving human control and ensuring ethically aligned design. These systems also support human self-efficacy, promote creativity, clarify responsibilities, and facilitate social participation. Nevertheless, users of HCAI encounter several challenges. These include comprehending the operational mechanisms of systems explainability \cite{dwivedi2023explainable}, interpreting the outcomes they produce interpretability \cite{ali2023explainable, rudin2019stop}, safeguarding personal data privacy and security \cite{yuan2019adversarial}, relying on system accuracy reliability \cite{afshari2022machine}, and securing equitable treatment by these systems equity \cite{caton2024fairness}.
In the work of Costabile et al. \cite{costabile2022human}, they develop new tools for interactive exploration that enhance human performance. The proposals of Nagitta et al. \cite{nagitta2022human} analyze the impact of HCAI principles on public procurement, highlighting their importance for public safety and welfare. In the article by Barale \cite{barale2022human}, Claire Barale applies the human-centered approach to natural language processing in the legal field for refugees, promoting a system that supports ethical reasoning.
Retrieval-Augmented Generation combines information retrieval and text generation methods, enhancing the accuracy and relevance of language model responses by incorporating knowledge from external databases. RAG synergistically merges the intrinsic knowledge of large language models with the vast dynamic repositories of external databases \cite{gao2023retrieval,lewis2020retrieval}. LLMs have demonstrated their effectiveness in multiple disciplines, underlining their ability to adapt and optimize language-related tasks, making them valuable tools in various sectors. However, these models often ignore equity considerations and can generate discriminatory results towards marginalized groups \cite{chu2024fairness}. The integration of LLMs with RAG has opened new possibilities in the automation and improvement of information retrieval systems, although their application in specialized areas and social contexts still requires further research \cite{jeong2023study}. LLMs and RAG offer significant potential in the public sector and Non-Governmental Organizations, especially for disadvantaged people, although this field is underexplored and presents equity challenges due to pre-existing biases that can be intensified \cite{zhao2019gender}. Shah et al. \cite{shah2024comprehensive} address these challenges, emphasizing the need for an intersectional and inclusive approach to effectively correct these disparities.
The empirical study by Cao et al. \cite{cao2023assessing} investigates the alignment of LLMs with human societies across diverse cultures. Concurrently, Ferrara \cite{ferrara2023should} elucidates the challenges and risks associated with bias in LLMs, while Hendrycks et al. \cite{hendrycks2020aligning} discuss strategies for aligning Artificial Intelligence with shared human values. Parrish et al. \cite{parrish2021bbq} introduce a bias benchmark for question-answering systems. In parallel, Dhamala et al. \cite{dhamala2021bold} provide a dataset and metrics for measuring biases in open-ended generative models. Rutinowski et al. \cite{rutinowski2023self} delve into the self-perception and political biases of LLMs, and Zhao et al. \cite{zhao2023chbias} evaluate and mitigate bias in Chinese conversational language models. Sheng et al. \cite{sheng2021societal} discuss social biases in language generation, and Simmons \cite{simmons2022moral} demonstrate how LLMs produce moral rationalizations tailored to political identity. Wang et al. \cite{wang2023large} argue that LLMs are not fair evaluators. Lastly, Zhuo et al. \cite{zhuo2023exploring} explore the ethics of AI through a diagnostic analysis. Collectively, these works underscore the complexity and importance of addressing biases and ethics in LLMs.
Aligning the capabilities of these models with the expectations and values of disadvantaged people remains a challenge \cite{saxena2023rethinking}. Adopting an HCAI perspective is promising for designing systems that support autonomy, creativity, and responsibility, also facilitating social participation, while reinforcing privacy, security, environmental protection, social justice, and human rights \cite{shneiderman2020human}. The study by Nelson et al. \cite{nelson2024designing} advocates for further exploration into the development of prompt engineering techniques, suitable metrics, and verification mechanisms for generated summaries, with the aim of maximizing the potential of LLMs in social contexts.
The research presented in this section underscores the fundamental challenges faced by HCAI and AI models such as LLMs. The limited relevance of these models for implementation in practical applications aimed at disadvantaged populations, such as immigrants, is emphasized. Furthermore, it highlights the need to improve not only technical metrics but also social ones, to measure bias and stereotypes. This study aims to make a significant contribution in this field.
\section{Holistic optimization of LLM and RAG-based HCAI systems}
%\section{Metrics with Implications for Environmental Impact, Semantic Similarity, and Bias Mitigation}
This section examines the various metrics employed in the proof of concept, which facilitate the evaluation of natural language processing in the question-and-answer system. It addresses the definition of hyperparameter optimization, assesses the environmental impact of computational processes, and discusses the identification and mitigation of bias.
\subsection{Hyperparameter optimization problem}
Hyperparameter optimization is a crucial step in the construction of a machine learning model, such as LLM and RAG, and can significantly impact accuracy and performance. The pursuit of optimal hyperparameters can be framed as a mathematical optimization problem, as proposed by Lorenzo et al. \cite{lorenzo2017particle}.
The objective is to identify an optimal hyperparameter configuration, denoted as (T^*), that maximizes the objective function (f(T)), subject to the constraints (\mathcal{C}). Here, (T) signifies the set of hyperparameter configurations. The objective function (f(T)) evaluates the model's performance based on a specific hyperparameter configuration (T). The constraints (\mathcal{C}) include any limitations or requirements that the hyperparameter configurations must meet.
\textcolor{blue}{The optimization of hyperparameter configuration in the RAG system with LLMs not only enhances the precision and relevance of responses but also improves the system's consistency and cultural sensitivity. In high-stakes contexts, suboptimal hyperparameter settings might lead to ambiguous, biased, or even harmful responses, which are unacceptable in environments designed to support vulnerable individuals. Consequently, appropriate optimization is crucial to minimize the risk of errors or misunderstandings, ensuring safer and more reliable responses tailored to the specific needs of users. This practice ensures an optimal balance between precision, adaptability, and efficiency, thereby contributing to the development of more robust and secure systems capable of addressing the complex demands of users in high-vulnerability situations.} Therefore, the optimal hyperparameter configuration (T^*) is the one that maximizes the objective function (f(T)) while adhering to the constraints (\mathcal{C}). This can be formalized as follows:
When applying a Multi-Criteria Decision-Making method to hyperparameter optimization, the objective is to find the optimal configuration ( T^* ) that maximizes or minimizes an aggregation function ( S_i ), which evaluates each configuration ( T_i ) based on multiple criteria.
Where ( S_i ) is the aggregated measure of the performance of configuration ( T_i ) across the evaluated criteria. The definition of this aggregated measure depends on the specific MCDM method employed.
For a set of criteria ( C_1, C_2, \dots, C_n ), the aggregated measure ( S_i ) of an alternative ( T_i ) can be expressed as a function ( f(\cdot) ), which combines the weighted scores of the criteria. This function depends on the specific MCDM method:
where ( v_{ij} ) is the value of criterion ( C_j ) for the hyperparameter configuration ( T_i ), and ( w_j ) is the weight associated with criterion ( C_j ), reflecting its relative importance. The function ( f(\cdot) ) could be a weighted linear combination, a Euclidean distance, or a pairwise comparison.
The MCDM-based hyperparameter optimization problem can be expressed as:
where ( S_i ) is the aggregated measure, which varies depending on the MCDM method used.
The constraint ( \alpha_{\text{min}} \leq \alpha \leq \alpha_{\text{max}} ) specifies that the parameter ( \alpha ), which could represent a key parameter in the optimization process, is bounded within a predefined range.
The condition ( \sum_{j=1}^{n} w_j = 1 ) ensures that the weights ( w_j ), assigned to each criterion ( C_j ), sum to 1.
This formalization is applicable to any MCDM method, as it is based on evaluating and combining multiple criteria to find the best hyperparameter configuration ( T^* ). The aggregation function ( S_i ) can be adapted to the specific MCDM method, but the general approach is to maximize or minimize this aggregated measure to optimize the machine learning model's performance.
\subsection{Environmental impact of computational processes}
The determination of the environmental impact in computational processes is influenced by several factors. The factors we will analyze include the energy consumption of the CPU, GPU, TPU, and RAM, which allow for the determination of the carbon footprint of the computation \cite{castellanos2023improving, castellanos2024strategies}.
The calculation of the total power consumption of all active devices ((E_{TotalPU})) is achieved by multiplying the power consumption of the devices by their charging time (see Equation \ref{eq:EnergyTOTAL}).
The power calculation for all CPU devices is denoted by (E_{CPU}) (Equation \ref{eq:EnergyCPU}). (TDP) represents the specific power consumption of the equivalent CPU model under long-term load, and (W_{CPU}) is the total load of all processors. The total power consumption of all active GPUs, denoted as (E_{GPU}). (TDP_{GPU}) is the specific power consumption of the equivalent GPU model and (W_{ GPU}) is the total load of all graphics processing units (Equation \ref{eq:EnergyGPU}). The total power consumption of all active TPUs, denoted as (E_{TPU}) calculates total power of active TPUs. It sums the product of each TPU’s (V_{i}), (C_{i}), and usage (T), and its sequential energy consumption (TPUec_{i}) (Equation \ref{eq:EnergyTPU}). The power consumption of RAM, denoted as (E_{RAM}) (Equation \ref{eq:EnergyRAM}), where (M_{RAM_{i}}) denotes allocated memory (GB) \cite{maevsky2017evaluating, eco2AI}.
%\subsection{Assessing the Carbon Footprint and CO\textsubscript{2}e}
The calculation of CO\textsubscript{2}e equivalent emissions is crucial for a holistic understanding of environmental impact. This calculation encompasses energy consumption, emissions intensity (denoted as γ), and Power Usage Effectiveness (PUE), offering a more profound insight into the sustainability of AI practices. This comprehensive approach includes not only the total energy consumption but also other key parameters, resulting in the equivalent CO\textsubscript{2}e rate as shown in Equation (\ref{eq:EnergyCO2eq}),
\begin{align}
\label{eq:EnergyCO2eq}
CO\textsubscript{2}e = \gamma \cdot PUE \cdot E_{Total}
\end{align}
providing a measure of the carbon emissions associated with the AI operation, enabling a deeper understanding of their sustainability and eco-friendliness.
\subsection{Bilingual Evaluation Understudy}
The BLEU (Bilingual Evaluation Understudy) Score is a metric that evaluates the quality of automatically generated texts by comparing the n-grams of the generated text with one or more reference texts \cite{papineni2002bleu} (see Equation \ref{eq:BLEU}).
where (BP) is the Brevity Penalty, which is computed as:
\begin{align}
BP =
\begin{cases}
1 & \text{si } c > r \
e^{(1 - \frac{r}{c})} & \text{si } c \leq r
\end{cases}
\end{align}
Here, (c) represents the length of the generated text and (r) is the length of the closest reference text, (w_n) is the weight assigned to n-grams of length (n). Generally, (w_n) is equal for all n-grams, (p_n) is the precision of n-grams of length (n), which is computed as:
where (G) represents the generated n-grams, (c_{G}(g)) is the count of a specific n-gram (g) in the generated n-grams, (c_{R}(g)) is the count of a specific n-gram (g) in the reference n-grams.
\subsection{Recall-Oriented Understudy for Gisting Evaluation}
The ROUGE (Recall-Oriented Understudy for Gisting Evaluation) Score is a metric used to evaluate the quality of automatic summaries and other automatically generated texts \cite{lin2004looking}. ROUGE assesses the overlap of n-grams, as well as the matches of subsequences and word pairs between the generated text and the reference texts. Common variants of ROUGE include ROUGE-N, ROUGE-L, and ROUGE-W.
ROUGE-N evaluates the overlap of n-grams (see Equation \ref{eq:ROUGE-N}):
where (R) represents the reference n-grams, (c_{G}(r)) is the count of a specific n-gram (r) in the generated n-grams, y (c_{R}(r)) is the count of a specific n-gram (r) in the reference n-grams.
ROUGE-L evaluates the length of the longest common subsequence (LCS) (see Equation \ref{eq:ROUGE-L}):
ROUGE-W is a weighted variant of ROUGE-L that considers the length of consecutive matches.
\subsection{Perplexity}
Perplexity is a metric used to evaluate language models, indicating how well a model predicts a sample \cite{chen1998evaluation}. A lower perplexity indicates better model performance
The perplexity ((PPL)) for a language model that assigns a probability (P(w_1, w_2, \ldots, w_N)) to a sequence of words (w_1, w_2, \ldots, w_N) (see Equation \ref{eq:PPL}):
where (N) is the total number of words in the sequence and (P(w_i | w_1, w_2, \ldots, w_{i-1})) is the probability assigned by the model to the word (w_i) given the previous sequence of words.
These formalizations provide a mathematical foundation for understanding and utilizing the BLEU Score, ROUGE Score, and perplexity metrics in the evaluation of language models and text generation.
\subsection{Semantic similarity}
The semantic similarity between two words (w_i) and (w_j) can be calculated using the cosine similarity between their corresponding embeddings (v_i) and (v_j) (see Equation \ref{eq:Semantic}).
Let x be a word or token in a vocabulary V. The embedding of x is a vector representation of x denoted as v(x)∈R, where is the dimensionality of the embedding space \cite{chen1998evaluation}.
%The formula for calculating the cosine similarity is as follows:
where (v_i \cdot v_j) is the dot product of the embeddings (v_i) and (v_j).
(||v_i||) and (||v_j||) are the magnitudes (or lengths) of the embeddings (v_i) and (v_j), respectively.
Therefore, Equation \ref{eq:SemanticSS} defines the semantic similarity between the words (w_i) and (w_j).
A hate and stereotype metric is a function that takes a text as input and returns a numerical value quantifying the presence and intensity of hate speech and stereotypes in the text \cite{aluru2021deep, zekun2023towards}. These metrics can be normalized using the following equation:
where ( P(y | x) ) is the probability that the text ( x ) belongs to class ( y ), ( f(x) ) is the output function that takes the input text ( x ) and produces a score for class ( y ), ( K ) is the total number of classes, and ( \exp) is the exponential function.
\section{RIM, TOPSIS, and VIKOR Methods in Multicriteria Decision Making}
In multicriteria decision-making, the methods RIM (Reference Ideal Method), TOPSIS (Technique for Order Preference by Similarity to Ideal Solution), and VIKOR (VIseKriterijumska Optimizacija I Kompromisno Resenje) are widely utilized for evaluating and selecting alternatives based on multiple criteria \cite{cables2016rim, hwang1981multiple, mardani2016vikor}. The RIM, TOPSIS, and VIKOR methods offer distinct approaches to multicriteria evaluation, each with unique strengths and preferred areas of application. RIM is suitable for simpler, more straightforward analyses, TOPSIS is beneficial for clear comparisons with positive and negative ideal solutions, and VIKOR is particularly useful in situations requiring the balancing of trade-offs among criteria.
RIM involves comparing various alternatives against a reference ideal that represents the optimal performance across specified criteria. This approach evaluates alternatives by measuring the distance of each option from the reference ideal, thereby identifying the alternative that is closest to this ideal. In contrast, TOPSIS seeks to identify the alternative with the smallest distance from the positive ideal solution while maximizing the distance from the negative ideal solution. This method entails normalizing the data and calculating either the Euclidean or Manhattan distances to both ideal solutions. VIKOR aims to find a compromise solution that minimizes the regret of decision-makers across all criteria. It employs a compromise index that considers the distances to both the ideal and anti-ideal solutions, weighting these factors appropriately to produce a ranking of the alternatives. Collectively, these methodologies provide structured approaches to decision-making by assessing alternatives in relation to established reference points \cite{hwang1981methods,opricovic2004compromise}.
\section{Materials and Methods}
\label{sec:Materia}
In this section, we present the key details of the methodology employed in our experimentation. The focus is on HCAI and the imperative to integrate social, environmental, and technical metrics when deploying solutions based on AI models, such as LLMs and RGAs. We discuss the experimental design, the software components of the proof-of-concept, and various pertinent metrics.
\subsection{Methodology}
The proposed methodology comprises several phases. Initially, a representative linguistic corpus of the area of interest is selected, which requires minimal storage and processing demands. Subsequently, Large-Scale Language Models, Sentence Transformers, Text Classification Models (Stereotype Detection, Hate Speech Detection), embedding models, and tools for necessary metric evaluation are identified. These models and tools are cohesively integrated to extract, analyze, generate, and evaluate textual information from PDF documents and queries, calibrating efficiency and effectiveness through various adjustable parameters. This approach ensures a comprehensive and efficient analysis of the selected corpus, providing valuable insights into the area of interest. Following this, a Proof of Concept (PoC) is developed for a set of questions posed by individuals in situations of exclusion, utilizing the aforementioned elements. Finally, a comprehensive evaluation of the proposal is conducted, including an analysis of the alternatives using the RIM, TOPSIS, and VIKOR methods.
This methodology is designed to facilitate the validation of HCAI Systems using AI models such as LLM and RAG, along with Multi-Criteria Decision-Making methods. These systems are focused on ethical principles, user-centricity, transparency, and accountability. Furthermore, they contribute to the reduction of the environmental impact caused by the implementation of AI.
\subsection{Dataset}
\label{subsec:Dataset}
In this study, a dataset comprising several gigabytes of information was utilized, compiled in PDF format. For the development of the learning model, official documents issued by public administrations were employed, addressing topics related to immigration and the legal aspects of social integration, as well as the current regulations regarding residency acquisition.
\textcolor{green}{SE UTILIZARON FUENTES COMO LOS MINISTERIOS, DE IGUALDAD; JUSTICIA, COMISIONES EUROPEAS y LEGISLACIÖN EUROPEA...}
Additionally, a systematic repository was created, which includes anticipated questions and answers, serving as a comprehensive manual on various aspects related to residency and immigration legality within the context of the European Community, with a specific focus on Spain, which is positioned as one of the external borders of the European Union. This repository consists of a total of 91 questions organized into the following categories: social integration (18 questions), labor integration (11 questions), family reunification (14 questions), student residency (13 questions), family reunification (7 questions), non-lucrative residency (6 questions), employment-based residency and work authorization (6 questions), self-employment residency and work authorization (6 questions), and long-term EU residency authorization (10 questions).
\subsection{Proof of Concept}
\textcolor{green}{JUSTIFICAR LAS MËTRICAS}
The PoC involves the use and loading of multiple language and text classification models for various purposes, such as text generation, evaluation of linguistic metrics (BLEU, ROUGE, perplexity), and detection of biases and hate speech (Figure \ref{fig:/Modelo_Modelo_V1}). The models are configured and utilized integrally to analyze and extract information from PDF documents, as well as to assess the quality of the generated text using different adjustable parameters.
The query begins in the Questions class, which interacts with the Retriever and LLM to search for information in the LinguisticCorpus and generate responses. The LinguisticCorpus contains official documents (OfficialDocument), and its selection is carried out through the selectCorpus() method. The Retriever uses the searchInCorpus() and returnRelevantDocuments() methods to search for and return relevant documents. These documents are processed by the Generator, which uses the generateResponse() method to generate a response.
The LLM performs complex linguistic modeling operations through the largeScaleLanguageModel() method. The generated responses are evaluated in terms of SemanticSimilarity, EnergyEfficiency, and other metrics (OtherMetrics). Finally, the evaluations of semantic similarity (evaluateResponses()), energy efficiency (evaluateEfficiency()), and other metrics (evaluateOtherMetrics()) are consolidated in the Evaluation class. The relationships between the classes and key methods are indicated by the arrows and associated descriptions.
\begin{figure}[H]
\begin{center}
\includegraphics[width=12 cm]{Figures/Class.png}
\caption{Class diagram of the PoC for the response generation system based on LLM. The diagram clearly organizes the process stages from the Questions initiation and corpus selection to the evaluation of responses generated by the LLM using various evaluation metrics. The relationships between classes and key methods are indicated by the arrows and associated descriptions.
\label{fig:/Modelo_Modelo_V1}}
\end{center}
\end{figure}
\subsection{Experiment}
The experimentation was conducted following the proposed methodology. The details of the experimental dataset are provided in Subsection \ref{subsec:Dataset}. For each parameter, at least five different hyperparameter combinations were tested, resulting in a total of 125 combinations evaluated. The values of the hyperparameters were selected in accordance with the acceptable ranges established by the state of the art in the field.
The parameters used in the experimentation, Chunk Size, Top-K, and Temperature, are critical RAG systems. Chunk Size, with values of 50, 100, 300, 500, and 1 000, defines the size of the text fragments segmented prior to indexing and retrieval, optimizing both system accuracy and performance. \textcolor{green}{\textbf{SE REALIZÓ ANALISIS EXPLORATORIO EN EL QUE SE OBTUVO COMO RESULTADO TENDENCIAS PRELIMINARES ACERCA LOS TAMAÑOS DE Chunk Size.}} Top-K, tested with values of 1, 2, 5, 8, and 10, specifies the number of documents or fragments retrieved to generate a response, with higher values providing more context at the cost of increased complexity and processing time. Temperature, ranging from 0.1 to 0.9, controls the level of randomness in the generated responses, where higher values encourage greater diversity and creativity, while lower values promote more deterministic and conservative responses.
In the experimentation, various models integrated into the PoC are utilized. These models are employed for different tasks within the system, including text generation, semantic similarity evaluation, stereotype and hate speech detection, and the creation of embeddings for information retrieval. The coordination of these models allows for a comprehensive and diverse analysis of the processed texts. For text generation, the Meta-Llama-3-8B-Instruct model from the Causal Language Model is used. The all-MiniLM-L6-v2 model is used to calculate the semantic similarity between the given response and the expected response. The Narrativa/distilroberta-finetuned-stereotype-detection model is employed as a text classification model adjusted for stereotype detection. For the detection of hate speech in Spanish, the pretrained Hate-speech-CNERG/dehatebert-mono-spanish model is used. The BAAI/bge-base-en-v1.5 model is employed as an embeddings model for indexing and similarity-based search. All the models are available on Hugging Face’s website \cite{huggingface}.
In the selection of optimal hyperparameter configurations for the RAG system within a HCAI framework, MCDM methods were utilized, specifically the RIM, the TOPSIS, and VIKOR \cite{cables2016rim, hwang1981multiple, mardani2016vikor}.
A total of 125 hyperparameter configurations were defined by aggregating metrics using the median of the results obtained from 91 questions and their corresponding answers. These configurations constitute the alternatives evaluated using MCDM methods. To apply these methods, a decision matrix was established, along with the weights of the criteria, the typology of the criteria, and specific details for each method.
\textcolor{green}{AMPLIAR LA INFORMACION ACERCA HARDAWRE SOFTWARE del experimento}.
The experiments were conducted on a personal computer equipped with an Intel i7 12700 processor, 32GB of RAM operating at 3600MHz, and an RTX 4090 graphics card with 24GB of GRAM.
\section{Results and Discussion}
This subsection presents and analyzes the main results obtained from the PoC experimentation of a HCAI system, which integrates LLMs and RAGs. The evaluation encompasses both technological and social metrics, focusing on aspects of fairness and non-discrimination, with the aim of preventing hate speech, biases, and stereotypes, as well as minimizing the carbon footprint. Additionally, the process of selecting optimal hyperparameter configurations, achieved through the proposed MCDM methods, is detailed.
The analysis of experimental results from integrating a RAG into a LLM encompasses various evaluation metrics applied across different parameter configurations. These configurations include chunk size, the value of K, temperature, and semantic similarity. Additionally, linguistic performance metrics such as BLEU, ROUGE-1, ROUGE-2, and ROUGE-L are considered, along with the detection of stereotypes and hate speech. The detailed results of this proof of concept are available at the following link \cite{castellanos2024evaluation}.
The results presented demonstrate a complex interplay between the RAG system's parameters and performance metrics, underscoring the critical factors for optimizing text generation. Our analysis reveals that a diminutive Chunk Size (e.g., 50) coupled with an incremental K from 1 to 10 precipitates a decline in similarity and ROUGE metrics, suggesting that the integration of context within smaller processing units may compromise requisite textual cohesion (Table \ref{table:Evalucion10}). This may be due to the fact that a higher K introduces noise by incorporating an excess of contextual information that the system cannot efficiently manage in small data blocks. Conversely, when the Chunk Size is increased to 100, it is observed that raising K to 5 results in an improvement in similarity, indicating a balanced compromise that allows for effective context integration without overwhelming the model with irrelevant information (Figure \ref{fig:/grafica_varia}).
\begin{figure}[H]
\begin{center}
\includegraphics[width=12 cm]{Figures/grafica_varia.pdf}
%\caption{Impact of Chunk Size and Energy Efficiency on Metrics for Evaluating Text Quality
\caption{Comparative evaluation of primary assessment metrics: ROUGE-1, ROUGE-2, ROUGE-L, BLEU, and Similarity, in relation to their corresponding CO2e emissions as a function of Chunk Size.
\label{fig:/grafica_varia}}
\end{center}
\end{figure}
However, when the Chunk Size is expanded to ranges between 300 and 1000, a high K combined with low temperatures tends to be detrimental to performance, likely because larger data blocks, when combined with excessive contextualization, overload the model, adversely affecting text quality and reducing the effectiveness of semantic relationships in the generated content. In this regard, intermediate values of K (2 and 5) appear to offer an optimal balance within chunks of size 100 to 300, maximizing performance without introducing significant levels of noise or redundancy.
Regarding temperature, it is observed that a low value (0.1) tends to stabilize the generated text, leading to higher similarity and BLEU scores with lower values of "K." This indicates a more controlled processing, less susceptible to irrelevant random deviations. In contrast, a temperature of 0.5 offers a balance between the model's accuracy and creativity, though it exhibits some volatility in configurations with larger chunk sizes. The results suggest that configurations with larger chunk sizes (such as 300 or 500), lower K values (2 or 5), and lower temperatures (0.1 or 0.5) tend to produce improved scores in metrics such as BLEU, similarity, and certain ROUGE metrics, while maintaining relatively lower computational costs and \textit{CO\textsubscript{2}e} emissions. However, to optimize specific metrics, such as ROUGE-1 or ROUGE-L, it may be advantageous to explore configurations with higher temperatures. Higher temperatures (0.9) degrade quality metrics due to the introduction of excessive randomness, which negatively affects cohesion in configurations with large chunks and high K values. Additionally, the increase in \textit{CO\textsubscript{2}e} emissions associated with Chunk Size and K indicates a higher computational cost, underscoring the need for a trade-off between efficiency and performance. Perplexity levels, which measure model uncertainty, rise with higher temperatures, potentially impairing performance in configurations requiring high precision. These findings suggest that a moderate Chunk Size, combined with an intermediate K value and medium temperature, optimizes the quality of generated text while efficiently managing computational resources (see Figure \ref{fig:/Diagrama_Calor}).
\begin{figure}[H]
\begin{center}
\includegraphics[width=12 cm]{Figures/Diagrama_Calor.pdf}
\caption{The heat map illustrates the impact analysis of Temperature and the K value on text quality evaluation metrics and energy efficiency.
%Assessing the Impact of Temperature and K Value on Text Quality Evaluation Metrics and Energy Efficiency
\label{fig:/Diagrama_Calor}}
\end{center}
\end{figure}
The examination of relationships with Stereotype, Anti-stereotype, Neutral, NON_HATE, and HATE indicators reveals notable trends influenced by the model's temperature. Stereotype scores increase with temperature, from 0.938 to 0.960 between 0.1 and 0.9, suggesting that higher temperatures capture more biases present in the data. Conversely, the anti-stereotype score also varies with temperature, rising from 0.868 to 0.908 as temperature increases, indicating an enhanced ability of the model to counteract stereotypes. Regarding neutrality, there is a decrease in score from 0.829 to 0.757 with rising temperature, implying that the model generates less neutral and more polarized responses. As for NON_HATE, scores fluctuate slightly from 0.927 to 0.933 with increasing temperature, showing minimal influence. However, the HATE score increases significantly from 0.0 to 0.510 when changing from 0.1 to 0.3, indicating greater capture of offensive content at higher temperatures (Figure \ref{fig:/Grafica_barras})
\begin{figure}[H]
\begin{center}
\includegraphics[width=12 cm]{Figures/grafica_barras.pdf}
\caption{Comparison of average scores for the categories Stereotype, Anti-stereotype, Neutral, NON_HATE, and HATE as a function of Temperature.
\label{fig:/Grafica_barras}}
\end{center}
\end{figure}
Metrics such as Stereotypes, Anti-stereotypes, Neutral, NON_HATE, and HATE exhibit clear trends as a function of Chunk Size. As the Chunk Size increases from 50 to 1000, the stereotype score rises from 0.925 to 0.972, suggesting that larger chunks capture more biases present in the data. Conversely, the Anti-stereotype score decreases from 0.897 to 0.720, indicating a reduced capacity to generate responses that counteract stereotypes. Regarding neutrality, the score declines from 0.804 to 0.668 with increasing Chunk Size, implying a tendency towards more polarized and less objective responses. For the NON_HATE and HATE metrics, the NON_HATE score decreases from 0.931 to 0.818, reflecting a reduced effectiveness in generating non-offensive responses, while the HATE score drops from 0.260 to 0.090, which could be interpreted as a partial mitigation of offensive content in responses generated with larger chunks (Figure \ref{fig:/Grafica_Hate}).
\begin{figure}[H]
\begin{center}
\includegraphics[width=12 cm]{Figures/grafica_Hate_lineas.pdf}
\caption{Trends in Stereotype, Anti-stereotype, Neutral, NON_HATE, and HATE scores as chunk size increases.
\label{fig:/Grafica_Hate}}
\end{center}
\end{figure}
As the value of K increases, the Stereotype score rises, from 0.933 at K=1 to 0.989 at K=10. In contrast, the Anti-stereotype score decreases from 0.886 at K=1 to 0.711 at K=10. Similarly, neutrality declines as K increases, dropping from 0.778 at K=1 to 0.553 at K=10, indicating a shift towards less neutral and more polarized responses. The effectiveness in generating non-offensive responses, as indicated by the NON_HATE score, also decreases, from 0.949 at K=1 to 0.754 at K=10. Additionally, the HATE score shows an increase from 0.084 at K=1 to 0.218 at K=10, suggesting that as the number of neighbors increases, the model may capture more offensive content present in the data.
The analysis of the various metrics used in the experimentation indicates that selecting the optimal or acceptable alternative requires a rigorous evaluation of the different criteria involved. To provide an appropriate solution, MCDM methods are employed, which facilitate the clear and concise structuring of the decision problem, thereby simplifying its analysis.
The RIM, TOPSIS, and VIKOR methods, previously detailed in earlier sections of this article, were utilized. These MCDM techniques offer effective tools for developing RAG systems based on the principles of HCAI. Therefore, the application of these methods provides significant support for solutions similar to those proposed in this PoC.
\begin{figure}[H]
\begin{center}
\includegraphics[width=12 cm]{Figures/heatmap.pdf}
\caption{Results of the RIM, TOPSIS, and VIKOR methods for the 125 alternatives obtained. The figure displays the index values for all three methods.}
\label{fig:/Diagrama_RIM_TOPSIS_VIKOR}
\end{center}
\end{figure}
The results of the analysis of the 125 alternatives using the RIM, TOPSIS, and VIKOR methods are presented in Figure \ref{fig:/Diagrama_RIM_TOPSIS_VIKOR}. Table \ref{table:TOPSIS} shows the top ten ranked alternatives for each of the methods. A high correlation between the results was not observed across the methods. This divergence is primarily due to the differences in the underlying mathematical models and the philosophical approaches of each method. While TOPSIS and RIM focus on proximity to ideal or reference solutions, VIKOR emphasizes trade-offs between criteria, which results in variations in the prioritization of alternatives. The sensitivity of each method to the weighting of criteria contributes to these discrepancies, particularly in contexts where there is significant heterogeneity among the alternatives. The detailed results of this proof of concept are available at the following link \cite{lgforte2024evaluation}.
\subsection{Discussion}
The results obtained from integrating a RAG system into a LLM reveal the critical influence of parameters on the model's performance and the quality of the generated text. In particular, the Chunk Size and the value of K exhibit a complex interaction, where configurations with smaller Chunk Size (e.g., 50) and lower K values tend to compromise textual cohesion, whereas intermediate Chunk Size (100-300) provide a more balanced trade-off between context integration and computational efficiency.
As Chunk size and K increase, a decline in the quality of metrics such as BLEU, ROUGE, and semantic similarity is observed, suggesting that excessive contextualization can overwhelm the model. Furthermore, using lower temperature values (e.g., 0.1) stabilizes text generation, optimizing precision metrics, while higher temperatures (e.g., 0.9) introduce greater randomness, which degrades textual cohesion.
In terms of bias and offensive content generation, an increase in Chunk Size and K leads to higher stereotype scores and a reduction in the model's ability to produce neutral and non-offensive responses. This effect is more pronounced at higher temperatures, emphasizing the importance of precise temperature control in bias-sensitive applications.
The application of MCDM methods (RIM, TOPSIS, and VIKOR) provides a holistic view of optimal configurations, highlighting discrepancies in results due to the differing underlying philosophies of each method. Nevertheless, they offer a valuable framework for evaluating trade-offs between performance and efficiency in RAG systems based on human-centered artificial intelligence principles.
This study demonstrates that integrating RAG systems with LLMs offers significant potential for enhancing HCAI applications aimed at supporting vulnerable populations, including migrants and refugees. Our findings highlight the critical influence of key parameters such as Chunk Size, K value, and Temperature on both the performance and the fairness of the generated text. Specifically, while intermediate chunk sizes and lower temperatures strike an optimal balance between contextual integration and computational efficiency, larger configurations may compromise textual quality and introduce bias.
The results underline the importance of carefully tuning these parameters to avoid issues such as excessive contextualization or bias in responses. Furthermore, our application of MCDM methods provides a comprehensive framework for evaluating trade-offs between technical performance, fairness, and energy efficiency, ensuring that AI systems align with humanitarian and ethical goals.
In conclusion, with proper parameter optimization and the application of robust decision-making frameworks, LLM and RAG-based HCAI systems can effectively serve disadvantaged groups without perpetuating bias or undermining social inclusion. Future research should continue to explore these aspects to refine the design and implementation of equitable AI solutions."