Skip to content

Latest commit

 

History

History
133 lines (102 loc) · 5.07 KB

File metadata and controls

133 lines (102 loc) · 5.07 KB

Neo4j GraphRAG for Hybrid Environments (Azure Cloud + Local/On-Prem)

🎯 Question

Is Neo4j GraphRAG Python package suitable for hybrid deployments that combine:

  • ☁️ Azure Cloud (production workloads)
  • 🏢 Local/On-Premises (development, sensitive data, sovereignty requirements)

📋 Context

Our project (neo4j-agentframework) currently implements a flexible hybrid architecture:

Current Setup

  • Production: Neo4j Aura (Azure westeurope) + Azure AI Foundry + Container Apps
  • Development: Docker Compose (local Neo4j + BitNet LLM + RAG service)
  • Knowledge Base: 12 technical books, 30,006 chunks, 100% embedded

Key Requirements

  1. Same codebase works in both environments (cloud/local)
  2. Data sovereignty for sensitive documents (local processing)
  3. Cost optimization (local development, cloud production)
  4. Zero external dependencies option (fully local stack available)

🤔 Specific Questions

1. Database Flexibility

Can GraphRAG work seamlessly with:

  • ✅ Neo4j Aura (managed cloud) for production
  • ✅ Neo4j Docker (local) for development
  • ✅ Neo4j Enterprise (on-prem) for sensitive data

Use Case: Developer tests locally with Docker, deploys same code to Azure Aura production.

2. LLM Flexibility

Does GraphRAG support multiple LLM backends for hybrid scenarios:

  • ☁️ Azure OpenAI (gpt-4o-mini) for production
  • 🏠 BitNet.cpp (1.58-bit quantized) for local sovereign environments
  • 🤖 Ollama/LM Studio for on-premises deployments

Current Challenge: We use Azure AI Foundry in cloud, BitNet locally. Can GraphRAG adapt?

3. Embedding Model Portability

We currently use SentenceTransformers (all-MiniLM-L6-v2) locally to avoid API costs:

  • 384-dimensional embeddings
  • Runs on CPU (no GPU required)
  • Same model in both environments

Question: Can GraphRAG VectorCypherRetriever work with:

  • Local SentenceTransformers embeddings (development)
  • Azure OpenAI embeddings (production, if needed)
  • Mixed environments (some documents embedded locally, others in cloud)

4. Entity Extraction Cost Control

Our concern about cloud costs:

  • Local entity extraction: Process sensitive PDFs on-premises, push only graph structure to cloud
  • Cloud entity extraction: Use Azure OpenAI for public documents
  • Hybrid approach: Extract entities locally during development, re-use in cloud

Question: Can we run entity extraction locally and sync the resulting knowledge graph to cloud Neo4j?

5. Network & Connectivity

For air-gapped or restricted environments:

  • Can GraphRAG work fully offline (local Neo4j + local LLM)?
  • What are the minimum external dependencies if any?
  • Does it require internet for any core functionality?

Critical for: Government, healthcare, financial services with data residency requirements.

💡 Proposed Hybrid Architecture

# Configuration that adapts to environment
import os
from neo4j_graphrag.llm import AzureOpenAILLM, OpenAILLM
from neo4j_graphrag.retrievers import VectorCypherRetriever

# Environment-aware setup
if os.getenv("DEPLOYMENT_ENV") == "production":
    # Azure Cloud Production
    neo4j_uri = "neo4j+s://6b870b04.databases.neo4j.io"
    llm = AzureOpenAILLM(
        model="gpt-4o-mini",
        azure_endpoint=os.getenv("AZURE_OPENAI_ENDPOINT")
    )
else:
    # Local Development / On-Prem
    neo4j_uri = "bolt://localhost:7687"
    llm = LocalLLM(  # BitNet, Ollama, etc.
        endpoint="http://localhost:8001"
    )

# Same GraphRAG code works everywhere
retriever = VectorCypherRetriever(
    driver=driver,
    index_name="text_embeddings",
    embedder=local_embedder,  # SentenceTransformers
    retrieval_query=custom_query
)

📊 Why This Matters

Cost Savings

  • Development: Free local processing (no API costs during iteration)
  • Production: Pay only for actual production queries
  • Current: $355-755/month vs $1,000-2,500+ traditional cloud-only

Compliance & Sovereignty

  • Healthcare: Process PHI locally, sync anonymized graph to cloud
  • Financial: Keep sensitive data on-premises, use cloud for public knowledge
  • Government: Fully air-gapped option for classified environments

Developer Experience

  • Fast iteration: No cloud delays during development
  • Same code: Works in laptop Docker → Azure Container Apps
  • No surprises: Testing locally = production behavior

🔗 References

🤝 Community Input Welcome

Has anyone successfully deployed GraphRAG in hybrid environments? Looking for:

  • ✅ Proven patterns for local/cloud flexibility
  • ⚠️ Gotchas or limitations we should know
  • 💡 Best practices for multi-environment GraphRAG

Tags: hybrid-cloud, on-premises, azure, data-sovereignty, cost-optimization