🐦 Twitter Post Details

Viewing enriched Twitter post

@jerryjliu0

Here are seven full ways to query knowledge graphs with LLMs 👇: 1️⃣ Keyword-based entity retrieval: extract keywords to look up relevant KG entities, pull in linked text chunks. Optionally explore relationships to pull in more context. 2️⃣ Vector-based entity retrieval: lookup KG entities with vector similarity, pull in linked text chunks. Optionally explore relationships. 3️⃣ Hybrid entity retrieval: combination of (1) and (2) with deduplication 4️⃣ Raw vector-index retrieval: remove relationships and represent entities/documents in a flat vector store. 5️⃣ Combine raw vector retrieval with KG retrieval: lookup text chunks via vector similarity or entity retrieval (any one of 1,2,3). Combine/dedup the results. 6️⃣ Run text-to-cypher: Use LLM to generate Cypher queries, can work against any knowledge graph. 7️⃣ Graph RAG (proposed by @wey_gu). Similar to 1,2,3 but over any KG - there doesn’t have to be associated textchunks! Sample results are given below (left 🖼️). Full pros/cons of each approach are attached in the (right) diagram 🖼️ This is one of the most comprehensive treatments of RAG + KG’s in @llama_index that I’ve seen - @wenqi_glantz has done it again! And it covers a cool use case of constructing a knowledge graph over the Philadelphia Phillies for baseball-related queries. Of course, a lot of this builds upon core foundational work by @wey_gu. Article: https://t.co/vRTMDQhDM3

🔧 Raw API Response

{
  "user": {
    "created_at": "2011-09-07T22:54:31.000Z",
    "default_profile_image": false,
    "description": "co-founder/CEO @llama_index\n\nEx-ML @robusthq,  AI research @Uber_ATG, ML Eng @Quora, @princeton",
    "fast_followers_count": 0,
    "favourites_count": 3821,
    "followers_count": 22875,
    "friends_count": 1144,
    "has_custom_timelines": true,
    "is_translator": false,
    "listed_count": 597,
    "location": "",
    "media_count": 579,
    "name": "Jerry Liu",
    "normal_followers_count": 22875,
    "possibly_sensitive": false,
    "profile_image_url_https": "https://pbs.twimg.com/profile_images/1283610285031460864/1Q4zYhtb_normal.jpg",
    "screen_name": "jerryjliu0",
    "statuses_count": 2634,
    "translator_type": "none",
    "url": "https://t.co/S7FkTSefQ0",
    "verified": false,
    "withheld_in_countries": [],
    "id_str": "369777416"
  },
  "id": "1707911970975056126",
  "conversation_id": "1707911970975056126",
  "full_text": "Here are seven full ways to query knowledge graphs with LLMs 👇:\n\n1️⃣ Keyword-based entity retrieval: extract keywords to look up relevant KG entities, pull in linked text chunks. Optionally explore relationships to pull in more context.\n\n2️⃣ Vector-based entity retrieval: lookup KG entities with vector similarity, pull in linked text chunks. Optionally explore relationships.\n\n3️⃣ Hybrid entity retrieval: combination of (1) and (2) with deduplication\n\n4️⃣ Raw vector-index retrieval: remove relationships and represent entities/documents in a flat vector store.\n\n5️⃣ Combine raw vector retrieval with KG retrieval: lookup text chunks via vector similarity or entity retrieval (any one of 1,2,3). Combine/dedup the results.\n\n6️⃣ Run text-to-cypher: Use LLM to generate Cypher queries, can work against any knowledge graph.\n\n7️⃣ Graph RAG (proposed by @wey_gu). Similar to 1,2,3 but over any KG - there doesn’t have to be associated textchunks!\n\nSample results are given below (left 🖼️). Full pros/cons of each approach are attached in the (right) diagram 🖼️\n\nThis is one of the most comprehensive treatments of RAG + KG’s in @llama_index that I’ve seen - @wenqi_glantz has done it again! And it covers a cool use case of constructing a knowledge graph over the Philadelphia Phillies for baseball-related queries.\n\nOf course, a lot of this builds upon core foundational work by @wey_gu.\n\nArticle: https://t.co/vRTMDQhDM3",
  "reply_count": 9,
  "retweet_count": 76,
  "favorite_count": 357,
  "hashtags": [],
  "symbols": [],
  "user_mentions": [],
  "urls": [],
  "media": [
    {
      "media_url": "https://pbs.twimg.com/media/F7O42YdbQAEIx0t.png",
      "type": "photo"
    },
    {
      "media_url": "https://pbs.twimg.com/media/F7O43WebgAAtNpL.jpg",
      "type": "photo"
    }
  ],
  "url": "https://twitter.com/jerryjliu0/status/1707911970975056126",
  "created_at": "2023-09-30T00:15:20.000Z",
  "#sort_index": "1707911970975056126",
  "view_count": 72597,
  "quote_count": 5,
  "is_quote_tweet": false,
  "is_retweet": false,
  "is_pinned": false,
  "is_truncated": true,
  "startUrl": "https://twitter.com/jerryjliu0/status/1707911970975056126"
}