IDEAS home Printed from https://ideas.repec.org/p/bdi/wpmisp/mip_044_24.html
   My bibliography  Save this paper

Fine-tuning large language models for financial markets via ontological reasoning

Author

Listed:
  • Teodoro Baldazzi

    (Università Roma Tre)

  • Luigi Bellomarini

    (Bank of Italy)

  • Stefano Ceri

    (Politecnico di Milano)

  • Andrea Colombo

    (Politecnico di Milano)

  • Andrea Gentili

    (Bank of Italy)

  • Emanuel Sallinger

    (TU Wien; University of Oxford)

Abstract

Large Language Models (LLMs) usually undergo a pre-training process on extensive collections of generic textual data, which are often publicly accessible. Pre-training enables LLMs to grasp language grammar, understand context, and convey a sense of common knowledge. Pre-training can be likened to machine learning training: the LLM is trained to predict the next basic text unit (e.g., a word or a sequence of words) based on the sequence of previously observed units. However, despite the impressive generalization and human-like interaction capabilities shown in Natural Language Processing (NLP) tasks, pre-trained LLMs exhibit significant limitations and provide poor accuracy when applied in specialized domains. Their main limitation stems from the fact that data used in generic pre-training often lacks knowledge related to the specific domain. To address these limitations, fine-tuning techniques are often employed to refine pre-trained models using domain-specific data. Factual information is extracted from company databases to create text collections for fine-tuning purposes. However, even in this case, results tend to be unsatisfactory in complex domains, such as financial markets and finance in general. Examining the issue from a different perspective, the Knowledge Representation and Reasoning (KRR) community has focused on producing formalisms, methods, and systems for representing complex Enterprise Knowledge. In particular, Enterprise Knowledge Graphs (EKGs) can leverage a combination of factual information in databases and business knowledge specified in a compact and formal fashion. EKGs serve the purpose of answering specific domain queries through established techniques such as ontological reasoning. Domain knowledge is represented in symbolic forms, e.g., logic-based languages, and used to draw consequential conclusions from the available data. However, while EKGs are applied successfully in many financial scenarios, they lack flexibility, common sense and linguistic orientation, essential for NLP. This paper proposes an approach aimed at enhancing the utility of LLMs for specific applications, such as those related to financial markets. The approach involves guiding the fine-tuning process of LLMs through ontological reasoning on EKGs. In particular, we exploit the Vadalog system and its language, a state-of-the-art automated reasoning framework, to synthesize an extensive fine- tuning corpus from a logical formalization of domain knowledge in an EKG. Our contribution consists of a technique called verbalization, which transforms the set of inferences determined by ontological reasoning into a corpus for fine-tuning. We present a complete software architecture that applies verbalization to four NLP tasks: question answering, i.e., providing accurate responses in a specific domain in good prose; explanation, i.e., systematically justifying the conclusions drawn; translation, i.e., converting domain specifications into logical formalization; and description, i.e., explaining formal specifications in prose. We apply the approach and our architecture in the context of financial markets, presenting a proof of concept that highlights their advantages.

Suggested Citation

  • Teodoro Baldazzi & Luigi Bellomarini & Stefano Ceri & Andrea Colombo & Andrea Gentili & Emanuel Sallinger, 2024. "Fine-tuning large language models for financial markets via ontological reasoning," Mercati, infrastrutture, sistemi di pagamento (Markets, Infrastructures, Payment Systems) 44, Bank of Italy, Directorate General for Markets and Payment System.
  • Handle: RePEc:bdi:wpmisp:mip_044_24
    as

    Download full text from publisher

    File URL: https://www.bancaditalia.it/pubblicazioni/mercati-infrastrutture-e-sistemi-di-pagamento/approfondimenti/2024-044/N.44-MISP.pdf
    Download Restriction: no
    ---><---

    More about this item

    Keywords

    Ontological reasoning; Large language models; Knowledge graphs;
    All these keywords.

    NEP fields

    This paper has been announced in the following NEP Reports:

    Statistics

    Access and download statistics

    Corrections

    All material on this site has been provided by the respective publishers and authors. You can help correct errors and omissions. When requesting a correction, please mention this item's handle: RePEc:bdi:wpmisp:mip_044_24. See general information about how to correct material in RePEc.

    If you have authored this item and are not yet registered with RePEc, we encourage you to do it here. This allows to link your profile to this item. It also allows you to accept potential citations to this item that we are uncertain about.

    We have no bibliographic references for this item. You can help adding them by using this form .

    If you know of missing items citing this one, you can help us creating those links by adding the relevant references in the same way as above, for each refering item. If you are a registered author of this item, you may also want to check the "citations" tab in your RePEc Author Service profile, as there may be some citations waiting for confirmation.

    For technical questions regarding this item, or to correct its authors, title, abstract, bibliographic or download information, contact: the person in charge (email available below). General contact details of provider: https://edirc.repec.org/data/bdigvit.html .

    Please note that corrections may take a couple of weeks to filter through the various RePEc services.

    IDEAS is a RePEc service. RePEc uses bibliographic data supplied by the respective publishers.