Skip to main content

Autograft

The cost-efficient Entity Resolution middleware for GraphRAG.

English | Français | 中文

PyPI

Stop duplicating entities in your Neo4j Knowledge Graph. AutoGraft intercepts entities extracted by LangChain or LlamaIndex, uses a 3-layer hybrid approach (Deterministic -> Vector -> LLM) to merge duplicates, and generates clean Cypher queries.

Installation

pip install autograft

(To use integrations, install with pip install autograft[langchain] or pip install autograft[llamaindex])

Why AutoGraft?

  • LLM-Agnostic: Works with OpenAI, Groq, Ollama, OpenRouter via litellm.
  • Massive Cost Savings: Reduces Entity Resolution token costs by up to 100% by resolving locally.
  • Plug & Play: Drop-in replacement before your Neo4j database.
  • Blazing Fast: C/C++ (RapidFuzz) and NumPy local matching.

Performance Benchmark (200 Documents / 4 Industries)

Evaluated across 200 real-world enterprise documents spanning 4 key scenarios: Legal & Compliance, Tech & Enterprise Software, Insurance & Risk Management, and Finance & Investment Banking (with complex acronyms like GDPR, K8s, AWS, D&O, EBITDA, KYC/AML, SOFR, SCOTUS).

LLM Engine Configured: groq/llama-3.1-8b-instant for extraction & arbitration, and groq/llama-3.3-70b-versatile for precision auditing.

Metric LangChain Naive (No ER) LangChain + Full LLM ER LangChain + AutoGraft Hybrid ER
Processed Documents 200 documents 200 documents 200 documents
Extracted Entities 742 entities 742 entities 742 entities
LLM ER API Calls 0 calls 742 calls 0 calls (100% Local Short-Circuit)
Tokens Consumed 0 tokens 207,760 tokens 0 tokens (100% Token Savings)
Duplicates Created 188 duplicates 0 duplicates 0 duplicates
Duplicates Avoided (MATCH) 0 queries 188 queries 188 queries
New Entities Created (MERGE) 742 queries 554 queries 554 queries
LLM ER Cost $0.00000 $0.04155 $0.00000
Knowledge Graph Quality Polluted with Duplicates Deduplicated (Expensive) Deduplicated & Cost-Free

Figure 1.1: Enterprise RAG Entity Resolution Performance Metrics (200 Docs / 4 Industries)

Figure 1.1

Detailed Metric Breakdown:

  • Top-Left (Total Tokens Consumed): LangChain Naive and AutoGraft consume 0 resolution tokens, while Full LLM ER consumes 207,760 tokens.
  • Top-Right (LLM ER API Calls): LangChain Naive and AutoGraft make 0 API calls, while Full LLM ER makes 742 external API calls.
  • Bottom-Left (Neo4j Duplicates Avoided): LangChain Naive creates 188 duplicates (0 avoided), while Full LLM ER and AutoGraft resolve all 188 duplicates.
  • Bottom-Right (Estimated LLM Cost): Compares the Entity Resolution financial cost. LangChain Naive costs $0 (but fails to deduplicate), Full LLM ER costs $0.04155, and AutoGraft costs $0 (while perfectly deduplicating the graph).

Figure 1.2: Enterprise Knowledge Graph Cost Scaling (Up to 1,000,000 Documents)

For 1,000,000 documents, AutoGraft maintains $0.00 LLM Entity Resolution API costs while guaranteeing a 100% clean, deduplicated Knowledge Graph.

Figure 1.2


Figure 1.3: Entity Resolution Precision by Industry Sector (100.0% Overall)

Figure 1.3

For complete evaluation methodology and dataset documentation, see BENCHMARK.md.


Architecture (3-Layer Short-Circuit)

  1. Layer 1 (Deterministic): Exact string match & alias matching via rapidfuzz (0 tokens, 0.1ms).
  2. Layer 2 (Semantic): Vector cosine similarity via numpy (0 tokens, 0.5ms).
  3. Layer 3 (LLM Arbiter): LiteLLM call ONLY for residual ambiguous cases (e.g., "J. Dupont" vs "Jean Dupont").

Plug & Play Integrations

AutoGraft provides native 1-line integrations for both LangChain and LlamaIndex. By wrapping your Graph store, AutoGraft intercepts entities, deduplicates them locally at 0 cost, and safely forwards them to your database.

🦜🔗 LangChain

from langchain_community.graphs import Neo4jGraph
from autograft.integrations import AutoGraftNeo4jMiddleware

# 1. Connect to your Neo4j Database
graph = Neo4jGraph(url="bolt://localhost:7687", username="neo4j", password="password")

# 2. Wrap it with AutoGraft (1 line of code!)
autograft_graph = AutoGraftNeo4jMiddleware(graph)

# 3. Add your extracted documents. AutoGraft will silently deduplicate everything locally!
autograft_graph.add_graph_documents(extracted_graph_documents)

🦙 LlamaIndex

from llama_index.graph_stores.neo4j import Neo4jPropertyGraphStore
from autograft.integrations import AutoGraftLlamaIndexMiddleware

# 1. Connect to Neo4j Graph Store
store = Neo4jPropertyGraphStore(username="neo4j", password="password", url="bolt://localhost:7687")

# 2. Wrap it with AutoGraft
autograft_store = AutoGraftLlamaIndexMiddleware(store)

# 3. Use in your LlamaIndex pipeline (upsert_nodes will be automatically deduplicated)
# e.g., index = PropertyGraphIndex.from_documents(documents, property_graph_store=autograft_store)

License

MIT

Metadata

Release files for autograft 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for autograft 1.0.0
File Size Uploaded Provenance
autograft-1.0.0.tar.gz 16.7 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for autograft 1.0.0
File Interpreter ABI Platform
autograft-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 31.3 kB

Release files / autograft-1.0.0.tar.gz

Download URL autograft-1.0.0.tar.gz
Size 16.7 kB
Tags Source
SHA-256 checksum
How to use checksums
3f9bc09a7b7fdf9a169099638e56869b6fc8f7da8924251688c896ab6de66dc9
BLAKE2b-256 checksum
How to use checksums
9daf5f2ac161545aec4b678048dcedc33eea97c85017133ff461fa799fc054e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 7, 2026.

Transparency log

Release files / autograft-1.0.0-py3-none-any.whl

Download URL autograft-1.0.0-py3-none-any.whl
Size 14.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1abc266432642b43fb4517d44dba1e1dca113d9c903a2403c7b6ba0e134c3eaf
BLAKE2b-256 checksum
How to use checksums
29ed458b82fb2dd668ed4dc93b1ba6699aad71974fac5c818efd207d4f993a07
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 7, 2026.

Transparency log

Security for autograft 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for autograft-1.0.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 7, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page