Teaching an AI to use a knowledge graph for semantic compression

The following conversation has implications for MemGPT and similar use cases, as well as LLM/Knowledge Graph integration. Instead of requiring URIs for everything (which would require constant lookups against a lexicon of all-possible-things) this uses locally non-ambiguous (aka conversational) identifiers. Something like this would be great for tracking continuity in fiction, for instance. Maybe a turtle syntax would be a bit bitter.

The AI was Google Bard. And yes, I realize this “taught” the AI nothing beyond this immediate conversation. Unless the Google engineers read this post, this is only a demonstration of what’s possible.

The conversation begins thus…


Given the following sentences, I want you to express them as triples, with a subject, predicate, and object. The format for each should be an identifier that a reasonable reader could interpret, with no spaces. The overall format is <subject> <predicate> <object>. including angle brackets and an ending period. For example “Jeff lives in Atlanta” would become <Jeff> <lives_in> <Atlanta>. Acknowledge these instructions by replying with the single word OK.

AI> OK.

Sally’s eyes are blue. She is wearing a red dress.


AI: <Sally> <has_eyes> <blue>. <Sally> <has_dress> <red>.

(aside: note the pronoun ‘she’ in the second sentence correctly dereferenced based on context.)

Good. <Sally> <eye_color> <blue>. would be better.

AI: … I will keep this in mind for future prompts.

Harry met Sally in Seattle.

AI: <Harry> <met> <Sally> <in> <Seattle>.

This is a tricky one and requires reification. For example <Harry> <participant> <meeting>. <Sally> <participant> <meeting>. <Meeting> <location> <Seattle>.

AI: You are correct … The following triples represent the reified version of the prompt:

  • <Harry> <participant> <meeting>.
  • <Sally> <participant> <meeting>.
  • <meeting> <location> <Seattle>.

Amit likes ice cream and soda.

AI:

  • <Amit> <likes> <ice_cream>.
  • <Amit> <likes> <soda>.

Grandpa fought in WW2 in 1943.

AI:

  • <Grandpa> <fought_in> <WW2>.
  • <WW2> <happened_in> 1943.

(aside: interesting that it decided that the year didn’t need to be quoted like an identifier)

Once upon a time, in a hole there lived a Hobbit.

AI: <Hobbit> <lived_in> <hole>.

Jane wore blue yesterday, but today she’s wearing green.

AI:

  • <Jane> <wore> <blue> <yesterday>.
  • <Jane> <wore> <green> <today>.

These are quads, not triples. Can you reify them into additional triples?

AI: Event 1:

  • <JaneWoreBlue><participant><Jane>.
  • <JaneWoreBlue><has_clothing><blue_clothing>.
  • <JaneWoreBlue><happened_on><yesterday>.

AI: Event 2:

  • <JaneWoreGreen><participant><Jane>.
  • <JaneWoreGreen><has_clothing><green_clothing>.
  • <JaneWoreGreen><happened_on><today>.

(aside: this is actually a reasonable solution)

FIN (for now!)