liveBook · Manning

Chapter 5: Extracting domain-specific knowledge from unstructured data

What you will learn in chapter 5 of Knowledge Graphs and LLMs in Action

Introduces why unstructured documents are valuable sources for knowledge graphs and frames the work as knowledge representation and knowledge learning.

After this chapter you will be able to

What it builds on

Section by section

Introduction

Introduces why unstructured documents are valuable sources for knowledge graphs and frames the work as knowledge representation and knowledge learning.

Key terms: unstructured data, structured data, knowledge representation, KG, knowledge learning, NLP, LLMs, data enrichment, data modeling

5.1 The archives challenge

This section introduces the Rockefeller Archive Center’s program-officer diaries as a challenging source of unstructured data for investigating how research grants were awarded.

Key terms: program officers, diaries, domain-specific nomenclature, unstructured data, grant-making processes, recommendations, internal discussions, funding subdisciplines

5.2 Key concepts of knowledge extraction

This section identifies entity recognition and relationship extraction as the two building blocks for turning text into a structured knowledge graph.

Key terms: entities, relationships, knowledge extraction, structured KGs

5.2.1 Recognizing named entities

This subsection introduces named entity recognition as the first step from unstructured text toward a knowledge graph and explains why an archive may need domain-specific entity categories.

Key terms: named entity recognition (NER), named entities, predefined categories, generic entity categories, Topic entity, research discipline, technology, disease, custom entity-extraction system

5.2.2 Extracting relations

The section explains how extracting relationships between named entities turns information in text into knowledge graph connections.

Key terms: relation extraction (RE), semantic relations, entity pairs, KG

5.3 Building KGs with large language models

The section explains why LLMs can help extract knowledge from text for KG building, and why their outputs still require caution.

Key terms: transfer learning, human-labeled data, RE, model complexity, training corpus, data-centric paradigm, model-centric approach, prompt engineering, hallucinations, false reasoning

5.3.1 Using LLMs

This subsection explains how to use LLM text completion to extract entities and relations for a knowledge graph, starting with prompts and fine-tuning when prompts are insufficient.

Key terms: text completion, prompt, prompt engineering, entities, relations, data exploration, domain, knowledge extraction, prompt-based approach, training dataset

5.3.2 Prompt engineering examples

This section uses successive prompts to show how LLMs extract knowledge from a diary entry and how prompt guidance improves consistency for knowledge-graph building.

Key terms: coreference resolution, generative nature of LLMs, traditional RE, normalization, node labels, relation types, prediction stability, KG schema, entity classes, occupation

5.3.3 Prompt engineering guidelines

This section gives practical guidelines for prompting LLMs to extract entities and relations, testing the resulting graph, and deciding when to stop refining the prompt.

Key terms: task description, domain-specific guidance, entity and relation classes, normalized outputs, entity RE, input and expected output, key relation types, full, clean entity names, temperature, hallucinations

5.3.4 KG building: Traditional NLP or LLMs?

This section compares traditional NLP and LLMs for building knowledge graphs and explains when each approach may be preferable.

Key terms: traditional NLP, NLP pipeline, data annotation, on-premises, LLMs, transfer learning, prompt engineering, post-processing, fine-tuning, streaming scenarios

5.4 Summary

Where this is used later

Concepts explained in this chapter

← Chapter 4: From simple networks to multisource integration Chapter 6: Building knowledge graphs with large language models →

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.