AI CENTER
  • ABOUT
    • Our Mission
    • Our People​
    • OUR EVENT
    • Our Equipment
    • Our Space
    • Our Logo
    • Our Publication
  • Our research
    • Research Topic
    • PROJECTS
    • Digital Twin
  • Our Educational Programs
    • Summer Internship Program
    • DOCTORAL PROGRAM
    • courses
  • Contact
  • Search
  • BLOG

BLOG

Knowledge Graph for RAG

5/12/2025

0 評論

 
Knowledge Graph for RAG
✨ Inspired by “Knowledge Graphs for RAG” by DeepLearningAI. ✨
✨ Collaborate with NTU’s Civil Engineering AI Ph.D. Colleague. ✨
What are knowledge graphs?Knowledge Graphs are comprised of nodes and edges, which respectively represent entities or concepts, as well as the relationships, facts, attributes, or categories between them.This graph describes data in the form of nodes, as well as the associations (relationships) between the nodes.
  • Nodes are data records
  • Both nodes and relationships can have properties.
  • Nodes can be given labels to group them together.
  • Relationships always have a type and a direction.
  • A knowledge graph is a database that stores information in nodes and relationships.
圖片
Knowledge Graphs’ main components
A knowledge graph is a directed labeled graph that comprises three elements:
圖片
  • Nodes — real-world entities that can be both material things and abstract concepts
  • Edges — links that connect the nodes
  • Labels — attributes that define the relationships between the nodes and reasoning rules on edges
​
Creating a Knowledge Graph
Extract: identify interesting information
圖片
Enhance: supercharge the data
圖片
Expand: connect information to expand context
圖片
How Do Knowledge Graphs Work in Neo4j
Basic syntactic patterns
圖片
() indicates nodes; — represents connections/undirected; -> indicates directed connections
For instance
圖片
Refer to the basic code example

Creating a graph model based on bridge design specifications in civil engineering can be quite illustrative. Here, we’ll define a small example of such a graph using Neo4j and Cypher. This example will include two types of each node: Material, Beam, Pier, DesignRequirement, and Section. Creating a graph model based on bridge design specifications in civil engineering. This example will include two types of each node: Material, Beam, Pier, DesignRequirement, and Section. Also define relationships: MADE_OF, SUPPORTS, MEETS, USES, APPLIES_TO.

Step 1: Define Nodes
圖片
圖片
Step 2: Define Relationships
圖片
圖片
Visualizing the Graph
Once you have created the nodes and relationships in Neo4j, you can visualize the graph using the following query:
圖片
Vector Databases
圖片
Vector databases are collections of high-dimensional vectors that represent entities or concepts, such as words, phrases, or documents. These can be used to measure the similarity or relevance between different entities or concepts.
  • Vector databases consist of high-dimensional vectors representing various entities or concepts.
  • It can be used to measure the similarity or relatedness of different entities or concepts based on their vector representations.
Vector Database in RAG
Vector databases are adept at storing high-dimensional vectors and performing semantic searches with blistering speed. In situations that require immediate data retrieval, such as powering a customer service chatbot, vector databases excel. They quickly find the nearest vector match to a query, ensuring relevancy and accuracy.
圖片
Vector Databases vs Knowledge Graphs
圖片
Knowledge graphs have a significant advantage over vector databases in supporting language model text generation. Knowledge graphs can provide more precise, specific information, support more complex and diverse queries, and enable deeper levels of reasoning and inference.
  1. Knowledge graphs provide precise and specific information, capable of clearly demonstrating the types and directions of relationships between entities or concepts, which helps in generating more accurate and relevant text.
  2. Knowledge graphs support more complex and varied queries, capable of answering questions using logical operators (for example, questions are based on all entities with specific attributes or the common categories of multiple entities), making the generated text more diverse and interesting.
  3. Knowledge graphs enable more advanced reasoning and inference, which allows indirect information to be derived from the database, thereby helping to generate text that is more logical and consistent.
Licensed under the CC BY-NC-ND 4.0 DEED, please attribute the source when reposting the content.
#Deep Learning #Deeplearningai #Knowledge Graph #Neo4j
0 評論



發表回覆。

    作者

    寫一些關於自己的事。不必花俏,簡單描述即可。

    封存檔

    五月 2025
    四月 2025

    類別

    全部
    LLM
    RAG

    RSS 訂閱

圖片

​©
NCREE - NTUCE Joint Artificial Intelligence Research Center. All Rights Reserved.
Address : 台北市大安區辛亥路三段200號
Email : [email protected]
  • ABOUT
    • Our Mission
    • Our People​
    • OUR EVENT
    • Our Equipment
    • Our Space
    • Our Logo
    • Our Publication
  • Our research
    • Research Topic
    • PROJECTS
    • Digital Twin
  • Our Educational Programs
    • Summer Internship Program
    • DOCTORAL PROGRAM
    • courses
  • Contact
  • Search
  • BLOG