DEV Community

Cover image for Nucleoid: Neuro-Symbolic AI with Knowledge Graph
Can Mingir for Nucleoid

Posted on • Originally published at github.com

Nucleoid: Neuro-Symbolic AI with Knowledge Graph

Nucleoid is a declarative, logic-based, contextual runtime for Neuro-Symbolic AI. Nucleoid runtime tracks given each statement in JavaScript syntax and dynamically creates relationships between logic and data in a Logic Graph as a knowledge base to used in decision-making and problem-solving process.

  • Adaptive Reasoning: Combines symbolic logic with contextual information to analyze relationships, draw conclusions and incorporating new information and adjusting its conclusions accordingly.
  • Logic Graph: A dynamic knowledge base representation structure that captures relationships between statements and data, facilitating complex deductions and adapting to new information.
  • Explainability: The Logic Graph provides a transparent representation of the reasoning process, making it easier to understand how decisions are reached and potential biases are identified.

Echoing to the idea of "thinking, fast and slow", AI system should provide fast, “intuitive” ideas, and the other, more deliberate, rational decision-making. D(L)RE enables both intuitive decisions based on contextual information and deliberate, well-reasoned decisions based on logical deductions.

Nucleoid Chat

Chat for Logical Context
https://nucleoid.ai/chat

In Nucleoid's paradigm, there is no segregation between logic and data; instead, the paradigm approaches how both logic and data statements are related to each other. As the runtime receives new statements, it updates the knowledge graph and reevaluates both logic and data statements to reflect the new information. This adaptive process enables the system to respond to new situations and make deterministic selections as a result of plasticity.

What is Neuro-Symbolic AI?

Neuro-Symbolic AI Architecture

Neuro-Symbolic AI is an approach that integrates the strengths of both neural networks and symbolic AI to create systems that can learn from data and also reason logically. By combining these two components, Neuro-Symbolic AI aims to leverage the intuitive, pattern-recognition capabilities of neural networks along with the logical, rule-based reasoning of symbolic AI. This integration offers a more holistic AI system that is both adaptable and able to explain its decisions, making it suitable for complex decision-making tasks where both learning from data and logical reasoning are required. Here’s how it breaks down:

Neural Networks: The Learning Component

Neural networks in Neuro-Symbolic AI are adept at learning patterns, relationships, and features from large datasets. These networks excel in tasks that involve classification, prediction, and pattern recognition, making them invaluable for processing unstructured data, such as images, text, and audio. Neural networks, through their learning capabilities, can generalize from examples to understand complex data structures and nuances in the data.

Symbolic AI: The Reasoning Component

The symbolic component of Neuro-Symbolic AI focuses on logic, rules, and symbolic representations of knowledge. Unlike neural networks that learn from data, symbolic AI uses predefined rules and knowledge bases to perform reasoning, make inferences, and understand relationships between entities. This aspect of AI is transparent, interpretable, and capable of explaining its decisions and reasoning processes in a way that humans can understand.

Neuro-Symbolic Learning and Reasoning

Declarative Logic in Symbolic Reasoning

Declarative logic is a subset of declarative programming, a style of building programs that expresses the logic of a computation without describing its control flow. In declarative logic, you state the facts and rules that define the problem domain. The runtime environment or the system itself figures out how to satisfy those conditions or how to apply those rules to reach a conclusion. This contrasts with imperative programming, where the developer writes code that describes the exact steps to achieve a goal.

Symbolic reasoning refers to the process of using symbols to represent problems and applying logical rules to manipulate these symbols and derive conclusions or solutions. In AI and computer science, it involves using symbolic representations for entities and actions, enabling the system to perform logical inferences, decision making, and problem-solving based on the rules and knowledge encoded in the symbols.

By integrating Nucleoid into Neuro-Symbolic AI, the system benefits from enhanced interpretability and reliability. The declarative logic and rules defined in Nucleoid provide clear explanations for the AI's decisions, making it easier for users to understand and trust the system's outputs. Furthermore, the explicit reasoning capabilities help ensure that decisions are made based on logical principles, adding a layer of reliability and consistency to the AI's behavior.

Logic Diagram Animation

Plasticity in Neuro-Symbolic AI

In the realm of Neuro-Symbolic AI, Plasticity is an important element for the system's ability to modify and optimize its connections in response to new information. This concept is inspired by neuroplasticity in biological brains, where neurons can strengthen or weaken their connections based on activity, enabling learning and memory.

  1. Dynamic Knowledge Base: Neuro-Symbolic AI systems dynamically update their knowledge base as they encounter new scenarios or corrections to their previous knowledge. This continuous updating process allows the systems to remain relevant and accurate over time.
  2. Adaptive Logic and Reasoning: The AI system can modify its symbolic rules and reasoning strategies to better match observed data or outcomes, enhancing its decision-making and problem-solving abilities.
  3. Generalization and Specialization: Through plasticity, the system can generalize from learned experiences to new, unseen scenarios or specialize in certain domains by fine-tuning its parameters or rules based on specific data inputs.

The idea of plasticity in AI, especially in logic-based systems like those in Neuro-Symbolic AI, enhances the capability of machines to not only perform tasks based on fixed rules but also to evolve those rules and adapt their reasoning over time, much like the cognitive flexibility of living things.

Hello World ⚡

User:
> 'Define human with name'

Assistant:
> 'The user requested to define a human with a name using a declarative class'

---

// Ubiquitous Code:
'use declarative';

class Human {
  name: string;
  constructor(name: string) {
    this.name = name;
  }
}
Enter fullscreen mode Exit fullscreen mode
User:
> 'All humans are mortal'

Assistant: All humans are mortal
> 'All humans were declared as mortal.'

---

// Ubiquitous Code:
'use declarative';

$Human.mortal = true;
Enter fullscreen mode Exit fullscreen mode
User:
> 'Create a human with name "Socrates"'

Assistant:
> 'A human named 'Socrates' was successfully created.'

---

// Ubiquitous Code:
'use imperative';

var human1 = new Human('Socrates');

// Result: {"id":"human1","name":"Socrates","mortal":true}
Enter fullscreen mode Exit fullscreen mode
User:
> 'Is human with name 'Socrates' mortal?'

Assistant:
> 'The human named 'Socrates' was determined to be mortal.'

---

// Ubiquitous Code:
`use imperative`;

var human1 = new Human('Socrates');
human1.mortal;
// Result: true
Enter fullscreen mode Exit fullscreen mode

Learn more at nucleoid.com/docs/get-started

💡 Nucleoid runtime can also run on local machine with npx @nucleoidai/ide start and npx @nucleoidai/expert start including Nucleoid Chat. These commands enable IDE and expert system components needed for Neuro-Symbolic AI.


Under the hood: Declarative (Logic) Runtime Environment

Nucleoid is an implementation of symbolic AI for declarative (logic) programming at the runtime. As mentioned, the declarative runtime environment manages JavaScript state and stores each transaction in the built-in data store by declaratively rerendering JavaScript statements and building the knowledge graph (base) as well as an execution plan.

Nucleoid's Taxonomy

The declarative runtime isolates a behavior definition of a program from its technical instructions and executes declarative statements, which represent logical intention without carrying any technical detail. In this paradigm, there is no segregation regarding what data is or not, instead approaches how data (declarative statement) is related with others so that any type of data including business rules can be added without requiring any additional actions such as compiling, configuring, restarting as a result of plasticity. This approach also opens possibilities of storing data in the same box with the programming runtime.

Logical Diagram 1 Logical Diagram 2

In short, the main objective of the project is to manage both of data and logic under the same runtime. The declarative programming paradigm used by Nucleoid allows developers to focus on the business logic of the application, while the runtime manages the technical details.This allows for faster development and reduces the amount of code that needs to be written. Additionally, the sharding feature can help to distribute the load across multiple instances, which can further improve the performance of the system.

Benchmark

This is the comparation our sample order app in Nucleoid IDE against MySQL and Postgres with using Express.js and Sequelize libraries.

Benchmark

Performance benchmark happened in t2.micro of AWS EC2 instance and both databases had dedicated servers with no indexes and default configurations.

This does not necessary mean Nucleoid runtime is faster than MySQL or Postgres, instead databases require constant maintenance by DBA teams with indexing, caching, purging etc. however, Nucleoid tries to solve this problem with managing logic and data internally. As seen in the chart, for applications with average complexity, Nucleoid's performance is close to linear because of on-chain data store, in-memory computing model as well as limiting the IO process.

In conclusion, Nucleoid is a promising step forward in Neuro-Symbolic AI, merging neural networks with symbolic AI for more transparent and reliable systems. Its Logic Graph and adaptive reasoning enable informed decisions, while plasticity ensures continuous learning. Join the Nucleoid community and be part of shaping the future of AI.


⭐️ Star us on GitHub for the support

Neuro-Symbolic AI is an emerging field and thanks to declarative logic programming, we have a brand-new approach to Neuro-Symbolic AI. Join us in shaping the future of AI!

Nobel

Join us at
https://github.com/NucleoidAI/Nucleoid

GitHub logo NucleoidAI / Nucleoid

Neuro-Symbolic AI with Knowledge Graph • "True Reasoning" through data and logic 🌿🌱🐋🌍

Nucleoid

Neuro-Symbolic AI with Knowledge Graph

License NPM Discord

Banner

Declarative (Logic) Runtime Environment: Extensible Data and Logic Representation

Nucleoid is a declarative, logic-based, contextual runtime for Neuro-Symbolic AI. Nucleoid runtime tracks each statement in IPL-inspired declarative JavaScript syntax and dynamically creates relationships between both logic and data statements in the knowledge graph to used in decision-making and problem-solving process.

  • Adaptive Reasoning: Combines symbolic logic with contextual information to analyze relationships, draw conclusions and incorporating new information and adjusting its conclusions accordingly.
  • Logic Graph: Specialized knowledge graph that captures relationships between both logic and data statements based on formal logic, facilitating complex deductions and adapting to new information.
  • Explainability: The Logic Graph provides a transparent representation of the reasoning process, making it easier to understand how decisions are reached and potential biases are identified.

Echoing to the idea of "thinking, fast and slow", AI system should provide fast, “intuitive” ideas, and the other…




Top comments (3)

Collapse
 
cxm87re profile image
cxm87re

Is this project lang based or graph based? The reason I am asking looks like you are using graph structure but also mentioned declarative language, kinda confusing

Collapse
 
canmingir profile image
Can Mingir

Good question, so briefly lang based symbolic solutions often use tree structure because they are more like rule engine follows RETE like algorithms, but we wanted to enhance symbolic representation with flexible and extensible (Better representation, more sophisticated reasoning), and declarative programing was a great candidate. So, in this context, graphs are much more powerful than tree structures, and declarative programming makes it possible to use graphs. In summary, the runtime convert statements to representational nodes, and that is a reason, this is node based in "Logic Graph" solution rather than the statement based.

Collapse
 
cxm87re profile image
cxm87re

Interesting 🙌