Symbolic Knowledge Injection & Extraction for Autonomous Learning

Second Year PhD report

🎀 Matteo Magnini, supervisor Andrea Omicini

πŸ“§ matteo.magnini@unibo.it

Context

Fundamentals

Symbolic Knowledge


$$ \forall x \, \text{Man}(x) \implies \text{Mortal}(x) $$

$$ \text{Man}(\text{Socrates}) $$

$$ \text{Mortal}(\text{Socrates}) $$

All those knowledge representations where there are symbols carrying meaning: logic rules, traffic signs, sentences in natural language, etc.

Sub-symbolic models

Models that are based on numerical values and do not have a symbolic meaning like neural networks.

Intelligent Systems

Intelligent systems incorporate knowledge, possibly both symbolic and sub-symbolic, to make decisions.

Symbolic Knowledge Injection (SKI)

Constraining

The training process is guided by the loss function that incorporates the knowledge penalising the model when it makes predictions that violates it.

Embedding

The symbolic knowledge is embedded into a sub-symbolic representation. The embeddings are provided as additional input to the neural network.

Structuring

The network architecture is modified to include symbolic knowledge. Some neurons and connection are designed to mimic the symbolic knowledge.

Symbolic Knowledge Extraction (SKE)

Data

The well known Iris dataset is used to train a neural network.

Sub-symbolic model

A neural network is trained to classify the Iris dataset. A human can’t understand how the network makes decisions by inspecting it.

Symbolic knowledge

A decision tree is generated from the neural network to extract symbolic knowledge. The decision tree is interpretable by humans.

Current literature limitations

Technology

  • The vast majority of the literature articles lack the implementation of the proposed methods.
  • The ones that do, only have the code to run the experiments (if still available and maintained).
  • Only a handful of works provide a library to use the proposed method.

Methodology

  • SKI (resp. SKE) methods primarily focus in achieving better performance for the educated (resp. surrogate) model.
  • There is a lack of works that explore qualitative aspects of the model, a.k.a. Quality of Service (QoS).
  • SKI can be used for other purposes rather than improving the model performance, like ensuring fairness quality.

Vision

  • SKI and SKE methods are virtually used only to solve toy-problems to validate the approach.
  • The potential of these methods in real-world applications is not explored.
  • Also, the conjunct use of SKI and SKE is not explored.

Proposed approach

Roadmap

  • Study the current literature to understand the state-of-the-art in SKI and SKE.
  • Design tools to support the implementations of new and already existing SKI and SKE methods.
  • Formalise QoS metrics for SKI and SKE methods.

Intelligent Systems branch

  • Design and implement intelligent systems that make use of SKI and SKE methods for real-world applications.

Fairness branch

  • Explore the use of SKI methods to ensure fairness in AI systems.
  • Design a specific language to express fairness constraints.

Contributions

Systematic Literature Review

  • β€œG. Ciatto et al., Symbolic Knowledge Extraction and Injection with Subsymbolic Predictors: A Systematic Literature Review, in journal ACM Computing Surveys 2024”

Technologies

SKI methods

  • β€œM. Magnini et al., KINS: Knowledge Injection via Network Structuring, in workshop CILC 2022”
  • β€œM. Magnini et al., Knowledge injection of Datalog rules via Neural Network Structuring with KINS, in journal Logic and Computation 2023”
  • β€œM. Magnini et al., A view to a KILL: knowledge injection via lambda layer, in workshop WOA 2022”

Quality of Service

  • β€œA. Agiollo et al., Symbolic knowledge injection meets intelligent agents: QoS metrics and experiments, in journal Autonomous Agents and Multi-Agent Systems 2023”
  • β€œA. Rafanelli et al., An Empirical Study on the Robustness of Knowledge Injection Techniques Against Data Degradation, in workshop WOA 2024”

Contributions

Intelligent systems

  • β€œM. Magnini et al., Symbolic knowledge extraction for explainable nutritional recommenders, in journal Computer Methods and Programs in Biomedicine 2023”
  • β€œG. Ciatto et al., A General-Purpose Protocol for Multi-agent Based Explanations, in workshop EXTRAAMAS 2023”

SKI and SKE conjunct

  • β€œM. Magnini et al., Bridging Symbolic and Sub-Symbolic AI: Towards Cooperative Transfer Learning in Multi-Agent Systems” in workshop AIxIA DP 2022

Fairness

  • β€œM. Magnini et al., Enforcing Fairness via Constraint Injection with FaUCI, in workshop AEQUITAS 2024”

And then LLMs happened

Large Language Models

LLMs are huge neural networks (up to hundreds of billions of parameters) that are trained on a large corpus of text data. Generally, LLMs work by predicting the most plausible token given the previous tokens in a sentence. In the last years, the success of LLM has been world-wide recognised, and they are successfully used in applications of different domains.

SKE with LLM

LLMs can be exploited to extract symbolic knowledge about a particular domain of interest. The process can be done by iteratively querying the LLM with a set of questions following a specific protocol. From the answers, a symbolic representation can be generated.

SKI with LLM

Conversely, LLMs can operate by exploiting external (symbolic) knowledge like textual documents, ontologies, databases, etc. This knowledge can be provided with two different strategies:

  • Fine-tuning: similar to the traditional fine-tuning process, re-training the LLM with the new data.
  • Retrieval-augmented generation (RAG): retrieval mechanism to get relevant information from the external knowledge and then generation phase.

Contributions

Applications, SKI and SKE with LLMs

  • β€œM. Magnini et al., Actively Learning Ontologies from LLMs: First Results (Extended Abstract), in workshop DL 2024”
  • β€œS. Montagna et al., LLM-based Solutions for Healthcare Chatbots: a Comparative Analysis, in workshop PERCOM 2024”

Challenges and Future work

  • Reliability of SKI/SKE systems and LLMs. E.g., extracted/injected knowledge is sound? Are there hallucinations? etc.
  • Fairness, are there bias in the LLMs? If positive, how to mitigate it?
  • Closing the loop between SKI and SKE, how to use the extracted knowledge to improve the injected one continuously?
  • Real-world applications, explore new tasks where SKI/SKE and LLMs (possibly with multiple roles) can be used.