awslabs/unified-kg-rag-on-aws
Tentang
AWS-native knowledge graph RAG framework. Runs GraphRAG, LightRAG, HippoRAG 2 and RAPTOR on one shared index, each selectable at index and query time, with hybrid BM25 + vector + graph retrieval and source provenance. Amazon Bedrock, Neptune and OpenSearch, or fully local. Incremental indexing, multilingual, bring-your-own KG, built-in evaluation.
Data dan analisisPertumbuhan bintang terukur
- dalam 24 jam
- 0
- dalam 7 hari
- +2
- dalam 15 hari
- +4
- dalam 1 bulan
- +5
Perubahan bersih pada periode yang tumpang tindih, bukan total harian. Pengukuran yang belum tersedia dibiarkan kosong. Bintang menunjukkan perhatian, bukan kualitas.
README.md
AsliUnified Knowledge Graph RAG on AWS
🇰🇷 한국어 README · 🤝 Contributing

Unified Knowledge Graph RAG on AWS turns a large, multilingual document collection into a knowledge graph on Amazon Neptune and Amazon OpenSearch Service and answers questions over it with Amazon Bedrock, with [n] citations that name the documents and pages behind an answer (global and drift answer without them by default). It runs four published methods on one index, Microsoft GraphRAG, LightRAG, HippoRAG 2 and, opt-in, RAPTOR, chosen per question, and builds only the ones you use; Why this framework lists what it adds beyond the papers. You can try it locally without an AWS account (Quickstart): about five minutes on a GPU or Apple silicon, after a download of about 6 GB of models (on a CPU-only machine, expect the ingestion to take about half an hour).
For teams who want graph RAG (retrieval-augmented generation over a knowledge graph) in their own AWS account and need to pick a method, measure it and keep the index current as documents change.
![Console demo: a question answered with the auto strategy cites its source as an [n] marker, shown as a chip with the PDF file and its page; opening a source shows its provenance trail to the passages that state it; the trail leads into a force-directed graph with the traced entity ringed and its neighbours labelled; then a strategy comparison with paired intervals, and the dashboard of time, tokens and cost per strategy.](https://raw.githubusercontent.com/awslabs/unified-kg-rag-on-aws/main/assets/console-demo.gif)
Why this framework
- Four methods on one index. GraphRAG (community summaries), LightRAG (dual-level keywords), HippoRAG 2 (Personalized PageRank over entities and passages) and RAPTOR (a summary tree, opt-in) share ingestion, indexing, caching and search; only the retrieval algorithm differs.
indexing.methodologiesbuilds only what the selected ones read (Methodology profiles), and answers cite their evidence with[n]markers that name the documents and PDF pages behind each number, every strategy's butglobal's anddrift's by default (Citations). - Hybrid search. BM25, vector search and Neptune graph traversal, fused with Reciprocal Rank Fusion and reranked with a Bedrock rerank model.
simpleandnaiveread no graph, andglobalmaps community reports instead (Retrieval). - Incremental indexing. With the document-status registry on, only new and changed documents are re-indexed and merged into the live graph, and deleting a document removes only what no other document states (Incremental indexing).
- Bring your own knowledge graph. Seed graphs (JSONL, CSV or RDF instance data) merge a graph you already have into the extracted one as virtual documents: the documents stay canonical, and the seed adds descriptions, properties, IRIs and edges (Seed graphs).
- Multilingual. Optional translation at indexing and query time, per-language analyzers (
norifor Korean) and multilingual keyword extraction (Multilingual corpora). - Use it from agents and a browser. A read-only MCP server (
run-mcp-server, themcpextra) serves an index to agents as search, answer and graph tools, and a local web console (run-console, theconsoleextra) asks with citations, ingests, evaluates and explores the graph (MCP server, Console). - Measured, not assumed.
run-evalscores answers with LLM-free metrics by default (answer match, retrieval hit rate, graph coverage) and opt-in LLM judges (RAGAS, assertions), compares strategies with paired intervals and meters each query's cost; the defaults it set are on Defaults and evidence (Evaluation).
How this compares with the papers and with Amazon Bedrock Knowledge Bases GraphRAG: Overview.
Quickstart (no AWS)
This runs everything on one machine: embedded SQLite stores and Ollama models. You need Python 3.11.5–3.13 and Ollama.
1. Install from PyPI into a virtual environment (the local extra adds the Ollama and OpenAI-compatible clients, no PyTorch; the cross-encoder reranker is the cross-encoder extra: Getting started locally):
python3.12 -m venv .venv && source .venv/bin/activate
pip install 'unified-kg-rag-on-aws[local]'
With uv, create the project on Python 3.12 (uv init --python 3.12; uv add does not check a package's upper Python bound), run uv add 'unified-kg-rag-on-aws[local]' and prefix the commands below with uv run. To run from a clone instead, which the console demo and its web-client build below, the CDK stack and contributing need: git clone https://github.com/awslabs/unified-kg-rag-on-aws.git, then uv sync --no-dev --extra local in it, and prefix the commands with uv run --no-dev (--no-dev leaves out the contributors' test and lint tools).
2. Pull the two default models (about 6 GB):
ollama pull qwen2.5:7b-instruct
ollama pull bge-m3
3. Write a two-file sample corpus (the names, companies and figures are made up):
mkdir -p sample-corpus
cat > sample-corpus/acme.txt <<'EOF'
Acme Robotics is a manufacturer of warehouse robots based in Springfield.
Alice Chen is the chief engineer at Acme Robotics and leads its motion-control team.
In 2024 Acme Robotics signed a supply agreement with Globex Sensors.
EOF
cat > sample-corpus/globex.txt <<'EOF'
Globex Sensors makes lidar sensors for mobile robots.
Bob Martin runs the sensor division of Globex Sensors.
Under its agreement with Acme Robotics, Globex Sensors supplies the lidar units
for the Acme warehouse robots.
EOF
4. Build the knowledge graph (on a slow CPU-only machine a model call can pass the local preset's 300 s limit and fail instead of finishing late: raise UKR__PROVIDERS__LLM__TIMEOUT_SECONDS, or lower UKR__PROCESSING__MAX_CONCURRENCY to the requests Ollama serves at once, Local mode):
UKR__LOGGING__LEVEL=WARNING run-ingestion --backend local --source-directory ./sample-corpus
5. Ask a question (the answer cites its sources as [n], and --verbose lists every source with its score; without the cross-encoder extra the query runs with reranking off, logged once):
UKR__LOGGING__LEVEL=WARNING run-rag --backend local --search-strategy mix --verbose \
--query "How are Acme Robotics and Globex Sensors related?"
Getting started locally continues from here: a GraphRAG query, and an evaluation of two strategies without an LLM judge.
Choose how to run
| Path | Graph and vector stores | Models | Start here |
|---|---|---|---|
| Local mode (development, no AWS) | Embedded SQLite graph and vector stores and registry, no server; or Gremlin Server and OpenSearch in containers (docker/compose.local.yaml) |
Ollama (or any OpenAI-compatible server), or Amazon Bedrock | Getting started locally |
| Existing AWS resources | Your Neptune cluster and OpenSearch domain (plus DynamoDB for incremental indexing, and an S3 bucket only to sync the stage cache) | Amazon Bedrock | Getting started on AWS: install, credentials, required models and a first run |
| Bundled CDK stack | Created by iac/, with a Fargate data plane and a Step Functions ingestion pipeline |
Amazon Bedrock | Deploy on AWS, then iac/README.md After deploy |
Local mode is for development and evaluation only: the embedded stores serve one host and about 100,000 documents per index, the containers have no authentication or TLS, and small local models extract weaker graphs.
Architecture

Ingestion is a resumable 13-stage pipeline: parse, chunk, extract entities and relationships, merge duplicate entities, detect communities with LLM-written reports, index, and for raptor build a summary tree. It writes to Neptune and OpenSearch on AWS, or to embedded SQLite or containers in local mode. Every strategy then runs in one chain over the same indexes and token budget; pick one with --search-strategy (CLI) or RAGInput.search_strategy (Python):
| Method | Strategies | Strong at |
|---|---|---|
| GraphRAG (community summaries) | local, global, drift, simple |
Thematic questions across the corpus (global, drift; global maps at most 99 community reports a query by default, evidence) and questions about specific entities (local) |
| LightRAG (dual-level keywords) | mix, hybrid, naive |
Keyword-driven lookups, and a fast chunk-only baseline (naive) |
| HippoRAG 2 (Personalized PageRank) | ppr |
Multi-hop questions at the lowest cost: one LLM call a query |
| RAPTOR (summary tree, opt-in) | tree |
A cheap index without graph extraction; on multi-hop questions it answered better than naive, below the graph strategies (evidence) |
structured (opt-in, not one of the papers' methods) answers counts, rankings, lists and paths from a checked, read-only graph query on any namespace that holds the graph, and falls back to local without one (Structured queries). iterative wraps mix or local with bounded follow-up rounds on the bridge entities of a multi-hop question. auto, the default, lets an LLM router pick one of search.auto_routable_strategies per query (default local, mix, global, iterative). Retrieval explains when to use which strategy, and the Design Doc the layers, algorithms and data model.
To do all of this in a browser on your machine, start the local console (run-console). Build its web client once with Node.js 20.19 or later ((cd console/web && npm ci && npm run build)), then uv run --no-dev --extra console --extra local python console/demo/demo.py --models fake tries it on a synthetic corpus. Both run in a clone; with the package from PyPI (pip install 'unified-kg-rag-on-aws[console]'), build the client in a clone and point UKR_CONSOLE_WEB_DIRECTORY at its console/web/dist.
Deploy on AWS (optional)
The iac/ AWS CDK app provisions the whole stack: a VPC with endpoints, Neptune, OpenSearch, the DynamoDB document-status table, an S3 cache bucket, an ECS Fargate data plane, a Step Functions ingestion pipeline, CloudWatch dashboards and alarms, and an optional Bedrock Guardrail. iac/README.md has the cdk synth, cdk bootstrap and cdk deploy --all commands and every -c key=value option; the stores are reachable only from inside the VPC, so the deployed Fargate tasks run the CLIs (After deploy).
Cost and teardown.
- Model calls grow with the corpus. Building an index of 3,318 short paragraphs (about 280,000 words) with the default models took 16,069 Bedrock calls, $371.64 at November 2026 list prices, and a query cost from $0.016 (
ppr) to about $0.06 (mix,global) (how it was measured; cost levers).- The stores bill hourly. Neptune and OpenSearch bill by the hour, and
publicnetwork mode adds NAT gateways.- Teardown. The default
devenvironment tears down withcdk destroy --all; non-dev environments default to retaining stateful stores with deletion protection on. Review the hardening options (use_cmk,deletion_protection, Multi-AZ sizing,vpc_flow_logs) iniac/README.mdbefore production use.
Documentation
Start at the documentation hub (한국어): reading paths by role, a page map and an "I want to" index.
| You are | Start with |
|---|---|
| First-time evaluator (no AWS) | Getting started locally, then the Overview |
| Builder on AWS | Getting started on AWS, then Configuration, Ingestion and Querying, or iac/README.md for the CDK stack |
| Operator | The Operator Runbook and iac/README.md |
| Evaluator or researcher | Evaluation, Defaults and evidence and Beyond the papers |
| Extender | The Design Doc and its Extension Guide |
| Contributor | CONTRIBUTING.md |
Every flag is in the CLI Reference, every configuration key in the Configuration Reference, and the supported models in the Model Catalog. Release notes: CHANGELOG.md. The AWS Open Source Blog post introduced the first release, GraphRAG and LightRAG on one stack.
Security & Disclaimer
This project is a reference framework provided for educational and illustrative purposes. It is offered "AS IS" without warranty of any kind (see LICENSE). It should not be deployed to a production environment without your own additional security testing, threat modeling, and hardening.
- Run it in your own AWS account against your own resources; you are responsible for IAM policies, network configuration, data classification, and end-user authentication in your deployment.
- The optional CDK stack (
iac/) provides secure defaults (private-VPC isolation, encryption at rest with AWS-managed keys or an optional customer-managed KMS key viause_cmk, enforced TLS, least-privilege IAM, an optional Bedrock Guardrail for PII and prompt-attack filtering), but you own the deployment and should review it for your environment. - Enable the Bedrock Guardrail (
aws.bedrock.guardrail) and apply rate limiting and monitoring appropriate to your use case before production use. - To report a security issue, see SECURITY.md; please do not open a public issue.
Contributing
Contributions are welcome. See CONTRIBUTING.md for development setup, tests and the pull-request workflow, and Design Doc §15 for extension recipes; most extensions are a registry registration and need no dispatch-code edits.
License
This project is licensed under the Apache-2.0 License. See the LICENSE file for details. Maintained by AWS under the awslabs organization.
Acknowledgments
Thanks to Jihyeon Kang for significant contributions to the library's feature development and validation, and to Yusuke Tanimiya for a thorough review and real-corpus testing — both of which strengthened the framework ahead of release.
References
- Microsoft GraphRAG: From Local to Global: A Graph RAG Approach to Query-Focused Summarization · library
- LightRAG: Simple and Fast Retrieval-Augmented Generation · library
- HippoRAG 2: From RAG to Memory: Non-Parametric Continual Learning for Large Language Models · library
- RAPTOR: Recursive Abstractive Processing for Tree-Organized Retrieval · code
Further reading on GraphRAG (DRIFT search, dynamic community selection, auto-tuning, LazyGraphRAG) is listed in the Design Doc.
Jelajahi proyek terkait
Memuat…