Neuro-Symbolic Reasoning
Relevant source files
The following files were used as context for generating this wiki page:The Neuro-Symbolic Reasoning module, located within the monGARS.core.neuro_symbolic package, is a component of the core cognition pipeline. Its primary purpose is to provide structured refinements and hints to a user's query before it is processed by the Large Language Model (LLM). This module is designed to bridge the gap between neural-based processing and symbolic logic to enhance the system's reasoning capabilities.
Currently, the implementation serves as a placeholder for future, more advanced capabilities. It is integrated into the conversational flow, particularly within the CuriosityEngine, where it is intended to refine queries based on contextual analysis.
Sources: README.md, monGARS/core/neuro_symbolic/advanced_reasoner.py:1-4, monGARS/core/cortex/curiosity_engine.py:440-443
Architecture and Integration
The Neuro-Symbolic Reasoning component is architecturally positioned within the core cognition pipeline to intercept and refine user queries. It is invoked by other core services, such as the ConversationalModule and CuriosityEngine, as part of the query augmentation process.
Sources: README.md, scripts/generate_monGARS_llm_dataset.py:483-494
Conversational Pipeline Integration
The AdvancedReasoner is a key step in the conversational pipeline. After a user query is received, and potentially enriched by the CuriosityEngine, the reasoner is called to refine the query before it is sent to the LLMIntegration service.
This diagram illustrates the role of the AdvancedReasoner in the conversational flow.
Multimodal Flow Integration
In multimodal scenarios involving image analysis, the AdvancedReasoner is also part of the orchestration, providing structured refinements after image captioning and curiosity gap detection have occurred.
This sequence diagram shows the interaction in a multimodal context.
Core Components
The neuro-symbolic functionality is primarily encapsulated within the AdvancedReasoner class.
Sources: monGARS/core/neuro_symbolic/advanced_reasoner.py
AdvancedReasoner Class
The AdvancedReasoner class is the central component of this module. It is designed to be a singleton, instantiated and shared across the application.
Key Details:
- File:
monGARS/core/neuro_symbolic/advanced_reasoner.py - Purpose: Provides a placeholder for advanced neuro-symbolic reasoning capabilities. The current implementation is a simple pass-through.
The class structure is defined as follows:
reason() Method
This is the main method of the AdvancedReasoner. It takes a query and a context dictionary and is expected to return a refined query.
| Parameter | Type | Description |
|---|---|---|
query | str | The user query or prompt to be refined. |
context | dict | Additional context for the reasoning process. |
| Returns | str | The refined query. |
Current Implementation:
The method currently returns the original query without any modification, acting as a placeholder.
# monGARS/core/neuro_symbolic/advanced_reasoner.py:12-16
def reason(self, query: str, context: dict) -> str:
"""Refine the query using symbolic reasoning. Placeholder."""
# In a real implementation, this would parse, reason, and reconstruct.
logger.debug("Neuro-symbolic reasoning is a placeholder; returning original query.")
return query
Sources: monGARS/core/neuro_symbolic/advanced_reasoner.py:12-16
Relationship with Curiosity Engine
The CuriosityEngine uses the AdvancedReasoner as part of its process to handle knowledge gaps. When the CuriosityEngine detects insufficient knowledge, it formulates a research query. While the direct call to AdvancedReasoner is not explicitly shown in the detect_gaps method's implementation, architectural documentation indicates that refining the query via the reasoner is an intended step in the process.
For example, the multimodal scenario defined for dataset generation explicitly lists AdvancedReasoner.reason as a step that returns "structured refinements". This highlights its intended role in providing more than just a simple string transformation.
Sources: monGacks/core/cortex/curiosity_engine.py, scripts/generate_monGARS_llm_dataset.py:504-515
Summary
The Neuro-Symbolic Reasoning module is an integral, though currently undeveloped, part of the monGARS cognitive architecture. Its placement in the conversational pipeline indicates a strategic design to incorporate symbolic logic for query refinement, which can lead to more accurate and context-aware interactions with the LLM. The existing AdvancedReasoner class serves as a structural placeholder, ensuring that the surrounding architecture is prepared for its future implementation.
Sources: README.md, monGARS/core/neuro_symbolic/advanced_reasoner.py