Skip to main content
The sift build command consolidates extraction results from multiple documents into a single knowledge graph, handling entity merging, relation normalization, and quality checks.

Quick Start

This builds a graph from all extraction files in output/extractions/ and saves it to output/graph_data.json.

Command Options

path
Path to custom domain YAML (must match extraction domain)
string
default:"schema-free"
Bundled domain name (must match extraction domain)
path
Output directory. Defaults to output/.
float
default:"0.7"
Relations below this confidence are flagged for review
boolean
Skip redundancy removal and relation normalization
boolean
Enable verbose logging

What Graph Building Does

1

Load Extractions

Reads all extraction JSON files from output/extractions/
2

Deduplicate Entities

Merges near-identical entity names within documents (e.g., “Dr. Smith” → “Smith”)
3

Create Graph Structure

  • Adds entity nodes with attributes and confidence scores
  • Creates relation edges between entities
  • Tracks source documents for provenance
4

Postprocessing

Runs unless --no-postprocess is specified:
  • Normalizes relation types to match domain schema
  • Fixes passive voice relations (“is authored by” → “AUTHORED”)
  • Removes redundant edges (duplicate relations)
  • Prunes isolated entities with no connections
5

Quality Review

  • Flags low-confidence relations for manual review
  • Flags domain-specific relations that require verification

Examples

Basic Usage

Skipping Postprocessing

Useful for debugging or when you want full control over graph cleanup.

Graph Structure

The output graph_data.json is a NetworkX MultiDiGraph serialized to JSON:

Entity IDs

Entities get stable IDs based on normalized name + type:
This ensures the same entity mentioned across documents gets a single node.

Provenance Tracking

Every entity and relation tracks:
  • source_documents: Which documents mention this entity
  • support_count: How many times this relation appears
  • support_documents: Which documents support this relation

Postprocessing Details

Relation Normalization

Maps undefined relation types to valid domain types:

Passive Voice Activation

Rewrites passive relations to active voice:

Redundancy Removal

When multiple documents extract the same relation:
  • Keeps highest confidence
  • Merges evidence strings
  • Tracks all supporting documents

Isolated Node Pruning

Removes entities with no relations (often extraction errors):
Document nodes (DOCUMENT type) are never pruned—they’re needed for sift view --source-doc.

Review Files

If relations are flagged, sift build creates relation_review.yaml:
Use sift review to approve or reject these relations.

Schema-Free Mode

When using --domain-name schema-free, the graph builder:
  1. Loads the discovered schema from output/discovered_domain.yaml
  2. Uses discovered types for normalization
  3. Allows any entity/relation types not in the schema

Performance

Graph building is fast (no LLM calls):
  • 100 documents: ~5 seconds
  • 1,000 documents: ~30 seconds
  • 10,000 documents: ~5 minutes
Memory usage scales with graph size (typically 100-500 MB for large graphs).

Output Summary

Troubleshooting

”No extractions found”

Run sift extract first. The extraction directory should contain JSON files:

Domain mismatch errors

If you change domains between extraction and build:

Too many flagged relations

Lower the review threshold:
Or disable review entirely in your domain YAML:

Graph too large to visualize

Use filters when viewing:

Next Steps

Resolve Duplicates

Find and merge duplicate entities across documents

Visualize Graph

Explore your knowledge graph interactively

Export Data

Export to GraphML, CSV, or SQLite for analysis