Skip to content

[GraphRAG][v2] Implementation of Agentic Retrieval and Performance enhancement of KG construction & Semantic Beam Search#350

Open
ParameswaranSajeenthiran wants to merge 312 commits into
miyurud:masterfrom
abineyan:master
Open

[GraphRAG][v2] Implementation of Agentic Retrieval and Performance enhancement of KG construction & Semantic Beam Search#350
ParameswaranSajeenthiran wants to merge 312 commits into
miyurud:masterfrom
abineyan:master

Conversation

@ParameswaranSajeenthiran
Copy link
Copy Markdown
Collaborator

@ParameswaranSajeenthiran ParameswaranSajeenthiran commented Jan 20, 2026

Summary

This PR introduces the new Agentic Retrieval and improvements in Knowledge Graph (KG) construction and semantic search, focusing on performance, scalability, and reliability.


1. Agentic Retrieval

  • Introduced session-based agent orchestration initiated from the frontend to manage agentic retrieval workflows per user query
  • Implemented agent-driven query understanding, enabling interpretation of user intent and constraints from raw query text
  • Added semantic beam search plan generation, allowing the agent to construct and rank multi-step retrieval plans
  • Enabled iterative execution of beam search plans, where intermediate results inform subsequent retrieval decisions
  • Integrated agent-controlled response generation, synthesizing grounded responses from semantic beam search outputs

2. Knowledge Graph (KG) Construction

  • Implemented KG construction from PDF with support in both UI and server
  • Parallelized graph file persistence and embedding generation to reduce ingestion latency
  • Migrated online edge embedding (API during query) to offline embedding generation and indexing
  • Implemented tuple validation with retry mechanism for invalid tuples to improve data reliability
  • General code-level optimizations for ingestion and persistence
  • Added and extended integration tests for KG construction and persistence pipeline

2. Semantic Beam Search & Graph / Query Optimizations

  • Introduced Semantic Beam Search for improved multi-hop reasoning and retrieval quality
  • Added Fennel-based graph partitioning for better scalability
  • Migrated lightweight queries from processes to threads to enable shared access to large-scale indexes
  • General code-level optimizations for query execution
  • Integration tests added for search correctness and query performance

Impact

  • Faster and more reliable KG ingestion
  • Reduced dependency on runtime embedding APIs
  • Scalable query execution and search
  • Higher-quality semantic search results

Notes for Reviewers

  • Parallelism changes affect persistence and embedding pipelines — concurrency handling should be reviewed
  • Offline edge embedding migration introduces new indexing logic

Comment thread src/util/Utils.cpp Outdated
if (token[i] == ':')
++colonCount;
}
util_logger.info("ColonCount: " + std::to_string(colonCount));
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
util_logger.info("ColonCount: " + std::to_string(colonCount));
util_logger.debug("ColonCount: " + std::to_string(colonCount));

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be a debug message?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 2aba70d

Comment thread src/util/Utils.cpp Outdated
// Make sure this colon is AFTER the scheme (not the one in https://)
if (lastColon != std::string::npos && lastColon > token.find("://") + 2) {
token = token.substr(0, lastColon);
util_logger.info("HTTPS rule applied, stripped to: " + token);
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
util_logger.info("HTTPS rule applied, stripped to: " + token);
util_logger.debug("HTTPS rule applied, stripped to: " + token);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 2aba70d

Comment thread src/util/Utils.cpp Outdated
if (lastColon != std::string::npos) {
token = token.substr(0, lastColon);
}
util_logger.info("ColonCount 3");
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
util_logger.info("ColonCount 3");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 2aba70d

Comment on lines +82 to +88
// if (index->ntotal % 1000 == 0) {
// lock.unlock();
// faiss_index_logger.info("saving faiss index periodically");
// save(filePath);
// faiss_index_logger.info("saved faiss index periodically");
//
// }
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// if (index->ntotal % 1000 == 0) {
// lock.unlock();
// faiss_index_logger.info("saving faiss index periodically");
// save(filePath);
// faiss_index_logger.info("saved faiss index periodically");
//
// }

Comment on lines +92 to +93
// faiss_index_logger.error(std::string("Failed to reconstruct embedding for ID ") + nodeId + ": " +
// e.what());
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// faiss_index_logger.error(std::string("Failed to reconstruct embedding for ID ") + nodeId + ": " +
// e.what());

Comment on lines +189 to +203
// int nlist = 100000; // number of clusters (IVF)
// int m = 64; // PQ number of sub-vectors
// int nbits = 8; // 8-bit quantization
//
// faiss::IndexFlatL2 quantizer(dim);
//
// faiss::IndexIVFPQ* index = new faiss::IndexIVFPQ(
// &quantizer,
// dim,
// nlist, // IVF clusters
// m, // number of PQ subvectors
// nbits // bits per subvector
// );
// index->use_precomputed_table = 1;
// index->train(num_train_vectors, train_data);
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// int nlist = 100000; // number of clusters (IVF)
// int m = 64; // PQ number of sub-vectors
// int nbits = 8; // 8-bit quantization
//
// faiss::IndexFlatL2 quantizer(dim);
//
// faiss::IndexIVFPQ* index = new faiss::IndexIVFPQ(
// &quantizer,
// dim,
// nlist, // IVF clusters
// m, // number of PQ subvectors
// nbits // bits per subvector
// );
// index->use_precomputed_table = 1;
// index->train(num_train_vectors, train_data);

static FaissIndex* getInstance(int embeddingDim, const std::string& filepath);

~FaissIndex();
// ~FaissIndex();
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// ~FaissIndex();

@@ -1,2 +1,2 @@
hdfs.host=192.168.1.19
hdfs.host=10.8.100.22
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you change the IP address to this new value?

RESULT = subprocess.check_output(["hostname", "-I"]).decode().strip()
SERVER_IP = RESULT.split()[0]
HOST = "127.0.0.1"
HOST = "10.8.100.248"
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why we change the IP address here?

@@ -0,0 +1,19 @@
"""Copyright 2024 JasmineGraph Team
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"""Copyright 2024 JasmineGraph Team
"""Copyright 2026 JasmineGraph Team

@@ -0,0 +1,204 @@
"""Copyright 2025 JasmineGraph Team
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"""Copyright 2025 JasmineGraph Team
"""Copyright 2026 JasmineGraph Team

def test(host, port):
"""Test the JasmineGraph server by sending a series of commands and checking the responses."""

# subprocess.run(['bash', OLLAMA_SETUP_SCRIPT], check=True)
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# subprocess.run(['bash', OLLAMA_SETUP_SCRIPT], check=True)

Copy link
Copy Markdown
Owner

@miyurud miyurud left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have put some comments on the PR. Please fix all of them and explain how you address those by replying on each comment.

@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
9 Security Hotspots
18.6% Duplication on New Code (required ≤ 3%)
D Security Rating on New Code (required ≥ A)
E Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

ParameswaranSajeenthiran and others added 8 commits May 16, 2026 22:42
# Conflicts:
#	src/frontend/JasmineGraphFrontEnd.cpp
#	src/frontend/JasmineGraphFrontEnd.h
#	src/frontend/core/executor/impl/SemanticBeamSearchExecutor.cpp
#	src/knowledgegraph/construction/Pipeline.cpp
#	src/query/processor/nlp/semanticbeamsearch/SemanticBeamSearch.cpp
#	src/server/JasmineGraphInstanceProtocol.cpp
#	src/server/JasmineGraphInstanceProtocol.h
#	src/server/JasmineGraphInstanceService.cpp
#	src/util/Utils.cpp
#	src/util/Utils.h
#	src/vectorstore/FaissIndex.cpp
#	test-docker.sh
#	test-k8s.sh
@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
9 Security Hotspots
20.1% Duplication on New Code (required ≤ 3%)
D Security Rating on New Code (required ≥ A)
E Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants