Integrating LLM with NebulaGraph: Enabling Knowledge Graphs via Natural Language

As AI applications, like ChatGPT, gain popularity globally, large language models (LLMs) have garnered significant attention from both enterprises and individual users across various industries. Graph databases, which structure and link information graphically, can enhance LLMs' understanding of the relationships between entities, thereby improving their expressive and reasoning capabilities. So, what kind of innovations might arise when LLMs and graph technology intersect in specific application areas?

Currently, NebulaGraph is collaborating with several globally-renowned LLM teams to integrate LLMs with graph databases. We are excited to reveal that NebulaGraph now supports Text2Cypher, a combined Graph + LLM technology that translates natural language into graph queries. Through a dialogue interface, users can effortlessly construct and query knowledge graphs using natural language. Additionally, we provide a turnkey enterprise-level service. For a firsthand experience with our next-generation Knowledge Graph application powered by NebulaGraph, please follow the link provided at the end of this article.

How can LLMs make knowledge graphs smarter?

AS one of the most common applications in graph technology, knowledge graphs organize and represent knowledge in the form of a graph structure consisting of nodes and edges. Knowledge graphs not only represent the relationships between entities (e.g., people, places, events, and concepts) but also contain the semantic meanings of these relationships. They vividly describe knowledge in the real world in a structured manner, enabling computers to understand and reason about this knowledge. Knowledge graphs are widely used in risk control, production and manufacturing, drug development, scientific research, and other fields.

Text2Cypher, as its name implies, converts natural language text into Cypher queries. One of the challenges that previously impeded the broader adoption of graph databases and knowledge graphs was the technical barrier associated with querying these databases. So, how did we manage this prior to the advent of large language models?

Traditional Text2Cypher

Before the emergence of large language models, the most common application of knowledge graphs was to convert natural language text into Cypher queries. For example, the internal system of a KBQA (Knowledge Base Question Answering) system is essentially text2cypher.

When a question is submitted to the system, it initially conducts intent and entity recognition. Subsequently, it employs an NLP model or code to formulate a query statement based on the identified intent and entity. The system then queries the graph database and crafts a response based on the retrieved structure.

So, what are the challenges associated with this approach?

  • Understanding intent from natural language: Which category of questions does the question correspond to?

  • Identifying entities: What are the main entities involved in the question?

  • Constructing a query statement based on intent and entities

This is not an easy development task. A truly implementable model or rule code must consider many boundary conditions.

LLM-based Text2Cypher

In the era of large language models, the above-mentioned "smart" application scenarios that previously required specialized training or rule writing can now be completed using a general model and prompt engineering.

Note: Prompt engineering refers to the use of natural language descriptions to enable generative models and language models to complete smart tasks.

NebulaGraph has undertaken extensive R&D validation to successfully integrate large language models with graph query languages. Now, when users submit a task, they can utilize natural language for schema acquisition, Cypher statement generation, prompts, and various other large language model (LLM) calls and result processing. This offers a truly code-free, ready-to-use solution for knowledge graph construction and querying.

Easy Knowledge Graph Construction and Querying with NebulaGraph

With the integration of NebulaGraph and large language models, enterprise users can easily construct and query knowledge graphs. Not only can they complete high-accuracy searches and intuitive visualizations at a lower cost, but they also no longer need to invest a long time in learning how to obtain important insights from graphs.

Compared with the previous generation of knowledge graphs, the combination of NebulaGraph and large models enables enterprises to construct knowledge graphs based on massive data at a lower cost and with greater convenience. Additionally, users can directly use natural language for interactive questioning and querying, thereby reducing the threshold for enterprise use and lowering the learning curve for users.

Demo

Click the demo for a firsthand experience of constructing and querying knowledge graphs using natural language. For more about NebulaGraph and to connect to the digital future with NebulaGraph, visit our official website.