Inspiration

We always wanted to bring revolutionary ideas in enhancing learning experience. Connecting the dots is very important to create a mind map which increases the recalling power. As engineering students, we have studied a course named Discrete Mathematics in which we learned about 'graph theory'. So we decided to use the power of LLMs to create knowledge graphs and extract useful information from any given paragraph.

What it does

Our project takes any paragraph text as input and visualizes the graph consisting of nodes of important keywords with links between the nodes depicting some relationship between them.

How we built it

We used the LLM Mistral-7B-Openorca finetuned on Openorca dataset (for appropriate prompts). We have imported this model and used it locally through hugging face's transformers. We built a function to create an appropriate prompt for the model.

*Workflow: Input text → Generate apt prompt → Encoding input prompt by tokenizer → Generate output in encoded form using LLM → Decode the output by tokenizer in the form of JSON format string → preprocessing the string to get the JSON part of the string → converting string into JSON format → generating the graph and visualizing it using Pyvis 

Challenges we ran into

We faced a lot of challenges during the project building.

  1. Choosing the LLM through transformers
  2. Running LLM on low memory space using BitsAndBytes Quantization
  3. Choosing the right prompt for the appropriate answer.
  4. Creating UI that interacts with python functions.

Accomplishments that we're proud of

We are proud of solving all the challenges mentioned above. All the challenges tested our patience and skills as well.

What we learned

We learned a lot from this project. We learned to use LLM using transformers, some prompt engineering stuff, some NLP concepts and creating UI for interactions.

What's next for Knowledge Graph Generator

Project we have built till now is only compatible for Google Colab due to GPU requirements for running LLM locally. But we want to extend this project to using API for LLM which are fast and efficient.

Built With

  • huggingface
  • python
  • pyvis
  • transformers
Share this project:

Updates