Leveraging LlaMA 2 for sentiment analysis
(2024) NEKH02 20232Department of Economics
- Abstract
- This thesis investigates the application of sentiment analysis in predicting stock returns for the companies listed in the OMXS30 index. The recent development of large language models (LLMs), like ChatGPT, has substantially advanced the field of sentiment analysis. This thesis utilizes Meta’s LlaMA 2 LLM for sentiment analysis, while a random forest model is employed to predict monthly stock returns for the subsequent month. These predictions enable the creation of a dynamic long-short portfolio, with its returns evaluated against the OMXS30 index using the capital asset pricing model, the Fama–French three-factor model, and the Carhart four-factor model. The results demonstrate that it is possible to generate excess returns by leveraging... (More)
- This thesis investigates the application of sentiment analysis in predicting stock returns for the companies listed in the OMXS30 index. The recent development of large language models (LLMs), like ChatGPT, has substantially advanced the field of sentiment analysis. This thesis utilizes Meta’s LlaMA 2 LLM for sentiment analysis, while a random forest model is employed to predict monthly stock returns for the subsequent month. These predictions enable the creation of a dynamic long-short portfolio, with its returns evaluated against the OMXS30 index using the capital asset pricing model, the Fama–French three-factor model, and the Carhart four-factor model. The results demonstrate that it is possible to generate excess returns by leveraging LlaMA 2, with sentiment ingrained as a key risk factor. The thesis contributes to the existing literature by examining the Swedish stock market as well as using the open-source LLM LlaMA 2. (Less)
Please use this url to cite or link to this publication:
http://lup.lub.lu.se/student-papers/record/9146204
- author
- Upadhyaya, Vivea LU and Darell, Johan LU
- supervisor
- organization
- course
- NEKH02 20232
- year
- 2024
- type
- M2 - Bachelor Degree
- subject
- keywords
- OMXS30, sentiment analysis, efficient market hypothesis, random forest
- language
- English
- id
- 9146204
- date added to LUP
- 2024-04-16 09:27:04
- date last changed
- 2024-04-16 09:27:04
@misc{9146204, abstract = {{This thesis investigates the application of sentiment analysis in predicting stock returns for the companies listed in the OMXS30 index. The recent development of large language models (LLMs), like ChatGPT, has substantially advanced the field of sentiment analysis. This thesis utilizes Meta’s LlaMA 2 LLM for sentiment analysis, while a random forest model is employed to predict monthly stock returns for the subsequent month. These predictions enable the creation of a dynamic long-short portfolio, with its returns evaluated against the OMXS30 index using the capital asset pricing model, the Fama–French three-factor model, and the Carhart four-factor model. The results demonstrate that it is possible to generate excess returns by leveraging LlaMA 2, with sentiment ingrained as a key risk factor. The thesis contributes to the existing literature by examining the Swedish stock market as well as using the open-source LLM LlaMA 2.}}, author = {{Upadhyaya, Vivea and Darell, Johan}}, language = {{eng}}, note = {{Student Paper}}, title = {{Leveraging LlaMA 2 for sentiment analysis}}, year = {{2024}}, }