https://github.com/cefriel/procedural-kg-llm
Prompt-based pipeline for extracting procedural knowledge graphs from text with LLMs
https://github.com/cefriel/procedural-kg-llm
Last synced: 5 months ago
JSON representation
Prompt-based pipeline for extracting procedural knowledge graphs from text with LLMs
- Host: GitHub
- URL: https://github.com/cefriel/procedural-kg-llm
- Owner: cefriel
- License: apache-2.0
- Created: 2024-02-28T07:35:11.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-07-03T09:54:56.000Z (about 1 year ago)
- Last Synced: 2025-09-09T23:48:02.618Z (10 months ago)
- Language: Jupyter Notebook
- Size: 217 KB
- Stars: 13
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Procedural Knowledge Graph extraction from Text with Large Language Models
We propose a **prompt-based pipeline** for extracting **procedural knowledge graphs** from text with LLMs.
This pipeline extracts **steps**, **actions**, **objects**, **equipment** and **temporal information** from a textual procedure, in order to populate a **Procedural KG** according to a **pre-defined ontology**.

## Experimental setting
For our experiments, we:
- used the [GPT 4o model](https://platform.openai.com/docs/models/gpt-4o)
- set the temperature parameter to 0
- rely on the [LangChain framework](https://www.langchain.com/)
Procedures used in the prompt engineering refinement process, and in the evaluation, are selected from [WikiHow](https://wikihow.com/)
We reuse [this JSON dataset available on GitHub](https://github.com/zharry29/wikihow-goal-step)
## How to navigate this repository
### pkg-extraction / notebooks
This folder contains:
- **pkg-extraction.ipynb**, the notebook with the pipeline of 2 prompts
- a subfolder **preliminary-experiments** containing the notebooks with our preliminary experiments
The repository defines a `docker-compose.yml` file to run the Jupyter notebooks as containers via Docker.
The containers can be run all at once or separately.
The notebooks can be executed running the container, from the folder with the .yml file, with the command:
```
docker-compose up --force-recreate
```
A `credentials.json` file should be provided in the main folder with a valid key for the OpenAI API.
```
{
"OPENAI_API_KEY": "PUT_HERE_YOUR_KEY"
}
```
### data-results
- **ontology**: this folder contains the procedural ontology used as reference in the experiments
- **clean-flat-panel-monitor**, **fix-rubbing-door**, **cook-honey-glazed-parsnips**, **plant-bare-root-tree**: these folders contain input and output data for the 4 procedures
- **preliminary-experiments**: this folder contains the results of previous experiments during the prompt engineering refinement process
### human-assessment
This folder contains:
- materials and results from the human assessment of the LLM results
- a subfolder **preliminary-experiments** containing the materials and results from the human assessment of our preliminary experiments
### Contributing
Before contributing, please read carefully, complete and sign our [Contributor Licence Agreement](https://github.com/cefriel/contributing/blob/main/contributor-license-agreement.pdf).
When contributing to this repository, please first discuss the change you wish to make via issue or any other available method with the repository's owners.