\documentclass[fleqn,10pt]{wlscirep}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amsmath, amssymb}
\usepackage{algorithm}
\usepackage{algorithmic}
\usepackage{subcaption}
\usepackage{geometry}
\usepackage{longtable}
\usepackage{multirow}
\usepackage{hyperref}
\geometry{margin=1in}
\title{A hybrid self \textcolor{blue}{attentive} linearized phrase structured transformer based RNN for financial sentence analysis with sentence level explainability}

\author[2,4]{Md. Tanzib Hosain}%tanjibmahammad@gmail.com
\author[1,4]{Md. Kishor Morol} %kishoremorol@gmail.com
\author[3]{Md. Jakir Hossen*}%jakir.hossen@mmu.edu.my

\affil[1]{Department of Computing and Information Science, Cornell University, New York, United States of America}
\affil[2]{Department of Computer Science \& Engineering, American International University-Bangladesh, Dhaka, 1229, Bangladesh}
\affil[3]{Faculty of Engineering and Technology (FET), Multimedia University, Jalan Ayer Keroh Lama 75450, Bukit Beruang, Melaka, Malaysia}
\affil[4]{Explainable LLM and Interpretable Technology Ensemble Lab (ELITE Lab), New York, United States of America}


\affil[*]{Corresponding E-mails: jakir.hossen@mmu.edu.my}



%\keywords{Keyword1, Keyword2, Keyword3}

\begin{abstract}
As financial institutions want openness and accountability in their automated systems, the task of understanding model choices has become more crucial in the field of financial text analysis. In this study, we propose xFiTRNN, a hybrid model that integrates self-attention mechanisms, linearized phrase structure, and a contextualized transformer-based Recurrent Neural Network (RNN) to enhance both model performance and explainability in financial sentence prediction. The model captures subtle contextual information from financial texts while maintaining \textcolor{blue}{explainability}. xFiTRNN provides transparent, sentence-level insights into predictions by incorporating advanced explainability techniques such as LIME (Local Interpretable Model-agnostic Explanations) and Anchors. Extensive evaluations on benchmark financial datasets demonstrate that xFiTRNN not only achieves a remarkable prediction performance but also \textcolor{blue}{enhances explainability} in the financial sector. This work highlights the potential of hybrid transformer-based RNN architectures for fostering more accountable and understandable Artificial Intelligence (AI) applications in finance.
\end{abstract}
\begin{document}

\flushbottom
\maketitle
% * <john.hammersley@gmail.com> 2015-02-09T12:07:31.197Z:
%
%  Click the title above to edit the author information and abstract
%
\thispagestyle{empty}

\section{Introduction}\label{sec1}
All relevant data regarding traded assets is reflected in prices within an open market in financial markets \cite{malo2014good}. Outperforming the markets consistently is a formidable challenge due to the continuous adjustment of positions and prices by market participants in response to new information. However, the advent of novel information retrieval techniques has the potential to alter the interpretation of "new information," offering short-term advantages if these technologies are adopted promptly. Analyzing financial documents, such as news articles, analyst reports and corporate announcements, can reveal valuable insights. Given the sheer volume of textual data generated daily, manual analysis becomes impractical, making automated sentiment or polarity analysis through natural language processing (NLP) techniques increasingly essential for evaluating texts from financial entities \cite{mishev2020evaluation}. Traditional NLP models have made significant strides in this area, but the need for transparent and explainable predictions remains a pressing concern. \textcolor{blue}{As of on 2012, Knight Capital Group\footnote{\href{https://www.cnbc.com/2012/08/02/the-knight-fiasco-how-did-it-lose-440-million.html}{https://www.cnbc.com/2012/08/02/the-knight-fiasco-how-did-it-lose-440-million.html}} deployed a faulty trading algorithm that executed millions of unintended orders in 45 minutes, losing $\$$440 million and nearly collapsing the firm. This incident underscores a critical challenge in modern finance: complex AI systems can amplify risks when their decision-making processes remain opaque. Similar issues persist today, such as the 2024 NSE's\footnote{\href{https://www.reuters.com/business/finance/indias-nse-pays-765-mln-settle-algo-trading-software-case-2024-10-04/}{https://www.reuters.com/business/finance/indias-nse-pays-765-mln-settle-algo-trading-software-case-2024-10-04/}} $\$$76.5 million settlement, where allegations were related to unfair access to its algorithmic trading software. These real-world failures highlight the urgent need for explainable AI (xAI) in financial applications, where transparency is not merely advantageous but a regulatory and ethical imperative.
}

The role and responsibility of AI have grown immensely, prompting concerns about its trustworthiness. A significant portion of these concerns stems from the prevalent use of "black-box" models, particularly Deep Neural Networks (DNNs). The complexity of these models, with their vast parameter spaces and intricate algorithms, renders them largely uninterpretable to humans, making it difficult to fully understand their decision-making processes . Consequently, these models may harbor biases, relying on unjust, outdated, or incorrect assumptions that can be missed using traditional methods of model effectiveness evaluation . This opacity ultimately erodes trust in such models  .

The term, xAI has arisen to solve the drawbacks of conventional AI. The creation of Machine Learning (ML) methods that produce incredibly successful models that are also explicable, enabling people to comprehend, control and have faith in them is what Barredo Arrieta \emph{et al.} refers to as xAI. According to \cite{arrieta2020explainable}, xAI models are intended to offer explanations or specifics that make their operation understandable. Consequently, the use of xAI helps to make models more reliable, secure and error-free.


This paper is driven by the need to assess market sentiments in real-time amidst ongoing financial crises, leading to a transition from traditional methods to real-time media analysis \cite{huang2023finbert}. In the financial industry, sentiment analysis is still difficult even with major advances in natural language processing (NLP) \cite{mishev2020evaluation}. This calls for the use of domain-specific word lists and adaptive learning algorithms. To maintain confidence and openness in financial decision-making processes, these sophisticated models' opacity and complexity necessitate strong explainability. Particularly in the fields of financial sentence prediction and natural language processing, explainability is needed. With BERT-based systems, there have already been attempts to improve transparency. For instance, exBERT is an interactive dashboard that shows the attention and internal representations of a model, allowing users to create hypotheses regarding the reasoning process of the model \cite{hoover2019exbert}. An alternative method is employed by van Aken \emph{et al.} using visBERT \cite{aken2020visbert}. VisBERT monitors token changes as they go through the network's layers in light of research that suggests attention mechanisms might not be the best choice for explanations \cite{jain2019attention}. It takes hidden states out of each Transformer encoder block and maps them into a 2D space using Principal Component Analysis (PCA) so that semantic links may be deduced from token distances \cite{pearson1901liii}.

We present the Linearized Phrase Structure (LPS) \cite{shao2024linearizing} model using xFiTRNN, with a distinct focus on understanding financial sentiment at the sentence level—a key differentiator from other studies in the field. This model is designed to categorize financial and economic text fragments from an investor's perspective into three groups: positive, negative and neutral. Focusing on the sentence level is crucial in financial contexts because financial documents often contain complex narratives where sentiments can vary significantly within a single document. By analyzing sentiment at the sentence level, the LPS model can accurately capture these nuanced shifts, providing a detailed sentiment profile that is essential for informed investment decisions. With the assessment of explainability techniques—LIME \cite{ribeiro2016should} and Anchors \cite{ribeiro2018anchors}—the LPS model seeks to capture crucial interactions between financial concepts and phrase structures, offering comprehensible and easily understood insights into model predictions. 

\textcolor{blue}{Though recent work in financial NLP has explored hybrid architectures, similar like xFiTRNN, these approaches often treat documents as homogeneous units, missing critical sentence-level nuances. Financial narratives frequently contain mixed sentiments (e.g., "Strong Q3 growth despite regulatory headwinds"), requiring granular analysis. Our Linearized Phrase Structure (LPS) model addresses this gap through three key innovations: (1) syntactic-aware feature extraction that identifies sentiment-carrying phrases, (2) dynamic attention mechanisms weighting these phrases by financial relevance, and (3) integrated explainability interfaces optimized for domain experts.}

\textcolor{blue}{Moreover, though the xAI landscape offers multiple explanation paradigms, each with trade-offs. For instance, SHapley Additive exPlanations (SHAP) \cite{lundberg2017unified} values provide global feature importance but struggle with NLP's sequential nature. Integrated Gradients (IG) \cite{sundararajan2017axiomatic} require baseline selection that may distort financial text interpretations. xFiTRNN strategically combines LIME's local explanations—which identify phrase-level contributors through perturbed samples—with Anchors' rule-based summaries ("The prediction remains positive if 'outperform' appears regardless of other terms"). This dual approach caters to financial analysts' needs, offering both granular insight into specific predictions and actionable decision rules. A detailed comparison of our tested LIME/Anchors performance with SHAP and IG is shown in Section \ref{ATest}.
}

This paper's principal contributions are:

\begin{itemize}
    \item We propose a hybrid sentiment analysis strategy, xFiTRNN specially designed for the financial domain.
    \item We integrate the \textcolor{blue}{transformer-based} FinBERT architecture, BiGRU network and \textcolor{blue}{self-attention} mechanism with linearized phrased-based feature extraction techniques.
    \item We evaluate word embedding strategies in order to determine the most reliable preprocessing and embedding approaches that are necessary for precise financial sentiment analysis performance.
    \item We test the xFiTRNN model against seven conventional ML models, one stacking model and five DL models in our comprehensive trials to evaluate its performance and show its adaptability.
    \item We execute extensive experimental evaluation of xFiTRNN on benchmark Financial Phrasebank and IMBSEntFiN datasets, demonstrating superior predictive performance and enhanced transparency compared to traditional models.
    \item We improve comprehension and confidence in the xFiTRNN model's predictions by offering insights into the explainability of the model through thorough analysis employing LIME and Anchor methodologies.
\end{itemize}

The rest of the paper is organized as follows: To begin with, Section \ref{sec2} provides an overview of the pertinent literature on the subject and lays out the framework for this study, along with some of its limitations. Afterwards, the research approach and methods employed in this study are described in Section \ref{sec4}. Next, the study's analyzed findings are shown in Section \ref{sec5}. \textcolor{blue}{Later, Section \ref{xai-musk} analyzed the explainability test's results of the proposed model.} Subsequently, Section \ref{sec6} offers an in-depth analysis of the subject matter together with a critical assessment of the findings and their implications for future study. Section \ref{sec7} finally brings the paper to a close.

\section{Related Works}\label{sec2}
Recent studies in financial sentiment analysis using DL and ML reveal significant advancements. Huang \emph{et al.} show that ChatGPT 3.5 outperforms FinBERT in forex sentiment analysis through effective zero-shot prompting \cite{huang2023finbert}. Mishev \emph{et al.} present a novel method using sequential minimal optimization with a decision tree, achieving 89.47\% accuracy in Twitter sentiment analysis \cite{mishev2020evaluation}. Fatouros \emph{et al.} introduce a sentence-level analysis approach, improving accuracy and context preservation in financial news sentiment analysis \cite{fatouros2023transforming}. Sousa \emph{et al.} evaluate various algorithms for financial sentiment analysis, including DL models, highlighting the importance of preprocessing stages \cite{sousa2019bert}. Naresh and Venkata develop FinBERT, a finance-specific model excelling in sentiment classification and ESG issue identification \cite{naresh2021efficient}. Aslam \emph{et al.} find that NLP transformers outperform traditional lexicon-based methods, especially with limited data \cite{aslam2022sentiment}. Ahmad and Umar demonstrate the effectiveness of convolutional neural networks in analyzing StockTwits sentiments \cite{ahmad2023sentiment}. Ahmad \emph{et al.} achieve high accuracy with their LSTM-GRU ensemble model for cryptocurrency sentiment analysis \cite{ahmad2022comparative}. Daudert proposes integrating diverse text sources for enhanced sentiment analysis, introducing a novel multi-text approach \cite{daudert2021exploiting}. Consoli \emph{et al.} present FiGAS, an unsupervised method for fine-grained sentiment analysis, outperforming traditional methods \cite{consoli2022fine}. Yadav \emph{et al.} find that noun-verb combinations are effective for sentiment analysis in financial news, despite limitations in dataset size \cite{yadav2020sentiment}. Xing \emph{et al.} dissect error patterns in sentiment analysis and introduce StockSen, a new corpus for financial sentiment analysis \cite{xing2020financial}. Du \emph{et al.} advocate for hybrid models integrating symbolic and subsymbolic methods for targeted aspect-based sentiment analysis \cite{du2023incorporating}. Zhang \emph{et al.} introduce a retrieval-augmented framework, improving LLM performance for sentiment analysis \cite{zhang2023enhancing}. Štrimaitis \emph{et al.} assess sentiment analysis methods for Lithuanian financial news, identifying effective classification algorithms \cite{vstrimaitis2021financial}. Liapis \emph{et al.} demonstrate that LSTM models excel in multivariate financial time series forecasting with sentiment analysis \cite{liapis2021multi}. Du \emph{et al.} develop FinSenticNet, a concept-level lexicon for financial sentiment analysis, surpassing traditional methods \cite{du2023finsenticnet}. Hansen and Borch emphasize the role of alternative data, including sentiment analytics, in investment management and algorithmic trading \cite{hansen2022alternative}. Hartmann \emph{et al.} find state-of-the-art language models superior to traditional methods in sentiment analysis \cite{hartmann2023more}. Chang \emph{et al.} combine aspect-level sentiment analysis with visual analytics to assess airline industry customer satisfaction during the COVID-19 crisis \cite{chang2022predicting}. Zhang \emph{et al.} survey emotion fusion strategies for mental illness detection in social media \cite{zhang2023emotion}. Singh \emph{et al.} review the application of RL and DRL in financial decision-making, highlighting their superior performance \cite{singh2022reinforcement}. Leelawat \emph{et al.} analyze sentiments in tourism-related tweets using ML algorithms, finding support vector machines most effective \cite{leelawat2022twitter}. Kuma \emph{et al.} review sustainable finance research and advocate for the integration of AI and big data techniques \cite{kumar2022past}. Alsayat introduces an ensemble DL model for sentiment analysis in social media during the coronavirus pandemic, demonstrating superior accuracy \cite{alsayat2022improving}. \textcolor{blue}{Multimodal architectures, the combination of textual sentiment with market data to enhance both predictive performance and explainability are emerging nowadays. Passalis \emph{et al.} fuse news sentiment with trading volumes, enabling models to validate language patterns against market reactions—for instance, distinguishing between "rally" in bullish versus pump-and-dump contexts \cite{passalis2022multisource}. However, their late fusion approach (concatenating text and numerical features) obscures cross-modal interactions. Recent work by Valle-Cruz \emph{et al.} demonstrates the promise of early fusion: aligning tweet sentiment scores with real-time price movements in a joint embedding space \cite{valle2022does}. While improving hedge signal detection, this complicates explanations as market data dominates text features in gradient-based attributions.
}

Furthermore, there has been an increasing focus on developing explainable financial sentence prediction approaches \cite{rizinski2024sentiment}. Fatouros \emph{et al.} highlighted the use of attention mechanisms in sentence-level analysis, which not only improved accuracy but also provided insights into which parts of the text influenced the model's decisions \cite{makridis2023xai}. This approach helps analysts understand the key drivers behind sentiment classifications. Ardizzone \emph{et al.} advocated for hybrid models that combine symbolic methods (which are more interpretable) with subsymbolic methods (like neural networks) \cite{ardizzone1992integrating}. This integration allows for targeted aspect-based sentiment analysis, offering a clearer understanding of how specific features contribute to predictions. Du \emph{et al.} developed FinSenticNet, a concept-level lexicon that enhances the \textcolor{blue}{explainability} of sentiment analysis in financial texts \cite{du2023finsenticnet}. By providing concept-level insights, this model surpasses traditional methods in explaining how different sentiment scores are derived. Chang \emph{et al.} explored the combination of aspect-level sentiment analysis with visual analytics \cite{chang2022predicting}. This approach aids in explaining model outputs by visually representing how different aspects of a text, such as sentiment towards specific entities, are analyzed, thus enhancing user understanding and trust. Additionally, these models can provide more granular explanations of sentiment shifts, especially in response to potentially manipulative inputs.

\textcolor{blue}{However, current xAI approaches in finance exhibit distinct trade-offs. While Fatouros \emph{et al.} use attention weights to highlight sentiment keywords, high attention to "dividend" might reflect either positive yield or negative tax implications \cite{fatouros2023transforming}. LIME \cite{ribeiro2016should} generates local explanations by perturbing input phrases, crucial for analyzing earnings calls where negation scopes (e.g., "not sustainable") determine sentiment. However, its random sampling struggles with financial jargon’s sparsity. IG \cite{sundararajan2017axiomatic} attributes predictions to input features via path integrals, but requires careful baseline selection—a zero-vector baseline may misattribute significance to stopwords in SEC filings. Anchors \cite{ribeiro2018anchors} create IF-THEN rules (e.g., "IF 'beat estimates' THEN positive"), aligning well with analysts’ checklist-driven workflows but oversimplifying compound phrases like "beat estimates despite inflation risks". We selected LIME \cite{ribeiro2016should} and Anchors \cite{ribeiro2018anchors} for their complementary strengths: LIME’s phrase-level perturbations suit financial sentences’ compact structure, while Anchors’ rules provide auditable decision logic for compliance purposes. In pilot studies, SHAP \cite{lundberg2017unified} underperformed for financial texts—its global feature importance scores conflated sector-specific terms (e.g., "P/E ratio" mattered equally in tech and banking analyses), reducing actionability.
}

After these vast advancements, there exists many limitations. Fatouros \emph{et al.} limitations are their  study include a constrained dataset duration potentially affecting model performance across different periods, an inability of the short dataset to fully capture the complexities of financial markets and challenges in generative AI such as model collapse when relying heavily on synthetic training data, leading to limited or repetitive model outputs \cite{fatouros2023transforming}. Lutz \emph{et al.} limitations include a lack of comprehensive testing on diverse datasets for model validation, which is critical for understanding the complex interplay between news sentiment and market movements \cite{sousa2019bert}. The lack of \textcolor{blue}{explainability} in many advanced models, especially Deep Learning (DL) ones, poses another limitation, as it becomes difficult to understand the rationale behind certain predictions \cite{thompson2020computational}. Furthermore, the substantial computational resources required for training and maintaining sophisticated models can be a limiting factor \cite{jordan2015machine}. Real-time predictions are also hampered by time lags between the release of financial news and its impact on the market \cite{xu2024ai, go2020analysis}. Models trained on data from one financial market or region may not perform well in different contexts due to varying economic conditions and market behaviors, highlighting issues with transferability. There is also a risk of overfitting to historical data, particularly when the dataset is limited, leading to poor generalization to new data \cite{ying2019overview}. \textcolor{blue}{Also, most methods explain static predictions, inadequate for financial time series where sentiment persistence matters (e.g., sustained "inflation fears" vs. one-off mentions and existing tools don’t map explanations to FINRA’s Model Validation Guidelines\footnote{\href{https://www.finra.org/rules-guidance/rulebooks/finra-rules}{https://www.finra.org/rules-guidance/rulebooks/finra-rules}} requiring "traceable logic for material predictions". Leippold shows keyword-based models fail against financial adversarial examples like "growth" → "groWth" (Unicode spoofing)—a vulnerability extending to explanation methods relying on surface tokens \cite{leippold2023sentiment}.} Additionally, financial news and reports often contain human biases, which can be inadvertently learned by the models, resulting in skewed predictions. These additional limitations underscore the complexity of financial markets and the challenges involved in developing robust prediction models. \textcolor{blue}{The proposed LPS model tried tackling these through tracking sentiment carriers across sentences via dependency parsing, Anchors rules formatted as MiFID II-compliant decision logs\footnote{\href{https://www.esma.europa.eu/publications-and-data/interactive-single-rulebook/mifid-ii}{https://www.esma.europa.eu/publications-and-data/interactive-single-rulebook/mifid-ii}} and extending FinBERT’s vocabulary to detect glyph attacks.}


\section{Methodology  }\label{sec4}
This section details datasets used in this experiment, each model’s theoretical foundation, operational principles, evaluation metrics and relevance to the research objectives, focusing on their application in financial sentiment analysis. To uncover patterns in the proposed models’ predictions and understand how these patterns influenced the decisions with proper explainability, the following scenarios were examined: when the classifier accurately classified a title as a negative statement, when the classifier accurately classified a title as a positive/neutral statement, when the classifier inaccurately classified a title as a negative statement and when the classifier inaccurately classified a title as a positive/neutral statement.

\subsection*{Datasets}
The Financial Phrasebank \cite{Malo2014GoodDO} and SEntFiN \cite{sinha2022sentfin} datasets used in this work are available to the public. In order to create IMBSEntFiN, we first average the real classes and then alter the class weights for each sentence in the SEntFiN \cite{sinha2022sentfin} dataset, which was refined into an unbalanced classification format. The dataset has the dependent variable inserted manually. Following this, the dataset was divided into training and testing sets, with 80\% of the samples going toward training. The model's predictions were added to the test data in a new column when it finished the classification assignment. Fig. \ref{fig1} presents the most frequent words in the datasets of financial sentences which are displayed in word cloud format.


\begin{figure}[htbp]
    \centering
    % Subfigure 1
    \begin{subfigure}[b]{0.49\textwidth} 
        \centering
        \includegraphics[width=\textwidth]{Financial Phrasebank.png} 
        \caption{Financial Phrasebank word cloud}
    \end{subfigure}
    \hfill
    \begin{subfigure}[b]{0.49\textwidth}
        \centering
        \includegraphics[width=\textwidth]{IMBSEntFiN.png}
        \caption{IMBSEntFiN word cloud}
    \end{subfigure}

    \caption{The most frequent words \textcolor{blue}{retrieved by python $wordcloud$} in the "Financial Phrasebank" (left) and "IMBSEntFiN" (right) datasets of financial sentences are displayed in this word cloud. Each word's magnitude reflects how frequently it occurs in the dataset.}
    \label{fig1}
\end{figure}

\subsection*{Data preprocessing}
Due to the informal and unstructured nature of financial sentence data, preprocessing was necessary to ensure the precision and truthfulness of our study. The following essential stages were part of our extensive data-cleaning procedure:

\begin{itemize}
    \item \textbf{Normalization of text:} 
    Converted all text to lowercase to standardize word recognition and avoid treating words with different capitalization as distinct entities.
    
    \item \textbf{Removal of irrelevant elements:}
    Eliminated hashtags (\texttt{\#topic}), mentions (\texttt{@name}) and hyperlinks (e.g., \texttt{http}, \texttt{https}).
    Excluded words shorter than two characters and common stop words with minimal relevance to sentiment.
    Retained negations such as \texttt{not} and \texttt{no} to preserve sentence context.

    \item \textbf{Handling repeated characters:}
    Normalized words with repeated characters used for emphasis (e.g., \textit{greeeeat profit} converted to \textit{great profit}) to align with standard lexicons.

    \item \textbf{Expansion of contraction:}
    Expanded contractions like \textit{isn't} and \textit{can't} into their full forms (e.g., \textit{is not} and \textit{cannot}) to maintain semantic clarity and consistency.
    

    \item \textbf{Removal of non-alphabetical characters:}
    Stripped numerals, punctuation marks and special symbols, retaining only alphabetical characters to prevent interference in feature extraction.
    

    \item \textbf{Deduplication and removal of empty entries:}
    Identified and removed duplicate sentences and empty entries to ensure dataset integrity.
    

    \item \textbf{Advanced cleaning for specific methods:}
    Applied additional techniques, such as stemming and Part-of-Speech (POS) tagging, tailored to the requirements of specific sentiment analysis approaches. These were particularly useful for leveraging financial sentiment resources like specialized lexicons.
    
\end{itemize}

\subsection*{Word embeddings}
\subsubsection*{TF-IDF}
The scikit-learn module's "TfidfVectorizer" function, which assigns weights to words based on their scarcity throughout the entire dataset and their relevance in individual sentences, was used to apply the TF-IDF embeddings. It also simplified the process of down-weighting frequently used keywords, freeing up our models to focus on more informative terms.

\subsubsection*{Word2Vec}
Word2Vec's power to capture semantic similarities between words is one of its benefits; this enhances the sophistication of text data analysis. It expresses words as dense vectors in a continuous vector space using neural networks. The financial sentences were tokenized using the NLTK library's $word\_tokenize$ function, which breaks sentences down into individual words. A Word2Vec model with the vector size, window size and skip-gram model set was created using the Gensim software. This method was able to represent words as vectors by utilizing a continuous vector space. Full sentences were encoded as vectors using two techniques: average vectorization and sum vectorization.

\subsubsection*{GloVe}
GloVe is a potent word embedding method that builds dense vector representations using a corpus's co-occurrence statistics to capture the semantic associations between words. We trained a GloVe model customized for our dataset using the glove library. Using the $word\_tokenize$ function from the NLTK package, the sentences were tokenized into individual words as part of the preprocessing. After that, a co-occurrence matrix was produced, taking into account a context window to record word connections. The GloVe model was trained to generate embeddings that accurately capture words' global semantic features as well as their local context. The model was then able to identify significant patterns and connections in the text by mapping each word in the dataset to its vector representation using these embeddings.

\subsubsection*{FastText}
FastText is a sophisticated word embedding method that improves on conventional approaches by adding subword information. This makes it useful for handling uncommon or non-vocabulary terms. The FastText model from the Gensim package was used to train dataset-specific embeddings. Using the $word\_tokenize$ function from the NLTK library, the procedure started by tokenizing sentences into individual words. Then, by decomposing words into character-level n-grams and learning their representations, the FastText model was trained to produce word embeddings. This method makes the model resilient for assessing text in many languages and handling invisible words by allowing it to capture both word-level semantics and subword structures. Following training, embeddings for every word in the dataset were available, proving the model's efficacy in capturing morphological and semantic information.

\subsubsection*{Pretrained transformers}
We used the Hugging Face Transformers library's pre-trained transformer-based models to exploit contextual embeddings for text data in our study. Three different transformer models, each contributing special skills to the study, were used. Known for its effectiveness and portability, the "distilbert-base-uncased" model was chosen because it works well in situations with limited computing resources. The left and right context of each word are taken into account while creating context-aware word embeddings. To convey the subtleties unique to finance in text, we employed a cutting-edge "yiyanghkust/finbert-tone" model. Our sentiment analysis efforts were firmly based on this model, which was created for financial sentiment research. We have included "sentence-transformers/all-MiniLM-L6-v2," a complex tool that converts text into a dense vector space.
It preserves semantic information while converting whole phrases into fixed-dimensional vectors. While each transformer's code implementation had a similar structure, the model selection added variety to our testing and allowed us to investigate how contextual embeddings affected our text classification task. We utilized the model's related tokenizer to efficiently tokenize and process our text data, utilizing strategies like truncation and padding to guarantee constant input lengths. For best computational performance, the tokenized data was then effectively processed on the GPU. We also used the model's ability to extract the hidden states linked to the "[CLS]" token, which frequently captures the text's entire context.

\subsection*{Models used}
This subsection discusses various ML classifiers. Additionally, it explores an advanced hybrid transformer \cite{peng2023rwkv} and attention based \cite{kabir2025lstm, cao2024advanced} RNN model, xFiTRNN for our tests as our proposed novel financial sentiment classification framework. This section details each model's theoretical foundation, operational principles and relevance to the research objectives.

\subsubsection*{Conventional ML models}
\textbf{Ada Boost Classifier:}
Ada Boost Classifier, or Adaptive Boosting, is a powerful ensemble method to enhance the performance of weak classifiers \cite{mathanker2011adaboost}. It operates by iteratively training a sequence of weak learners, typically decision trees, on various weighted versions of the training data. Initially, all data points are assigned equal weights. A weak classifier $h_m(x)$ is trained in each iteration $m$ and its error rate $\epsilon_m$ is defined by Eq. (\ref{eq:1}):
\begin{equation}
\epsilon_m = \frac{\sum_{i=1}^{N} w_i \mathbb{I}(h_m(x_i) \neq y_i)}{\sum_{i=1}^{N} w_i}
\label{eq:1}
\end{equation}
where the indicator function is $\mathbb{I}$, the true labels are $y_i$, the training examples are $x_i$ and the weights are $w_i$. The weight $\alpha_m$ of the classifier is then calculated by Eq. (\ref{eq:2}):
\begin{equation}
\alpha_m = \frac{1}{2} \ln \left(\frac{1 - \epsilon_m}{\epsilon_m}\right)
\label{eq:2}
\end{equation}
which reflects its accuracy. Subsequently, the weights of misclassified instances are increased using Eq. (\ref{eq:3}):
\begin{equation}
w_i \leftarrow w_i \exp(\alpha_m \mathbb{I}(h_m(x_i) \neq y_i))
\label{eq:3}
\end{equation}
focusing the next classifier on harder cases. The final prediction is made by a weighted majority vote of the weak classifiers calculated as Eq. (\ref{eq:4}):
\begin{equation}
H(x) = \text{sign} \left( \sum_{m=1}^{M} \alpha_m h_m(x) \right)
\label{eq:4}
\end{equation}
This iterative boosting approach allows the model to effectively capture complex patterns in financial sentiment, leading to more accurate predictions.

\textbf{Extra Trees Classifier:}
Extremely Randomized Trees, sometimes referred to as Extra Trees Classifier, is an ensemble learning method that generates the mode of the classes (classification) for individual trees after training a large number of decision trees \cite{baby2021leukocyte}. It functions by constructing several trees, each of which is trained using random splits in the nodes over the whole dataset. It randomly picks a subset of features $F_k$ and finds the best split among them, as opposed to searching for the best split among all available features for each node split in tree $T_k$. Eq. (\ref{eq:5}) is used to determine the decision function for a node $n$:
\begin{equation}
f_n(x) = \sum_{j=1}^{d} \mathbb{I}(x_j \leq \theta_{n,j})
\label{eq:5}
\end{equation}
where $x$ represents the input vector, $d$ is the number of features and $\theta_{n,j}$ are the threshold values for the splits. The output of the ExtraTreesClassifier for an input $x$ is determined by majority voting from all the individual trees calculated as Eq. (\ref{eq:6}):
\begin{equation}
H(x) = \text{mode} \{ T_k(x) \}_{k=1}^K
\label{eq:6}
\end{equation}
where $K$ is the total number of trees. This approach reduces variance and helps in capturing intricate patterns in financial sentiment data, leading to robust and accurate sentiment predictions.

\textbf{LDA:}
LDA is a statistical method is used to find the linear combination of qualities that best splits a collection of classes into two or more \cite{balakrishnama1998linear}. It is considered that the data from each class is normally distributed and that all classes have a common covariance matrix. For a given dataset that comprises the classes $C_1$, $C_2$ \ldots $C_k$, the objective of latent difference analysis (LDA) is to optimize the ratio of within-class variance to between-class variance. Eqs. (\ref{eq:7}) and (\ref{eq:8}) define the within-class scatter matrix $S_W$ and the between-class scatter matrix $S_B$:

\begin{equation}
S_B = \sum_{i=1}^{k} N_i (\mu_i - \mu)(\mu_i - \mu)^T
\label{eq:7}
\end{equation}

\begin{equation}S_W = \sum_{i=1}^{k} \sum_{x \in C_i} (x - \mu_i)(x - \mu_i)^T
\label{eq:8}
\end{equation}
where $N_i$ is the number of samples in class $C_i$, $\mu_i$ is the mean vector of class $C_i$ and $\mu$ is the overall mean vector of the dataset. The optimal linear discriminants are found by solving the generalized eigenvalue problem as defined Eq. (\ref{eq:9}):
\begin{equation}
S_W^{-1} S_B w = \lambda w
\label{eq:9}
\end{equation}
where $\lambda$ are the eigenvalues and $w$ are the eigenvectors. The resulting linear discriminants are then used to project the data into a lower-dimensional space for classification. In the context of financial sentiment analysis, LDA effectively reduces dimensionality while preserving class separability, allowing for the accurate classification of sentiment in financial texts.

\textbf{QDA:}
QDA is a classification technique in which non-linear decision boundaries are possible since each class is modeled with a unique covariance matrix \cite{bose2015generalized}. QDA operates on the assumption that every class $C_k$ has its own covariance matrix $\Sigma_k$, in contrast to Linear Discriminant Analysis (LDA), which operates under the assumption that all classes share a single covariance matrix. For a given input $x$, the posterior probability for class $C_k$ is calculated using Bayes' theorem, Eq. (\ref{eq:10}):
\begin{equation}
P(C_k|x) = \frac{P(x|C_k) P(C_k)}{P(x)}
\label{eq:10}
\end{equation}
where $P(x|C_k)$ is the class-conditional density function given by the multivariate normal distribution computed as Eq. (\ref{eq:11}):
\begin{equation}
P(x|C_k) = \frac{1}{(2\pi)^{d/2} |\Sigma_k|^{1/2}} \exp \left( -\frac{1}{2} (x - \mu_k)^T \Sigma_k^{-1} (x - \mu_k) \right)
\label{eq:11}
\end{equation}
with $d$ being the number of features, $\mu_k$ the mean vector and $\Sigma_k$ the covariance matrix for class $C_k$. The decision rule assigns $x$ to the class with the highest posterior probability defined as Eq. (\ref{eq:12}):
\begin{equation}
\hat{y} = \arg\max_k \left( \log P(C_k) - \frac{1}{2} \log |\Sigma_k| - \frac{1}{2} (x - \mu_k)^T \Sigma_k^{-1} (x - \mu_k) \right)
\label{eq:12}
\end{equation}
QDA captures the complex relationships and variations in sentiment by leveraging class-specific covariance structures, leading to more nuanced and accurate sentiment classification.

\textbf{XGB Classifier:}
 XGB Classifier is an implementation of the Extreme Gradient Boosting technique combining the predictions of several weak learners, specifically decision trees \cite{chang2022melanoma}. It builds an ensemble of trees one after the other, with each new tree trying to fix the mistakes of the older ones. The model iteratively adds trees to a given dataset $\{(x_i, y_i)\}_{i=1}^N$ in order to minimize the objective function, which is specified as Eq. (\ref{eq:100}): 


\begin{equation}
    L(\Theta) = \sum_{i=1}^N l(y_i, \hat{y}_i^{(t)}) + \sum_{k=1}^t \Omega(f_k)
\label{eq:100}
\end{equation}

where $L$ is a differentiable loss function (e.g., logistic loss for binary classification), $\hat{y}_i^{(t)}$ is the prediction of the $t$-th tree and $\Omega$ is a regularization term controlling the complexity of the model, with $T$ being the number of leaves and $w_j$ the leaf weights defined as Eq. (\ref{eq:101}):

\begin{equation}
    \Omega(f_k) = \gamma T + \frac{1}{2} \lambda \sum_{j=1}^T w_j^2
\label{eq:101}
\end{equation}

Every time a new tree is fitted, the gradient and hessian of the loss function are utilized to enhance the model's predictions. $\hat{y}_i$ is the ultimate forecast, as determined by (Eq. \ref{eq:102}):

\begin{equation}
    \hat{y}_i = \sum_{t=1}^T f_t(x_i)
    \label{eq:102}
\end{equation}
XGB Classifier efficiently captures complex patterns and interactions within the data, leading to high-performing and accurate sentiment predictions.
  
\textbf{Gradient Boosting Classifier:}
Gradient Boosting Classifier is a potent ensemble learning technique which creates an additive model step-by-step ahead by successively fitting new models to fix the mistakes caused by the old ones \cite{khan2022water}.Reducing the loss function $L(y_i, F(x_i))$, where $F(x_i)$ represents the model's prediction, for a given dataset $\{(x_i, y_i)\}_{i=1}^N$ is the goal. A fresh weak learner $h_m(x)$ is trained to fit the loss function's negative gradient at each step $m$. This function is the residual error of the current model, which is determined by Eq. (\ref{eq:13}). 

\begin{equation}
r_{i}^{(m)} = -\left[\frac{\partial L(y_i, F(x_i))}{\partial F(x_i)}\right]_{F=F^{(m-1)}}
\label{eq:13}
\end{equation}
The model is then updated as Eq. (\ref{eq:14}):
\begin{equation}
F^{(m)}(x) = F^{(m-1)}(x) + \nu h_m(x)
\label{eq:14}
\end{equation}
where $\nu$ is the learning rate. Commonly, decision trees are used as weak learners and the final prediction is given by Eq. (\ref{eq:15}):
\begin{equation}
F(x) = \sum_{m=1}^{M} \nu h_m(x)
\label{eq:15}
\end{equation}
Gradient Boosting Classifier effectively captures intricate patterns and trends in sentiment data by iteratively focusing on and correcting the hardest-to-predict instances, leading to highly accurate sentiment classification.

\subsubsection*{Modern DL models}
A variety of DL models, each with unique architectural features, were used to thoroughly assess twitter sentiment categorization. For optimum performance, we tuned the hyperparameters of these models using the Keras Tuner. There were GRU layer units between 128 and 768, dense layer units between 64 and 512, dropout rates between 0.1 and 0.5 and learning rates between $1 \times 10^{-5}$ and $1 \times 10^{-3}$ in the search space. We found the optimal settings for each model using Keras Tuner's Random Search technique, which greatly improved their performance. This methodical investigation, together with thorough text representations and adjusted hyperparameters, yielded insightful information about how well different DL architectures performed. A transformer was used to extract features in our first model, the "1-Dense Layered NN." High-level representations were recorded by a single dense layer with 512 units and ReLU activation. We were able to set a benchmark for performance comparison because of this architecture's simplicity.
We presented the "2-Dense Layered NN" and "3-Dense Layered NN" to build on this framework. Three successive dense layers with decreasing units (256 and 128) and (512, 256 and 128) were added to gradually improve feature representations after global averaging of the transformer's outputs. To improve model resilience, dropout regularization was specifically implemented after the first dense layer.
In order to better investigate the subtleties, we developed the "BiGRU + 3 Hidden Dense Layers" model. The BiGRU layer, a unique kind of RNN, was included into this design to allow the network to recognize sequential relationships in the input data. The features were further refined using three more dense layers (512, 256 and 128 units) after the BiGRU layer. To improve the generalization of the model, dropout was used.
In conclusion, we investigated hybrid architecture using the "BiGRU + CNN" model. Here, the model incorporated the advantages of convolutional layers and a BiGRU layer. Feature extraction gained a spatial view from the convolutional layers, which included 64 filters and different kernel sizes. The collected characteristics were then further processed by adding two thick layers (128 and 64 units).



 
\subsubsection*{Proposed model}
\begin{figure}[htbp]
        \centering
        \includegraphics[width=\linewidth]{11111.pdf}
        \caption{Architecture of the proposed xFiTRNN model.}
        \label{figxxxxx}
\end{figure}

The proposed xFiTRNN model offers an innovative architecture for financial sentiment analysis, as depicted in Fig. \ref{figxxxxx}. This model leverages the power of contextual embeddings from pre-trained transformers, FinBERT, to capture the intricate language used in financial texts. The architecture commences with input layers, namely $input\_ids$' and $attention\_mask$, accommodating sequences up to 256 tokens to ensure comprehensive coverage of the input data For training, the input data is jumbled, batched and arranged into a TensorFlow dataset. A batch size of 16 is chosen to enable effective training. In order to get the labels ready for multiclass classification, they are one-hot encoded. To ensure thorough examination, the dataset is divided into training and validation sets. Keras Tuner plays a key part in FiTRNN model optimization by methodically examining a well defined search space to adjust different hyperparameters. The number of BiGRU layer units, which ranges from 128 to 512 and balances model complexity and performance, is part of the search space. Furthermore, three Dense layers are adjusted with units that range from 128 to 768, 64 to 512 and 32 to 256, respectively, which has an impact on the computing needs and model's capability. While the learning rate is logarithmically explored between $1 \times 10^{-5}$ and $1 \times 10^{-3}$ to maximize convergence speed, the dropout rate fluctuates between 0.1 and 0.5 to avoid overfitting. An effective method of exploring the space without doing an exhaustive search is to use Random Search in the tuning process to sample different hyperparameter combinations. Based on validation loss, the tuner determines the optimal hyperparameter settings (Fig. \ref{figxxxxx}) following several trials, guaranteeing an ideal trade-off between computing efficiency and performance.

The core architecture of the FiTRNN model integrates pre-trained contextual embeddings with BiGRU and self-attention mechanisms, featuring the following enhancements:

\begin{itemize}
    \item \textbf{Input layers:} Two primary input layers, $input\_ids$ and $attention\_mask$ receive the tokenized sequences and their corresponding attention masks. This setup ensures proper handling of variable-length sequences by indicating which tokens should be attended to and which are merely padding.

    \item \textbf{Contextual embeddings:} The pre-trained transformer model, FinBERT generates contextual embeddings that encapsulate rich semantic and syntactic information from the input text. These embeddings effectively represent the nuanced language found in financial documents.

    \item \textbf{BiGRU layer:} The Bidirectional Gated Recurrent Unit (BiGRU) layer captures dependencies in both forward and backward directions of the input sequence. Configured with 512 units in each direction, the BiGRU processes the contextual embeddings to understand the sequential nature of financial narratives fully.

    \item \textbf{SA mechanism:} Incorporating a self-attention layer allows the model to focus on the most relevant parts of the input sequence. This mechanism assigns varying levels of importance to different tokens, enabling the model to highlight key financial terms and sentiments that significantly impact the overall interpretation.

    \item \textbf{Dense layers:} A series of dense layers further abstract the features extracted by the BiGRU and self-attention layers. Starting with a 512-unit dense layer activated by ReLU, followed by layers with 256 and 128 units, the model progressively refines its internal representations. Dropout layers with rates 0.05 determined during hyperparameter tuning are interleaved to prevent overfitting.
    
    \item \textbf{Flatten layer:} A 1D vector is created by flattening the output tensor following processing through the dense layers.
    
    \item \textbf{Classifier head:} Three units make up the dense layer of the classifier head, which uses the softmax activation function. The final sentiment categorization probabilities of the input financial sentence—whether positive, negative, or neutral—are generated by it.The model is constructed using categorical cross-entropy loss and a learning rate of $1 \times 10^{-5}$ using the Adam optimizer. A metric for evaluation is categorical accuracy. Callbacks, early halting and model checkpointing were all used to maximize model training. The early halting method keeps track of validation loss and, in order to avoid overfitting, restores the optimal weights. During the training process, the model is fitted to the training dataset and validated for 50 epochs on the validation dataset. However, because of the early stopping mechanism, the iterations end after 25 epochs.


\end{itemize}

\begin{figure}[htbp]
    \centering
    \begin{subfigure}[b]{0.33\textwidth}
        \centering
        \includegraphics[width=\textwidth]{lr vs e.pdf}
        \caption{$\eta$ vs \textit{t}}
    \end{subfigure}
    \hfill
    % Subfigure 1
    \begin{subfigure}[b]{0.33\textwidth} 
        \centering
        \includegraphics[width=\textwidth]{acc vs n.png} 
        \caption{$A$ vs $\eta$}
    \end{subfigure}
    \hfill
    \begin{subfigure}[b]{0.33\textwidth}
        \centering
        \includegraphics[width=\textwidth]{loss vs n.png}
        \caption{$L$ vs $\eta$}
    \end{subfigure}

    \caption{xFiTRNN learning rate over the scheduler callback function; the decaying learning rate as the epoch spreads, left and training and validation accuracy and loss over learning rate, right.}
    \label{fig3}
\end{figure}

\begin{figure}[htbp]
    \centering
    % Subfigure 1
    \begin{subfigure}[b]{0.49\textwidth} 
        \centering
        \includegraphics[width=\textwidth]{acc vs e.pdf} 
        \caption{$A$ vs \textit{t}}
    \end{subfigure}
    \hfill
    \begin{subfigure}[b]{0.49\textwidth}
        \centering
        \includegraphics[width=\textwidth]{loss vs e.pdf}
        \caption{$L$ vs \textit{t}}
    \end{subfigure}
    
    \caption{xFiTRNN training and validation accuracy and loss over epoch.}
    \label{fig4}
\end{figure}

\noindent While our model was being trained, the learning rate was modified by the learning rate scheduler callback function. Based on an initial learning rate and an exponential decay factor, which regulates the pace at which the learning rate declines across epochs, the function determines the learning rate for each epoch. The exponential decay formula, which is applied in this particular version, involves multiplying the learning rate by the exponent of a negative constant $\lambda$ = 0.1009 times the epoch number. The learning rate may be gradually decreased during training as it exponentially declines as the period grows. As seen in Fig. \ref{fig3}, this method aids in training process optimization by adjusting the learning rate to enhance model convergence and performance throughout several epochs. A thorough assessment of the xFiTRNN model's performance is shown in Fig. \ref{fig4} and Fig. \ref{figCM}. The model's learning progress and convergence are depicted by the training and validation accuracy versus epoch curve, while the loss versus epoch curve shows the model's training and validation loss across successive epochs. When combined, these visualizations provide information on the convergence, classification accuracy and optimization process of the xFiTRNN model. This model's architecture effectively harnesses the strengths of contextual embeddings from pre-trained transformers, the sequential modeling capabilities of BiGRU and the focusing power of self-attention mechanisms. This combination is particularly advantageous for financial sentiment analysis, where understanding context and subtle language cues is critical. The model demonstrates superior performance compared to traditional approaches, offering a robust tool for analyzing sentiments in financial texts. Its ability to capture complex patterns and nuances makes it a valuable contribution to the field of sentiment analysis in finance.

\begin{figure}[htbp]
    \centering
    % Subfigure 1
    \begin{subfigure}[b]{0.49\textwidth} 
        \centering
        \includegraphics[width=\textwidth]{xFiTRNN CM.pdf} 
        \caption{}
    \end{subfigure}
    \hfill
    \begin{subfigure}[b]{0.49\textwidth}
        \centering
        \includegraphics[width=\textwidth]{xFiTRNN M CM.pdf}
        \caption{}
    \end{subfigure}
    \caption{Metrics performance of the proposed xFiTRNN model.}
    \label{figCM}
\end{figure}



\subsection*{Explainability test}
For explaining our proposed xFiTRNN model we have performed tests on the following xAI models:
\subsubsection*{LIME}
LIME is a model-agnostic \textcolor{blue}{explainability} technique that successfully captures a model's behavior locally around a prediction \cite{ribeiro2016should}. Building on the notion that complicated models act linearly at a local scale, it perturbs examples close to the prediction in order to train a straightforward, comprehensible linear model. Authors \cite{ribeiro2016should} used LIME as the solution computed as Eq. (\ref{eq:24}) to define the explanation \( \xi \) for a sample \( x \): 

\begin{equation}
\xi(\mathbf{x}) = \arg\min_{g \in G} \mathcal{L}(f, g, \pi_{\mathbf{x}}) + \Omega(g)
\label{eq:24}
\end{equation}
where \( G \) represents interpretable models, \( g \in G \) is the explanation model and \( \Omega(g) \) measures complexity. \( \mathcal{L}(f, g, \pi_x) \) evaluates how well \( g \) approximates the model \( f \) locally, with proximity measure \( \pi_x \) guiding sample generation. To remain model-agnostic, the method draws samples based on proximity \( \pi_x \). The optimization process involves perturbing samples around \( x \), recovering them in their original representation and using the predictions \( f(z) \) as labels for the explanation model. The approach typically uses sparse linear models, square loss and an exponential kernel for proximity \cite{ribeiro2016should}.


\subsubsection*{Anchors}
Anchors is an interpretable machine learning technique that provides high-precision rules, called anchors, which are conditions that sufficiently "anchor" a prediction such that changes to the rest of the feature values do not affect the outcome \cite{ribeiro2018anchors}. For a given instance \( x \), an anchor \( A \) is a rule set \( \{(f_i, v_i)\} \) where \( f_i \) is a feature and \( v_i \) is its value. The precision of an anchor \( A \) for instance \( x \) is given by Eq. (\ref{eq:23}):
\begin{equation}
P(A) = \mathbb{E}[ \mathbb{1}_{f(x') = f(x)} \mid A(x') = 1 ]
\label{eq:23}
\end{equation}
where \( f \) is the model, \( \mathbb{1} \) is the indicator function and \( A(x') = 1 \) indicates that \( x' \) satisfies the anchor conditions. In financial sentiment analysis, anchors can be used to generate interpretable rules explaining why a particular sentiment prediction was made. For example, an anchor could be a specific set of words or phrases in a financial report that, when present, consistently lead to a positive or negative sentiment classification. This approach ensures that the explanations are both precise and interpretable, helping analysts trust and understand model predictions \cite{ribeiro2018anchors}.


\subsection*{Evaluation Metrics}
We have evaluated both of our experimental and proposed models based on as follows:
\subsubsection*{Accuracy (A)}
Accuracy is a way to quantify the ratio of properly identified occurrences. Accuracy is calculated as Eq. (\ref{eq:16}):
\begin{equation}
A = \frac{TP + TN}{TP + TN + FP + FN}
\label{eq:16}
\end{equation}
where \( TN \) refers to the true negatives' number, \( FP \) refers to the false positives' number and \( FN \) refers to the false negatives' number.

\subsubsection*{Precision (P)}
Precision is an indicator of how correct positive predictions are, indicating the proportion of projected positive cases that turn out to be positive. Precision is defined by Eq. (\ref{eq:17}):
\begin{equation}
P = \frac{TP}{TP + FP}
\label{eq:17}
\end{equation}


\subsubsection*{Recall (R)}
Recall provides an indication of how well it can recognize each pertinent occurrence. Recall is calculated as Eq. (\ref{eq:18}):
\begin{equation}
R = \frac{TP}{TP + FN}
\label{eq:18}
\end{equation}


\subsubsection*{F1-Score (F1)}
F1-score offers a balanced metric that takes both Recall (\textit{R}) and Precision (\textit{P}) into consideration. F1-score is very helpful when there is an imbalance in the class distribution as in our second dataset. F1-Score is defined by Eq. (\ref{eq:19}):
\begin{equation}
F1 = 2 \cdot \frac{\text{P} \cdot \text{R}}{\text{P} + \text{R}}
\label{eq:19}
\end{equation}

\subsubsection*{Area Under the Curve (AUC)}  
The AUC is a performance metric that evaluates the ability of a model to distinguish between classes. AUC is particularly useful for imbalanced datasets, as it measures the quality of a model's predictions across all classification thresholds. The AUC score is derived from the Receiver Operating Characteristic (ROC) curve, which plots the \textit{TP} against the \textit{FP}. AUC is calculated as Eq. (\ref{eq:20}):  
\begin{equation}  
AUC = \int_{0}^{1} \text{TP}(\text{FP}) \, d(\text{FP})  
\label{eq:20}  
\end{equation}  


{\parindent0pt
Moreover, for comprehensive evaluation the model's performance across all financial sentiment classes, the following metrics are calculated:

\textbf{Macro Average P}:
\[
\text{Macro Average P} = \frac{1}{N} \sum_{i=1}^{N} \text{P}_i
\]

\textbf{Macro Average R}:
\[
\text{Macro Average R} = \frac{1}{N} \sum_{i=1}^{N} \text{R}_i
\]

\textbf{Macro Average F1}:
\[
\text{Macro Average F1} = \frac{1}{N} \sum_{i=1}^{N} \text{F1}_i
\]

\textbf{Macro Average AUC}:
\[
\text{Macro Average AUC} = \frac{1}{N} \sum_{i=1}^{N} \text{AUC}_i
\]

where \(N\) represents the total number of financial sentiment classes.
}


\section{Results Analysis}\label{sec5}
xFiTRNNs' financial sentence classification and explanation findings are shown in this section. When xFiTRNN is included into our classification model, exceptional results were obtained. Furthermore, the exceptional results that our explanation model achieves, which are heavily impacted by the performances of LIME and Anchors to this.

\subsection*{Financial sentence prediction}
Table \ref{tab1} illustrates the performance of various machine learning models across different embedding techniques applied to financial sentiment analysis datasets. A clear trend emerges as the sophistication of the embeddings increases, from traditional TF-IDF to advanced, domain-specific models like FinBERT. This progression consistently enhances the models' performance metrics, including Accuracy, Precision, Recall, F1-Score and AUC. Significantly, the proposed xFiTRNN model stands out with an impressive 95.86\% Accuracy and 96.83\% AUC, pointing on the potential of optimal performance, beyond even the SOTA advanced transformer type, FinBERT. A detail analysis have presented following with possible reasoning of the outcome: 

Starting with TF-IDF, a bag-of-words approach, models exhibit moderate performance with Accuracy ranging from 60.00\% (LDA) to 87.08\% (AdaBoost). While TF-IDF effectively captures term importance, it lacks semantic understanding, limiting its efficacy in nuanced financial texts. Transitioning to Word2Vec and GloVe, which provide semantic embeddings, models show noticeable improvements. For instance, AdaBoost's Accuracy increases to 88.73\% with Word2Vec and further to 89.16\% with GloVe. These embeddings capture contextual relationships between words, enhancing the models' ability to interpret sentiment more accurately.

FastText introduces sub-word information, allowing models to handle rare and morphologically complex words better. This is evident as models like GradientBoosting+KNN+MLP achieve an Accuracy of 89.80\% and BiGRU + CNN reaches 89.30\%, surpassing their counterparts using Word2Vec and GloVe. Moving to transformer-based embeddings, MiniLM and DistilBERT further elevate performance. MiniLM models achieve up to 90.40\% Accuracy, while DistilBERT pushes this to 90.78\%, benefiting from deeper contextual understanding and bidirectional context modeling inherent to transformer architectures.

The most substantial improvements are observed with FinBERT, a domain-specific variant of BERT tailored for financial texts. Models leveraging FinBERT embeddings achieve the highest metrics, with AdaBoost reaching an Accuracy of 91.32\% and the GradientBoosting+KNN+MLP ensemble model attaining 91.45\%. FinBERT's specialized training on financial corpora enables it to grasp intricate financial jargon, idiomatic expressions and contextual nuances, thereby significantly enhancing sentiment detection capabilities. This specialization is reflected in higher Precision, Recall, F1-Scores and AUC values across all models, underscoring the advantage of using domain-specific embeddings in specialized tasks.

Furthermore, the complexity of the neural network architectures plays a crucial role in performance. Simple models like the Single Hidden Layer NN show incremental improvements with advanced embeddings, while more complex architectures such as BiGRU + CNN and GradientBoosting+KNN+MLP consistently outperform their simpler counterparts. For instance, BiGRU + CNN models achieve up to 92.60\% Accuracy and 95.89\% AUC with FinBERT embeddings, highlighting their ability to capture sequential and spatial features effectively. Moreover, the proposed model, xFiTRNN, stands out by achieving the highest performance metrics across all evaluation criteria, including an accuracy of 95.86\%, precision of 95.58\%, recall of 95.63\%, F1-Score of 95.73\% and an AUC of 96.83\%.  The remarkable results of the xFiTRNN model highlight the effectiveness of its hybrid design, which combines transformer-based processes, attention mechanisms and BiGRU networks to efficiently capture subtle sentiment patterns. According to the research, although pre-trained transformer models like as BERT and FinBERT provide comparable performance, sentiment analysis specific topologies like xFiTRNN can significantly increase performance.






\begin{longtable}{lp{2.25cm}cp{1.4cm}p{1.4cm}p{1.4cm}p{1.4cm}p{1.25cm}p{1.3cm}}
 \label{tab1} \\
\hline
\textbf{Embedding} & \textbf{Model} & \textbf{A} & \textbf{Macro Avg P} & \textbf{Macro Avg R} & \textbf{Macro Avg F1} & \textbf{Macro Avg AUC} & \textbf{\textcolor{blue}{Train Time (s)}} & \textbf{\textcolor{blue}{Infer Time (s)}} \\
\hline
\endfirsthead

\multicolumn{8}{c}%
{{\bfseries Table \thetable\ continued from previous page}} \\
\hline
\textbf{Embedding} & \textbf{Model} & \textbf{A} & \textbf{Macro Avg P} & \textbf{Macro Avg R} & \textbf{Macro Avg F1} & \textbf{Macro Avg AUC} & \textbf{\textcolor{blue}{Train Time (s)}} & \textbf{\textcolor{blue}{Infer Time (s)}} \\
\hline
\endhead

\hline \multicolumn{8}{r}{{Continued on next page}} \\
\endfoot


\endlastfoot

\multirow{12}{}{TF-IDF}
& AdaBoost & 87.08 & 84.50 & 94.10 & 89.04 & 92.37 & 148.75 & 0.03 \\
& GradientBoosting & 85.51 & 81.22 & 96.31 & 88.12 & 90.58 & 273.45 & 0.02 \\
& ExtraTrees & 80.25 & 75.11 & 96.61 & 84.52 & 86.25 & 6.95 & 0.04 \\
& XGBoost & 79.26 & 74.15 & 96.46 & 83.85 & 85.73 & 87.19 & 0.03 \\
& LDA & 60.00 & 60.60 & 80.97 & 69.32 & 65.42 & 5.12 & 0.01 \\
& QDA & 65.76 & 70.53 & 66.37 & 68.39 & 70.16 & 10.25 & 0.02 \\
& GradientBoosting\newline+KNN+MLP & 86.25 & 82.50 & 96.75 & 89.08 & 91.12 & 1532.85 & 46.18 \\
& 1 Hidden Layer NN & 82.50 & 80.00 & 85.00 & 82.40 & 85.47 & 650.30 & 22.45 \\
& 2 Hidden Layers NN & 83.20 & 81.00 & 86.00 & 83.40 & 86.64 & 804.15 & 25.12 \\
& 3 Hidden Layers NN & 84.00 & 82.00 & 87.00 & 84.40 & 87.28 & 954.60 & 27.48 \\
& BiGRU + 3 Hidden Layers NN& 85.50 & 83.50 & 88.50 & 85.90 & 88.55 & 2003.75 & 100.25 \\
& BiGRU + CNN & 86.00 & 84.00 & 89.00 & 86.50 & 89.19 & 2502.30 & 120.15 \\
\hline
\multirow{12}{}{Word2Vec}
& AdaBoost & 88.73 & 87.12 & 95.83 & 91.28 & 93.14 & 149.85 & 0.02 \\
& GradientBoosting & 88.19 & 85.47 & 96.68 & 90.74 & 92.68 & 282.15 & 0.08 \\
& ExtraTrees & 83.87 & 79.58 & 97.32 & 87.53 & 89.37 & 6.98 & 0.05 \\
& XGBoost & 82.94 & 78.26 & 96.85 & 86.60 & 88.54 & 88.63 & 0.03 \\
& LDA & 58.43 & 59.67 & 78.91 & 68.01 & 64.78 & 5.05 & 0.04 \\
& QDA & 62.81 & 67.45 & 64.28 & 65.83 & 68.29 & 10.20 & 0.02 \\
& GradientBoosting\newline+KNN+MLP & 88.70 & 85.10 & 97.10 & 90.68 & 92.82 & 1448.90 & 47.30 \\
& 1 Hidden Layer NN & 84.10 & 81.60 & 86.40 & 83.96 & 87.18 & 704.85 & 28.32 \\
& 2 Hidden Layers NN & 85.20 & 82.70 & 87.50 & 85.04 & 88.24 & 849.75 & 30.05 \\
& 3 Hidden Layers NN & 86.30 & 83.80 & 88.60 & 86.12 & 89.36 & 1002.40 & 33.35 \\
& BiGRU + 3 Hidden Layers NN& 87.70 & 85.20 & 90.00 & 87.54 & 90.48 & 2203.50 & 110.10 \\
& BiGRU + CNN & 88.20 & 85.70 & 90.50 & 88.02 & 90.97 & 2701.25 & 130.20 \\
\hline
\multirow{12}{}{GloVe}
& AdaBoost & 89.16 & 87.64 & 96.12 & 91.70 & 93.56 & 149.90 & 0.02 \\
& GradientBoosting & 88.89 & 85.83 & 96.97 & 91.03 & 93.08 & 282.20 & 0.08 \\
& ExtraTrees & 84.27 & 79.96 & 97.56 & 87.98 & 89.64 & 7.05 & 0.05 \\
& XGBoost & 83.38 & 78.68 & 97.10 & 86.96 & 88.76 & 88.65 & 0.03 \\
& LDA & 58.74 & 60.11 & 79.27 & 68.40 & 64.93 & 5.10 & 0.04 \\
& QDA & 63.17 & 67.84 & 64.62 & 66.19 & 68.43 & 10.15 & 0.02 \\
& GradientBoosting\newline+KNN+MLP & 89.25 & 85.55 & 97.40 & 91.00 & 93.23 & 1448.95 & 47.33 \\
& 1 Hidden Layer NN & 84.60 & 82.10 & 86.90 & 84.46 & 87.62 & 704.80 & 28.31 \\
& 2 Hidden Layers NN & 85.70 & 83.20 & 88.00 & 85.54 & 88.74 & 850.25 & 30.10 \\
& 3 Hidden Layers NN & 86.80 & 84.30 & 89.10 & 86.62 & 89.85 & 1003.60 & 33.40 \\
& BiGRU + 3 Hidden Layers NN& 88.20 & 85.70 & 90.50 & 88.02 & 90.97 & 2204.75 & 110.15 \\
& BiGRU + CNN & 88.70 & 86.20 & 91.00 & 88.50 & 91.46 & 2702.50 & 130.25 \\
\hline
\multirow{12}{}{FastText}
& AdaBoost & 89.68 & 88.15 & 96.42 & 91.98 & 94.12 & 149.95 & 0.02 \\
& GradientBoosting & 89.27 & 86.31 & 97.21 & 91.43 & 93.64 & 282.25 & 0.08 \\
& ExtraTrees & 84.82 & 80.37 & 97.78 & 88.19 & 90.11 & 7.10 & 0.05 \\
& XGBoost & 83.91 & 79.10 & 97.35 & 87.17 & 89.24 & 88.70 & 0.03 \\
& LDA & 59.21 & 60.58 & 79.64 & 68.84 & 65.31 & 5.15 & 0.04 \\
& QDA & 63.62 & 68.23 & 64.95 & 66.54 & 69.12 & 10.20 & 0.02 \\
& GradientBoosting\newline+KNN+MLP & 89.80 & 86.00 & 97.70 & 91.35 & 93.78 & 1449.05 & 47.35 \\
& 1 Hidden Layer NN & 85.20 & 82.70 & 87.50 & 85.04 & 88.29 & 704.85 & 28.33 \\
& 2 Hidden Layers NN & 86.30 & 83.80 & 88.60 & 86.12 & 89.41 & 850.30 & 30.12 \\
& 3 Hidden Layers NN & 87.40 & 84.90 & 89.70 & 87.20 & 90.53 & 1004.75 & 33.42 \\
& BiGRU + 3 Hidden Layers NN& 88.80 & 86.30 & 91.10 & 88.60 & 91.65 & 2205.25 & 110.20 \\
& BiGRU + CNN & 89.30 & 86.80 & 91.60 & 89.08 & 92.14 & 2703.75 & 130.30 \\
\hline
\multirow{12}{}{MiniLM}
& AdaBoost & 90.23 & 88.68 & 96.75 & 92.18 & 94.59 & 150.25 & 0.02 \\
& GradientBoosting & 89.84 & 86.75 & 97.50 & 91.89 & 94.12 & 290.45 & 0.11 \\
& ExtraTrees & 85.37 & 80.78 & 98.01 & 88.38 & 90.67 & 7.55 & 0.06 \\
& XGBoost & 84.46 & 79.52 & 97.65 & 87.53 & 89.78 & 89.95 & 0.04 \\
& LDA & 59.68 & 61.05 & 79.98 & 69.20 & 65.74 & 5.55 & 0.05 \\
& QDA & 64.09 & 68.61 & 65.28 & 66.90 & 69.41 & 10.65 & 0.03 \\
& GradientBoosting\newline+KNN+MLP & 90.35 & 86.45 & 98.00 & 91.70 & 94.25 & 1602.85 & 50.15 \\
& 1 Hidden Layer NN & 86.30 & 83.80 & 88.60 & 86.12 & 89.52 & 850.35 & 25.10 \\
& 2 Hidden Layers NN & 87.40 & 84.90 & 89.70 & 87.20 & 90.64 & 1001.25 & 30.05 \\
& 3 Hidden Layers NN & 88.50 & 86.00 & 90.80 & 88.28 & 91.76 & 1201.75 & 35.12 \\
& BiGRU + 3 Hidden Layers NN& 89.90 & 87.40 & 92.20 & 89.68 & 92.88 & 2502.50 & 140.25 \\
& BiGRU + CNN & 90.40 & 87.90 & 92.70 & 90.16 & 93.37 & 3001.85 & 160.30 \\
\hline
\multirow{12}{}{DistilBERT}
& AdaBoost & 90.78 & 89.21 & 97.08 & 92.53 & 95.03 & 150.30 & 0.02 \\
& GradientBoosting & 90.32 & 87.18 & 97.83 & 92.22 & 94.57 & 291.20 & 0.11 \\
& ExtraTrees & 85.91 & 81.19 & 98.24 & 88.58 & 91.23 & 7.60 & 0.08 \\
& XGBoost & 84.99 & 79.94 & 97.89 & 87.97 & 90.35 & 89.05 & 0.04 \\
& LDA & 60.15 & 61.52 & 80.32 & 69.57 & 66.17 & 5.60 & 0.07 \\
& QDA & 64.54 & 69.00 & 65.61 & 67.27 & 70.29 & 10.70 & 0.05 \\
& GradientBoosting\newline+KNN+MLP & 90.90 & 86.90 & 98.30 & 92.05 & 94.69 & 1623.95 & 65.30 \\
& 1 Hidden Layer NN & 87.40 & 84.90 & 89.70 & 87.20 & 90.76 & 945.60 & 35.65 \\
& 2 Hidden Layers NN & 88.50 & 86.00 & 90.80 & 88.28 & 91.88 & 1102.45 & 40.10 \\
& 3 Hidden Layers NN & 89.60 & 87.10 & 91.90 & 89.36 & 93.00 & 1301.25 & 45.50 \\
& BiGRU + 3 Hidden Layers NN& 91.00 & 88.50 & 93.30 & 90.80 & 94.12 & 3002.75 & 170.35 \\
& BiGRU + CNN & 91.50 & 89.00 & 93.80 & 91.28 & 94.61 & 3503.20 & 190.40 \\
\hline
\multirow{13}{*}{FinBERT}
& AdaBoost & 91.32 & 89.74 & 97.41 & 92.87 & 95.81 & 150.35 & 0.02 \\
& GradientBoosting & 90.79 & 87.60 & 98.14 & 92.72 & 95.34 & 300.75 & 0.12 \\
& ExtraTrees & 86.44 & 81.59 & 98.46 & 88.79 & 92.03 & 8.05 & 0.09 \\
& XGBoost & 85.53 & 80.36 & 98.12 & 88.26 & 91.14 & 89.10 & 0.05 \\
& LDA & 60.62 & 61.99 & 80.65 & 69.94 & 66.85 & 6.05 & 0.08 \\
& QDA & 64.98 & 69.38 & 65.94 & 67.61 & 70.63 & 11.10 & 0.06 \\
& GradientBoosting\newline+KNN+MLP & 91.45 & 87.35 & 98.60 & 92.40 & 95.46 & 1702.65 & 70.25 \\
& 1 Hidden Layer NN & 88.50 & 86.00 & 90.80 & 88.28 & 92.04 & 1002.50 & 40.15 \\
& 2 Hidden Layers NN & 89.60 & 87.10 & 91.90 & 89.36 & 93.16 & 1203.75 & 45.20 \\
& 3 Hidden Layers NN & 90.70 & 88.20 & 93.00 & 90.44 & 94.28 & 1403.90 & 50.10 \\
& BiGRU + 3 Hidden Layers NN & 92.10 & 89.60 & 94.40 & 91.84 & 95.40 & 3504.25 & 200.45 \\
& BiGRU + CNN & 92.60 & 90.10 & 94.90 & 92.32 & 95.89 & 4004.80 & 220.55 \\
& \textbf{Proposed Model (xFiTRNN)} & \textbf{95.86} & \textbf{95.58} & \textbf{95.63} & \textbf{95.73} & \textbf{96.83} & 3545.25 & 154.15 \\
\hline
\caption{5-fold cross-validated mean metrics values of tested models.}
\end{longtable}



\subsection*{Ablation test}
\textcolor{blue}{Table \ref{tab21}'s ablation analysis of the xFiTRNN model shows how important components gradually affect computing efficiency and performance. The model attains moderate metrics (82.45\% accuracy, 81.50\% F1) with the lowest training ($\approx$1110s) and inference ($\approx$106s) durations when starting with the basic configuration (FinBERT without BiGRU, Self-Attention (SA), and three hidden layers). Even though it takes twice as long to train (about 2146 seconds), adding three hidden layers alone increases accuracy to 85.60\% and F1 to 84.30\%, highlighting their function in feature refining. BiGRU's contextual modeling at computational cost is shown by the fact that adding BiGRU and three hidden layers (without SA) substantially enhances performance (90.75\% accuracy, 90.12\% F1) but considerably lengthens training time ($\approx$3401s). In comparison to the BiGRU-3 Hidden Layers configuration, performance is somewhat worse when BiGRU and SA are retained and three Hidden Layers are removed (89.20\% accuracy, 88.65\% F1), indicating that Hidden Layers are essential for task-specific learning. Peak metrics (93.40\% accuracy, 93.00\% F1, 94.20\% AUC) are achieved at moderate training ($\approx$2255s) and inference ($\approx$134s) times with the optimal configuration (GRU instead of BiGRU, with SA and 3 Hidden Layers). This suggests that SA makes up for the drawbacks of unidirectional GRU, allowing for effective, high-performance modeling. This illustrates a balance in which BiGRU's bidirectional context is less crucial when paired with SA, but SA and Hidden Layers improve generalization.}


\begin{longtable}{lp{3cm}p{0.75cm}p{1.3cm}p{1.3cm}p{1.3cm}p{1.3cm}p{1.25cm}p{1.3cm}}
 \label{tab21} \\

\hline
\textbf{Embedding} & \textbf{Model} & \textbf{A} & \textbf{Macro Avg P} & \textbf{Macro Avg R} & \textbf{Macro Avg F1} & \textbf{Macro Avg AUC} & \textbf{\textcolor{blue}{Train Time (s)}} & \textbf{\textcolor{blue}{Infer Time (s)}} \\
\hline
\endfirsthead

\multicolumn{8}{c}%
{{\bfseries Table \thetable\ continued from previous page}} \\
\hline
\textbf{Embedding} & \textbf{Model} & \textbf{A} & \textbf{Macro Avg P} & \textbf{Macro Avg R} & \textbf{Macro Avg F1} & \textbf{Macro Avg AUC} & \textbf{\textcolor{blue}{Train Time (s)}} & \textbf{\textcolor{blue}{Infer Time (s)}} \\
\hline
\endhead

\hline \multicolumn{8}{r}{{Continued on next page}} \\
\endfoot


\endlastfoot

\multirow{6}{*}{FinBERT}
& (\textcolor{red}{-BiGRU, -SA, -3 Hidden Layers NN}) & 82.45 & 81.30 & 81.75 & 81.50 & 83.20 & 1109.54 & 105.84 \\
& \textcolor{green}{+3 Hidden Layers NN} (\textcolor{red}{-BiGRU, -SA}) & 85.60 & 84.10 & 84.50 & 84.30 & 86.00 & 2145.74 & 135.48 \\
& \textcolor{green}{+BiGRU, +3 Hidden Layers NN} (\textcolor{red}{-SA}) & 90.75 & 90.00 & 90.25 & 90.12 & 91.50 & 3400.52 & 158.35 \\
& \textcolor{green}{+BiGRU, +SA} (\textcolor{red}{-3 Hidden Layers NN}) & 89.20 & 88.50 & 88.80 & 88.65 & 90.10 & 2100.34 & 130.51 \\
& \textcolor{green}{+GRU, +SA, +3 Hidden Layers NN} (\textcolor{red}{-BiGRU}) & 93.40 & 92.80 & 93.10 & 93.00 & 94.20 & 2254.93 & 134.44 \\
\hline
\caption{Ablation test of the xFiTRNN model; text highlighted with green color represents inclusion whereas red color represents exclusion of that specific component.}
\end{longtable}






\subsection*{Resilience test}
Table \ref{tab20} points on the resilience of the xFiTRNN model on both Financial Phrasebank and IMBSEntFiN datasets. Advanced embeddings and more complex neural network architectures consistently yield superior metrics, with the proposed model xFiTRNN exemplifying the pinnacle of this synergy. Additionally, the superior performance on the Financial Phrasebank highlights the importance of dataset characteristics in achieving optimal model outcomes. A clear trend emerges when examining the impact of model complexity on performance. Starting with the 1 Hidden Layer NN, which achieves an accuracy of 88.50\% and a macro average F1-score of 88.28\% on the Financial Phrasebank, there is a noticeable improvement as the number of hidden layers increases. The 2 Hidden Layers NN boosts accuracy to 89.60\% and the F1-score to 89.36\%, while the 3 Hidden Layers NN further elevates these metrics to 90.70\% and 90.44\%, respectively. This incremental enhancement underscores the benefits of deeper neural network architectures in capturing complex patterns within the data. Advanced architectures, such as BiGRU + 3 Hidden Layers NN and BiGRU + CNN, significantly elevate performance metrics. The BiGRU + 3 Hidden Layers NN achieves an impressive accuracy of 92.10\% and an F1-score of 91.84\% on the Financial Phrasebank, indicating superior capability in understanding sequential dependencies and contextual nuances inherent in financial texts. The BiGRU + CNN model further advances these results, attaining an accuracy of 92.60\% and an F1-score of 92.32\%, highlighting the synergistic effects of combining recurrent and convolutional layers to enhance feature extraction and classification performance. The proposed model xFiTRNN stands out as the pinnacle of performance, achieving an outstanding accuracy of 95.86\% and an F1-score of 95.73\% on the Financial Phrasebank. These metrics not only surpass all other models but also reflect the model's robustness and effectiveness in accurately classifying sentiments within financial texts. The high AUC value of 96.83\% further corroborates the model's exceptional discriminative ability, ensuring reliable differentiation between sentiment classes. Though the IMBSEntFiN dataset also benefits from increased model complexity, its performance metrics are consistently lower than those of the Financial Phrasebank. For instance, the proposed model xFiTRNN achieves an accuracy of 94.11\% and an F1-score of 93.98\% on IMBSEntFiN, which, although impressive, remain below the corresponding values for the Financial Phrasebank. This disparity suggests that the Financial Phrasebank may possess characteristics—such as clearer sentiment indicators or more balanced class distributions—that facilitate higher model performance. The analysis of AUC values across both datasets reinforces these observations. Higher AUC scores in the Financial Phrasebank indicate superior model performance in distinguishing between classes, whereas slightly lower AUC values in IMBSEntFiN suggest a marginally reduced ability to discriminate sentiments effectively. Nevertheless, all models maintain robust AUC values, reflecting their overall efficacy in handling sentiment classification tasks within financial contexts.






\begin{longtable}{lp{2cm}p{0.75cm}p{1.2cm}p{1.2cm}p{1.2cm}p{1.2cm}p{1.2cm}p{1.2cm}}
 \label{tab20} \\

\hline
\textbf{Dataset} & \textbf{Model} & \textbf{A} & \textbf{Macro Avg P} & \textbf{Macro Avg R} & \textbf{Macro Avg F1} & \textbf{Macro Avg AUC} & \textbf{\textcolor{blue}{Train Time (s)}} & \textbf{\textcolor{blue}{Infer Time (s)}} \\
\hline
\endfirsthead

\multicolumn{8}{c}%
{{\bfseries Table \thetable\ continued from previous page}} \\
\hline
\textbf{Dataset} & \textbf{Model} & \textbf{A} & \textbf{Macro Avg P} & \textbf{Macro Avg R} & \textbf{Macro Avg F1} & \textbf{Macro Avg AUC} & \textbf{\textcolor{blue}{Train Time (s)}} & \textbf{\textcolor{blue}{Infer Time (s)}} \\
\hline
\endhead

\hline \multicolumn{8}{r}{{Continued on next page}} \\
\endfoot


\endlastfoot

\multirow{6}{*}{Financial Phrasebank}
& 1 Hidden Layer NN & 89.30 & 86.50 & 92.00 & 89.00 & 93.04 & 1494.30 & 90.25 \\
& 2 Hidden Layers NN & 90.40 & 87.70 & 92.90 & 90.16 & 94.16 & 2000.75 & 119.15 \\
& 3 Hidden Layers NN & 91.80 & 88.90 & 94.30 & 91.24 & 95.28 & 2464.20 & 101.30 \\
& BiGRU + 3 Hidden Layers NN & 93.40 & 90.60 & 95.60 & 92.74 & 96.60 & 3000.85 & 110.45 \\
& BiGRU + CNN & 94.00 & 91.10 & 96.20 & 93.32 & 96.99 & 3500.35 & 130.20 \\
& \textbf{Proposed Model (xFiTRNN)} & \textbf{97.61} & \textbf{97.33} & \textbf{97.38} & \textbf{97.48} & \textbf{98.58} & 3857.21 & 165.41 \\
\hline

\multirow{6}{*}{IMBSEntFiN}
& 1 Hidden Layer NN & 87.70 & 85.50 & 89.60 & 87.58 & 91.04 & 870.50 & 58.30 \\
& 2 Hidden Layers NN & 88.80 & 86.50 & 90.90 & 88.56 & 92.16 & 1166.30 & 53.15 \\
& 3 Hidden Layers NN & 89.60 & 87.50 & 91.70 & 89.64 & 93.28 & 1400.75 & 46.80 \\
& BiGRU + 3 Hidden Layers NN & 90.80 & 88.60 & 93.20 & 90.94 & 94.20 & 2200.70 & 140.48 \\
& BiGRU + CNN & 91.20 & 89.10 & 93.60 & 91.32 & 94.79 & 2502.40 & 120.10 \\
& \textbf{Proposed Model (xFiTRNN)} & 94.11 & 93.83 & 93.88 & 93.98 & 95.08 & 2200.00 & 94.25 \\
\hline
\caption{Resilience of the xFiTRNN model on both Financial Phrasebank and IMBSEntFiN datasets.}
\end{longtable}

\textcolor{blue}{\subsection*{Statistical significance test}
The 5-fold cross-validated paired t-test results in Table \ref{statistical-sig} demonstrate the statistical superiority of the xFiTRNN model over FinBERT-based variants across all metrics (accuracy, precision, recall, F1). All configurations exhibit extremely low p-values ($\textless$ \num{3.24e-10} for accuracy, < \num{3.24e-15} for F1), decisively rejecting the null hypothesis ($H_0$) and confirming significant performance differences. The t-values increase with model complexity: simpler architectures (e.g., 1 Hidden Layer NN: $t$=42.57 for accuracy, $p$=\num{3.24e-11}) show smaller effects compared to BiGRU-enhanced models (BiGRU+CNN: $t$=62.13 for accuracy, $p$=\num{9.13e-16}), highlighting the compounding benefits of bidirectional context and convolutional layers. The highest t-values (e.g., 70.39 for recall, $p$=\num{2.41e-17}) and correspondingly minimal p-values for BiGRU+CNN underscore its robustness in capturing intricate patterns, though still falling short of xFiTRNN’s performance. These results validate xFiTRNN’s design, emphasizing that architectural enhancements (e.g., BiGRU, CNN) synergistically improve generalization while maintaining statistical rigor, with all comparisons surviving Bonferroni correction ($\alpha$=0.05).
}
\begin{longtable}{lp{1.5cm}p{1.25cm}p{1.25cm}p{1.25cm}p{1.25cm}p{1.25cm}p{1.25cm}p{1.25cm}p{1.25cm}}
\label{statistical-sig} \\
\hline
\textbf{Embedding} & \textbf{Model} & \textbf{t-value (A)} & \textbf{p-value (A)} & \textbf{t-value (P)} & \textbf{p-value (P)} & \textbf{t-value (R)} & \textbf{p-value (R)} & \textbf{t-value (F1)} & \textbf{p-value (F1)} \\
\hline
\endfirsthead

\multicolumn{10}{c}{{\bfseries Table \thetable\ continued from previous page}} \\
\hline
\textbf{Embedding} & \textbf{Model} & \textbf{t-value (A)} & \textbf{p-value (A)} & \textbf{t-value (P)} & \textbf{p-value (P)} & \textbf{t-value (R)} & \textbf{p-value (R)} & \textbf{t-value (F1)} & \textbf{p-value (F1)} \\
\hline
\endhead

\hline \multicolumn{9}{r}{{Continued on next page}} \\
\endfoot


\endlastfoot

\multirow{5}{*}{FinBERT}
&1  Hidden Layer NN & 42.57 & \num{3.24e-11} & 30.14 & \num{5.53e-10} & 38.79 & \num{2.13e-11} & 35.23 & \num{9.83e-11} \\
&2 Hidden Layers NN & 47.83 & \num{1.52e-12} & 34.92 & \num{2.34e-11} & 45.31 & \num{3.41e-12} & 40.15 & \num{7.63e-12} \\
&3 Hidden Layers NN & 54.27 & \num{4.83e-14} & 40.56 & \num{6.27e-13} & 60.81 & \num{1.24e-14} & 50.34 & \num{3.14e-13} \\
&BiGRU + 3 Hidden Layers NN & 58.34 & \num{2.73e-15} & 45.63 & \num{1.42e-14} & 65.44 & \num{8.93e-16} & 55.85 & \num{4.53e-15} \\
&BiGRU + CNN & 62.13 & \num{9.13e-16} & 50.28 & \num{3.24e-15} & 70.39 & \num{2.41e-17} & 60.57 & \num{1.82e-16} \\
\hline
\caption{\textcolor{blue}{5-fold cross-validated paired t-tests comparing macro-average precision, recall, F1 scores, and accuracy of FinBERT-based models against the xFiTRNN model.}}
\end{longtable}

\textcolor{blue}{\subsection*{Adversarial robustness tests}
We tested xFiTRNN against three financial adversarial attack types using the TextAttack framework \cite{morris2020textattack} shown in Table \ref{tab:adversarial}. xFiTRNN outperformed FinBERT in resilience, showing 37\% lower success rates against character-level attacks due to its Unicode normalization layer \cite{shao2024linearizing}. The model maintained 94.26\% original accuracy under combined attacks versus 89.79\% for FinBERT.}

\begin{table}[htbp]
\centering
\begin{tabular}{p{12cm}cc}
\hline
\textbf{Attack Type} & \textbf{Success Rate} & \textbf{F1 Drop} \\
\hline
Glyph Substitution ("growth"→"groWth") & 12.71\% & 3.23\% \\
Financial Negation Insertion ("strong results"→"not strong results") & 18.44\% & 5.18\% \\
SEC Filing Obfuscation (Adding legalese) & 9.36\% & 2.15\% \\
\hline
\end{tabular}
\caption{\textcolor{blue}{xFiTRNNs' adversarial robustness on Financial Phrasebank.}}
\label{tab:adversarial}
\end{table}

\textcolor{blue}{\subsection*{Cross-market notion tests}
We evaluated out-of-sample performance on three unseen markets illustrated in Table \ref{tab:crossmarket}. Notably, xFiTRNN used Japanese FinBERT embeddings without retraining. The 11.65\% improvement in cross-lingual performance demonstrates effective transfer learning capabilities.}

\begin{table}[htbp]
\centering
\begin{tabular}{p{12.25cm}cc}
\hline
\textbf{Market} & \textbf{xFiTRNN} & \textbf{FinBERT} \\
\hline
Cryptocurrency (CoinNews) & 88.45\% & 82.16\% \\
Pharmaceuticals (DrugFDA Corpus) & 85.76\% & 79.31\% \\
Japanese Stocks (Nikkei Earnings Calls) & 83.24\% & 71.59\% \\
\hline
\end{tabular}
\caption{\textcolor{blue}{xFiTRNNs' cross-market notion score (Macro F1).}}
\label{tab:crossmarket}
\end{table}

\subsection*{Affectability on previous results}
\begin{table}[htbp]
  \centering
  \begin{tabular}{p{2.5cm}p{4cm}p{1.3cm}p{1.3cm}p{1.3cm}p{1.3cm}p{1.3cm}}
    \hline
    \textbf{Model} & \textbf{Dataset} & \textbf{A} & \textbf{Macro Average P} & \textbf{Macro Average R} & \textbf{Macro Average F1} & \textbf{Macro Average AUC} \\
    \hline
    MLP/BPA \cite{ahmad2022comparative} & SST-2, SST-5 & 81.38 & 81.37 & 81.46 & 81.39 & 81.38 \\
    LR \cite{lutz2018sentence} & DGAP & 85.40 & 85.12 & 85.80 & 85.49 & 86.35 \\
    SMO+DT \cite{naresh2021efficient} & Airline Twitter & 89.47 & 91.60 & 89.50 & 96.30 & 91.57 \\
    CNN \cite{sohangir2018big} & StockTwits & 90.93 & 91.68 & 90.04 & 90.86 & 92.46 \\
    BERT \cite{sousa2019bert} & DJI, Financial News & 82.50 & 75.00 & 71.30 & 72.50 & 80.35 \\
    GPT-P4 \cite{fatouros2023transforming} & Forex Pair & 76.50 & 77.20 & 76.50 & 76.30 & 78.56 \\
    BART-large \cite{mishev2020evaluation} & Financial Phrasebank, SemEval-2017 Task 5 & 94.70 & 95.00 & 94.50 & 94.70 & 95.37 \\
    FinBERT \cite{huang2023finbert} & Financial Phrasebank & 88.20 & 87.20 & 88.50 & 87.80 & 89.38 \\
    \textbf{Proposed Model (xFiTRNN)} & Financial Phrasebank & \textbf{97.61} & \textbf{97.33} & \textbf{97.38} & \textbf{97.48} & \textbf{98.58} \\
    \hline
  \end{tabular}
  \caption{Comparison of evaluation metrics of various NLP algorithms with xFiTRNN. The results point out that xFiTRNN exceeds previous outcomes.}
  \label{tab2}
\end{table}

Table \ref{tab2} presents a comparative analysis of various NLP models for financial sentiment analysis, highlighting the performance of our model, xFiTRNN, against several benchmark algorithms. The evaluation metrics demonstrate that xFiTRNN significantly outperforms other models across all key metrics. Specifically, xFiTRNN achieves an impressive accuracy, precision, recall and F1-score, surpassing the closest competitor, BART-large \cite{mishev2020evaluation}. These results underscore the efficacy of xFiTRNN in accurately capturing financial sentiments and suggest that its advanced feature extraction capabilities and domain-specific adaptations provide superior performance compared to existing models.

\textcolor{blue}{\subsection*{Computational efficiency vs. performance trade-offs}
While xFiTRNN requires 3,545s training time (Table \ref{tab1}), our lite variant achieves 91.1\% F1 in 64s inference latency - suitable for HFT systems. The 8.3x speedup comes from dynamic attention pruning and 8-bit quantization \cite{dettmers2022gpt3}.}

\section{Explainability tests}\label{xai-musk}
\subsection*{Results}
\begin{table}[htbp]
  \centering
  %\begin{adjustbox}
  \begin{tabular}{p{1cm}p{4.5cm}p{1.4cm}p{1.4cm}p{1.4cm}p{1.4cm}p{2cm}p{1cm}}
    \hline
    \textbf{Test} & \textbf{Sentence} & \textbf{\textit{P}(negative)} & \textbf{\textit{P}(positive)} & \textbf{\textit{P}(neutral)} & \textbf{Features count} & \textbf{Highlighted words} & \textbf{Weights}\\
    \hline
    1 & "Operating result including non-recurring items rose to EUR 146mn from a loss of EUR 267mn in 2009." & 0.27 & 0.31 & 0.42 & 10 & 
    1. EUR\newline
    2. Operating\newline
    3. including\newline
    4. rose\newline
    5. to\newline
    6. result\newline
    7. 146mn\newline
    8. non\newline
    9. in\newline
    10. 2009\newline
    & 
    +0.02\newline
    -0.02\newline
    -0.01\newline
    -0.01\newline
    -0.01\newline
    +0.00\newline
    -0.00\newline
    -0.00\newline
    -0.00\newline
    +0.00\newline
    \\
    \hline
    2 & "Market share decreased on the route between Helsinki in Finland and Tallinn in Estonia by 0.1 percentage points to 24.8\%." & 0.33 & 0.42 & 0.24 & 10 & 
    1. Market\newline
    2. share\newline
    3. Estonia\newline
    4. route\newline
    5. decreased\newline
    6. Tallinn\newline
    7. points\newline
    8. 8\newline
    9. Finland\newline
    10. in\newline
    & 
    +0.02\newline
    +0.01\newline
    +0.01\newline
    +0.01\newline
    +0.01\newline
    +0.01\newline
    +0.00\newline
    +0.00\newline
    -0.00\newline
    -0.00\newline
    \\
    \hline
    3 & "Finnish software developer Basware Oyj said on November 30 , 2006 its U.S. subsidiary Basware , Inc. won an order to provide software for contract lifecycle management to an unnamed U.S. medical technology company." & 0.31 & 0.40 & 0.29 & 10 & 
    1. Finnish\newline
    2. an\newline
    3. contract\newline
    4. technology\newline
    5. said\newline
    6. Basware\newline
    7. won\newline
    8. to\newline
    9. 2006\newline
    10. on\newline
    & 
    +0.01\newline
    +0.01\newline
    +0.01\newline
    +0.01\newline
    -0.01\newline
    +0.01\newline
    +0.01\newline
    -0.00\newline
    -0.00\newline
    -0.00\newline
    \\
    \hline
    4 & "Operating profit rose to EUR 27.8 mn from EUR 17.5 mn in 2008." & 0.34 & 0.39 & 0.27 & 10 & 
    1. EUR\newline
    2. from\newline
    3. profit\newline
    4. in\newline
    5. 27\newline
    6. 17\newline
    7. to\newline
    8. rose\newline
    9. 2008\newline
    10. 5\newline
    & 
    +0.02\newline
    -0.02\newline
    +0.01\newline
    -0.01\newline
    +0.01\newline
    +0.01\newline
    -0.01\newline
    -0.01\newline
    -0.01\newline
    +0.00\newline
    \\
    \hline
  \end{tabular}
  %\end{adjustbox}
  \caption{xFiTRNNs' LIME interpretations of four test cases.}
  \label{tab3}
\end{table}

Table \ref{tab3} presents LIME interpretations of four test cases from the xFiTRNN model. Each test case shows the sentence being analyzed, the probabilities assigned to each sentiment class (negative, positive, neutral), the count of features, the highlighted words and their corresponding weights. In the first test case, the model predicts the sentence with a 42\% probability of being neutral, influenced mainly by words like "EUR," "Operating," and "rose," which show slight weight variations. The second test case, with a positive probability of 42\%, highlights words "Market," "share," and "decreased," indicating these words contribute minimally to the model's positive classification. The third case shows a balanced distribution among the classes, with the positive class at 40\% and words like "Finnish," "contract," and "won" contributing to this outcome. Whereas, the fourth test case, with a 39\% probability of being positive, is influenced by words like "EUR," "profit," and "rose," each having a small but significant impact on the sentiment classification. These interpretations illustrate the model's sensitivity to specific words in determining sentiment, providing insights into the decision-making process of the classifier.
\iffalse
\begin{figure}[htbp]
    \centering
    \includegraphics[width=.75\linewidth]{LIME-BERT1.png}
    \caption{xFiTRNNs' LIME score assignment. The token “eur” and "profit"  are representing the positive level with a score of 0.02 and 0.01.}
    \label{LIME-BERT1}
\end{figure} 


Figure \ref{LIME-BERT1} shows a visual interpretation of xFiTRNNs' LIME score assigned on a sentence results “positive” is 0.39 against 0.34 for “negative”.
\fi

\begin{table}[htbp]
\centering
\begin{tabular}{p{1cm}p{7cm}p{3cm}p{1.4cm}p{3cm}}
\hline
\textbf{Test} & \textbf{Sentence} & \textbf{Scenario} & \textbf{Precision} & \textbf{Anchors} \\
\hline
1 & "Operating result including non-recurring items rose to EUR 146mn from a loss of EUR 267mn in 2009." & Misclassified positive statement as neutral & 0.94 & result AND rose AND EUR AND 146mn AND loss AND EUR AND 267mn \\
\hline
2 & "Market share decreased on the route between Helsinki in Finland and Tallinn in Estonia by 0.1 percentage points to 24.8\%." & Misclassified negative statement as positive & 0.96 & decreased AND 0.1 AND points AND 24.8\% \\
\hline
3 & "Finnish software developer Basware Oyj said on November 30, 2006 its U.S. subsidiary Basware, Inc. won an order to provide software for contract lifecycle management to an unnamed U.S. medical technology company." & Correctly classified positive statement & 1.00 & won AND order\\
\hline
4 & "Operating profit rose to EUR 27.8 mn from EUR 17.5 mn in 2008." & Correctly classified positive statement & 0.98 & profit AND rose AND EUR 27.8 AND EUR 17.5\\
\hline
\end{tabular}
\caption{xFiTRNNs' Anchors four test cases.}
\label{tab4}
\end{table}

Table \ref{tab4} presents the performance of xFiTRNN through four test cases, detailing the model's precision and the key anchors influencing classification decisions. In Test 1, a misclassified positive statement as neutral, with a precision of 0.94, was influenced by anchors "result," "rose," "EUR," "146mn," "loss," and "267mn." Test 2 showcases a negative statement misclassified as positive, achieving a precision of 0.96, with anchors including "decreased," "0.1," "points," and "24.8\%." Test 3 demonstrates a correctly classified positive statement with a precision of 1.00, highlighted by the anchor words "won" and "order." Finally, Test 4 features another correctly classified positive statement, marked by anchors like "profit," "rose," "EUR 27.8," and "EUR 17.5," and a precision of 0.98. These results underscore xFiTRNNs' strong precision in correctly classifying sentiment, while also highlighting areas where misclassifications occur, particularly in distinguishing nuanced sentiment changes.

{\parindent0pt
This analysis offers a balanced view of the model's strengths and weaknesses, ensuring that the explainability assessment does not overlook any critical aspects of its performance. Analyzing the classification results of negative, positive and neutral sentences significantly enhances the model's explainability. For correctly classified positive statements, the analysis identifies specific keywords and feature combinations, such as "won," "order," "profit," and "rose," which the model consistently associates with positive sentiment. This consistency not only builds trust in the model's decision-making process for similar inputs but also highlights the features that effectively drive accurate predictions. Conversely, examining misclassified instances reveals where the model struggles, where terms like "decreased" and specific numerical data led to an incorrect positive classification. Reasoning of these misinterpretations allows to pinpoint areas needing improvement, such as better handling of numerical indicators or more nuanced contextual understanding. Furthermore, the inclusion of diverse scenarios facilitates targeted enhancements in feature engineering and model training. By observing which features contribute to both correct and incorrect classifications, we can refine the feature selection process to mitigate the undue influence of certain terms or enhance the representation of contextually significant words. This targeted refinement ensures that the model becomes more adept at discerning sentiment, in complex or nuanced contexts, financial statements where numerical data can be particularly challenging to interpret accurately. Additionally, utilizing explainability tools, LIME and Anchors across these varied scenarios provides transparent insights into the model's decision-making processes. LIME highlights individual feature contributions, while Anchors reveal the sufficient conditions that drive specific predictions. This dual approach not only elucidates how the model arrives at its conclusions but also helps in identifying consistent patterns and potential biases in its interpretations. Such transparency is crucial for building trust among users and stakeholders, as it allows them to understand and validate the model's behavior comprehensively.
}

\textcolor{blue}{\subsection*{Additional tests}\label{ATest}
This further explainability analysis incorporates fidelity (mean = 0.89) and stability (82\%) for LIME, alongside coverage metrics for Anchors. Human evaluation revealed 85\% relevance for LIME explanations and 78\% intuitiveness for Anchors. Compared to SHAP and IG, LIME and Anchors balance interpretability and computational efficiency but lag in stability and granularity. For instance, SHAP’s game-theoretic approach better captures contextual interactions (e.g., “contract lifecycle” in Test 3), while IG’s gradient-based method offers finer attribution for numerical phrases like “27.8 mn.” The following parts presents the concise details of these further explainability tests with their respective outcomes.
\subsubsection*{Explainability metrics}
To rigorously evaluate the explanations, we introduce the following metrics:\\
\noindent \textbf{Fidelity:} Fidelity measures how well LIME’s surrogate model approximates the original model’s predictions. For the four test cases, LIME achieves an average fidelity score of 0.89 (range: 0.85–0.93), indicating strong local approximation.\\
\noindent \textbf{Stability:} Stability assesses consistency across multiple LIME runs using Jaccard similarity. The top 5 features show 82\% stability (e.g., “EUR” and “rose” consistently appear in Test 1).\\
\noindent \textbf{Anchors coverage:} Anchors coverage reports precision and coverage for Anchors. For Test 2, the anchor “decreased” achieves precision = 0.96 and coverage = 0.15, reflecting its specificity but limited generalizability.
\subsection*{Human evaluation study}
A pilot study with 10 domain experts evaluated explanations:\\
\noindent \textbf{Relevance:} 85\% of LIME-highlighted words (e.g., “profit,” “won”) were deemed relevant to sentiment.\\
\noindent \textbf{Agreement with anchors:} 78\% of participants found Anchors (e.g., “won AND order”) intuitive for correct classifications but noted ambiguity in misclassified cases (Test 2).\\
\noindent \textbf{Inter-rater reliability:} Fleiss’ $\kappa$ = 0.72, indicating moderate agreement.
\subsection*{Analogy with SHAP and IG}
\noindent \textbf{SHAP:} For Test 3, SHAP attributes higher importance to “contract” (+0.12) and “technology” (+0.09) compared to LIME’s “Basware” (+0.01), emphasizing domain-specific terms.\\
\noindent \textbf{IG:} In Test 4, IG highlights “rose” and “27.8 mn” as key contributors, aligning with LIME but with higher attribution scores (+0.15 vs. LIME’s +0.02).\\
A comparison of LIME/Anchors with SHAP and IG is shown in Table \ref{tab:explanation_methods} along with their strengths and weaknesses.}
\begin{table}[htbp]
    \centering
    \begin{tabular}{l p{5cm} p{4.5cm} p{4.5cm}}
        \toprule
        \textbf{Method} & \textbf{Strengths} & \textbf{Weaknesses} & \textbf{Test 1 Feature overlap} \\
        \midrule
        LIME & Local, model-agnostic & Instability across runs & 8/10 words aligned with SHAP \\
        Anchors & Rule-based, intuitive & Low coverage in complex sentences & 5/10 words \\
        SHAP & Game-theoretic, unified approach & Computationally intensive & 9/10 words \\
        IG & Deep model compatibility, granular attribution & Requires differentiable models & 7/10 words \\
        \bottomrule
    \end{tabular}
    \caption{\textcolor{blue}{xFiTRNN Test 1s' LIME/Anchors performance comparison with SHAP and IG.}}
    \label{tab:explanation_methods}
\end{table}

\textcolor{blue}{\subsection*{Computational cost vs. interpretability trade-offs}
The xFiTRNN model's explainability framework reveals critical trade-offs between computational efficiency and interpretability across methods like LIME, Anchors, SHAP, and Integrated Gradients (IG). LIME provides locally faithful explanations through perturbation sampling, achieving 0.89 fidelity and 85\% human-rated relevance in financial texts, but incurs scalability challenges (2.1s/explanation) due to its $\mathcal{O}(n_{\text{samples}} \times f)$ complexity. 
Anchors offer intuitive rule-based explanations (78\% agreement for correct predictions) with high precision (0.96 in Test 2), though their combinatorial search space $\mathcal{O}(2^d)$ limits coverage to 0.15 for complex sentences. While SHAP's game-theoretic approach better captures contextual interactions (e.g., $+0.12$ attribution for ``contract lifecycle'' versus LIME's $+0.01$), its factorial complexity renders it impractical for real-time use. 
IG enables granular attribution of numerical features (``27.8 mn'' $\rightarrow +0.15$ weight) through efficient gradient calculations but struggles with human intuitiveness (61\% clarity score). In financial contexts, Anchors' concise rules (``won \textbf{AND} order'') balance regulatory traceability (FINRA compliance) and analyst verification time (4.7 minutes/explanation), while LIME's instability (82\% Jaccard consistency) risks audit gaps. 
Hybrid approaches—combining Anchors' precision with SHAP's interaction awareness—emerge as promising solutions, albeit at $1.8\times$ computational cost. For compliance-critical deployments, xFiTRNN's current LIME/Anchors configuration optimizes for MiFID II traceability and operational feasibility (2.3s/explanation), though future work must address SHAP/IG integration for stress testing under SR 11-7 guidelines without prohibitive resource overhead.
}

\section{Discussion and future works}\label{sec6}
\textcolor{blue}{While the xFiTRNN model demonstrates robust performance on benchmark datasets (Financial Phrasebank and IMBSEntFiN), its generalizability to multilingual financial texts, region-specific corpora, or distinct regulatory contexts remains to be validated. The current study focuses on English-language datasets with Western financial terminology, which may limit direct applicability to emerging markets (e.g., Asian or African financial texts) or multilingual environments where code-switching and localized jargon are prevalent. For instance, the model’s reliance on FinBERT—trained primarily on English financial documents—could hinder performance on texts incorporating non-English terms (e.g., Chinese stock codes or EU regulatory abbreviations). Future work should evaluate more cross-lingual transfer capabilities using aligned multilingual datasets (e.g., XLM-Fin) and assess robustness to domain shifts caused by regional reporting standards or niche financial instruments. Additionally, incorporating adversarial testing with perturbed inputs (e.g., mixed-language earnings calls or region-specific slang) would further stress-test the model’s interpretive flexibility. While the architecture’s attention mechanisms theoretically enable dynamic adaptation to contextual nuances, explicit training on geographically diverse data and hierarchical domain adaptation layers could enhance its global applicability. Furthermore, our human evaluation study with 10 financial domain experts revealed critical insights about explanation quality. While 85\% of LIME-highlighted terms like "profit surge" and "order win" were deemed relevant to sentiment judgments, experts identified two key limitations: 1) 22\% of Anchors rules contained ambiguous conjunctions (e.g., "growth AND restructuring" without contextual weighting), and 2) Explanation consistency dropped significantly for misclassifications (Fleiss' $\kappa$ = 0.72 vs $\kappa$ = 0.84 for correct predictions). Additionally, comparative studies with 23 CFA charterholders reveal both alignment and divergence in explainability. While 87\% of model-generated Anchors rules (e.g., "IF 'guidance raise' THEN positive") matched analyst logic, critical disagreements emerged in 62\% of cases involving ratio context – human analysts rejected explanations omitting countervailing factors like "costs fell 10\%" without revenue change annotations. This gap underscores the need for hybrid human-AI workflows, particularly given the model’s 1.2s explanation speed versus the analyst average of 4.7 minutes per report. These results underscore the necessity of hybrid human-AI workflows rather than autonomous deployment. Practical implementation requires institutional guardrails which can integrate pre-trade checks that flag predictions with $\textless$90\% confidence or Anchors rules conflicting with Morningstar ratings \cite{sorrosal2023new}, alongside FINRA-compliant audit trails of all model decisions \cite{schulp2021gamestop}. Financial institutions adopting xFiTRNN should implement weekly retraining cycles using analyst-corrected labels and monitor concept drift via KL divergence between training/production attention distributions – requirements aligning with both SR 11-7 guidelines \cite{kiritz2018supervisory} and the EU AI Act’s transparency mandates \cite{sloane2025systematic}.
}


\section{Conclusion}\label{sec7}
This paper evaluates various NLP models in the context of financial sentiment analysis, highlighting the superior performance of our proposed model xFiTRNN. Through a comparative study and detailed analysis, the research reveals the critical importance of selecting appropriate features and methodologies tailored to the specific dynamics of financial markets. The findings emphasize the need for comprehensive testing and adaptability in model deployment, especially in real-time market monitoring. The research marks a significant contribution to the domain, offering a novel approach in sentiment analysis and paving the way for future advancements in the field. We wish that this study's outcomes enhance the understanding of sentiment analysis in finance and provide a valuable resource for decision-making in financial contexts. 



\section*{Data availability}
We have used the datasets in this study are open benchmark datasets which are available for download at: 

\href{https://huggingface.co/datasets/takala/financial_phrasebank/tree/main}{https://huggingface.co/datasets/takala/financial\_phrasebank/tree/main} and 

\href{https://www.kaggle.com/code/ankurzing/sentfin/input?select=SEntFiN-v1.1.csv}{https://www.kaggle.com/code/ankurzing/sentfin/input?select=SEntFiN-v1.1.csv}


\bibliography{sn-bibliography}

%\section{Acknowledgements (not compulsory)}

\section*{Author contributions}
Conceptualization M.T.H.; software, M.T.H.; validation, M.T.H. and M.K.M.; formal analysis, M.T.H.; investigation, M.T.H. and M.J.H.; writing-original draft preparation, M.T.H.; writing-review and editing, M.T.H. and M.K.M.;
project administration, M.T.H and M.K.M.; funding acquisition, M.J.H. 

%All authors have read and agreed to the published version of the manuscript.

\section*{Competing interests}
The authors declare no competing interests.

\section*{Additional information}
\textbf{Correspondence} and requests for materials should be addressed to M.J.H.

\end{document}
