Query Expansion and Prompting Options for Large Language Models when Interpreting News Flow

No Thumbnail Available

Files

URL

Journal Title

Journal ISSN

Volume Title

Sähkötekniikan korkeakoulu | Bachelor's thesis
Electronic archive copy is available locally at the Harald Herlin Learning Centre. The staff of Aalto University has access to the electronic bachelor's theses by logging into Aaltodoc with their personal Aalto user ID. Read more about the availability of the bachelor's theses.

Date

2024-08-29

Department

Major/Subject

Informaatioteknologia

Mcode

ELEC3015

Degree programme

Sähkötekniikan kandidaattiohjelma

Language

en

Pages

5+30

Series

Abstract

This thesis developed a system for large language model (LLM) based system to answer questions based on the news feed in collaboration with Outokumpu Oyj. The system utilized query expansion, neural vector-space-model sorting, and a generalist LLM. The chosen case was estimating the price of stainless steel, specifically 304L, next month. For this purpose, the LLM was provided with the current status as a reference point. This status included the current price and the previous month-on-month change. Additionally, the LLM was provided with 100 of the most relevant articles. The goal of the thesis is to estimate the benefits of query expansion for this use case in both classification and value estimation. The value estimation queried for the price for the next month, while the classification requested the LLM to classify the change into one of five classes corresponding to the current outlook ranging from significantly down to significantly up. The most relevant articles were selected against a reference text provided by the LLM using vector embeddings. The embeddings were compared with cosine similarity and created using OpenAI’s embedding API. The news articles were sourced from World News API using queries provided by the LLM. Two systems were implemented and compared, one system was implemented with query expansion. In this system, the initial LLM search keyword query also included the LLM dividing the query into five factors that influence the answer to the question. Both used the same LLM to generate search words and reference texts. Extensive prompt engineering was applied in constructing the prompts. The thesis concluded that query expansion was necessary for answering such a specific question. The system without query expansion performed considerably poorly. With the implementation in this thesis the LLM was practically incapable of classification for the future outlook of the price of stainless steel, with and without higher-level query expansion.

Tässä opinnäytetyössä kehitettiin laajaan kielimalliin perustuva uutisvirtaa tulkitseva ja hyödyntävä järjestelmä yhteistyössä Outokumpu oyj:n kanssa. Järjestelmä hyödyntää kyselynlaajennusta, vektoriavaruusmallilajittelua ja yleispätevää kielimallia. Valittu tutkimustapaus on ruostumattoman teräksen hinnan arviointi, tarkemmin laadun 304L kuumavalssatun kelan hinnan. Kielimallille annettiin tämän kuukauden hinta sekä muutos edellisestä kuukaudesta referenssipisteinä. Tämän lisäksi kielimallille annettiin 100 relevanttia artikkelia, joihin kielimalli ohjeistettiin perustamaan päätelmänsä. Opinnäytetyön tavoite oli arvioida kyselyn laajennuksen hyötyjä tarkkoihin kysymyksiin vastatessa sekä muutoksen luokittelussa että suorassa hinnan arvioinnissa. Hintaa pyydettiin arvioimaan seuraavalle kuukaudelle ja luokittelu sisälsi viisi luokkaa hinnan muutokselle luokat välillä huomattavasti alas ja huomattavasti ylös. Artikkelit lajiteltiin kielimallilta saatua referenssitekstiä varten OpenAI:n neuraalista vektoriavaruusmallia käyttäen. Artikkeleita verrattiin tekstiin cosine samanlaisuuden avulla. Uutisartikkelit haettiin World News API:n sovellusrajapinnasta käyttäen kielimallin luomia kyselyitä. Opinnäytetyössä koottiin kaksi järjestelmää, toinen suoritti kyselyn laajennuksen. Tämän järjestelmän alkukysely, jossa haettiin referenssiteksti ja kysely, sisälsi myös kyselyn laajennuksen viiteen eri kysymyksen vastaukseen vaikuttavaan tekijään. Molemmissa järjestelmissä käytettiin samaa kehotetta lopullisen vastauksen kysymiseen. Opinnäytetyön lopputuloksena on, että kyselyn laajennus tuo arvoa tarkkoihin kysymyksiin vastatessa. Järjestelmä, jossa suoritettiin kyselyn laajennus, osasi vastata kysymykseen suhteellisen hyvin, kun kysyttiin seuraavan kuukauden hintaa. Tätä vastoin järjestelmä ilman kyselynlaajennusta ei osannut vastata kysymykseen järkevällä tasolla ollenkaan. Kumpikaan järjestelmä ei osannut luokitella hinnan muutosta.

Description

Supervisor

Aalto, Samuli

Thesis advisor

Juvela, Lauri

Keywords

query expansion, vector-space-models, large language model

Other note

Citation