GithubHelp home page GithubHelp logo

nucleoidai / nucleoid Goto Github PK

View Code? Open in Web Editor NEW
486.0 10.0 11.0 5.82 MB

Reasoning Engine for Neuro-Symbolic AI

Home Page: https://nucleoid.ai

License: Apache License 2.0

JavaScript 100.00%
node javascript neuro-symbolic-ai neuro-symbolic reasoning semantic-reasoning symbolic symbolic-ai reasoning-engine semantic-reasoner

nucleoid's Introduction

Nucleoid

Declarative (Logic) Runtime Environment

License NPM Discord

Banner

Reasoning Engine for Neuro-Symbolic AI with Declarative Logic


D(L)RE is a type of Symbolic AI used for reasoning engine in Neuro-Symbolic AI. The runtime that tracks given statements in JavaScript syntax and creates relationships between variables, objects, and functions etc. in the graph. So, as writing just like any other codes in Node.js, the runtime translates your business logic to fully working application by managing the JS state as well as storing in the built-in data store, so that your application doesn't require external database or anything else.

Graph Animation

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 Diagram

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.

Hello World โšก

> npm i nucleoidjs

Once installed, you can simply run with Express.js

const nucleoid = require("nucleoidjs");
const app = nucleoid();

class Item {
  constructor(name, barcode) {
    this.name = name;
    this.barcode = barcode;
  }
}
nucleoid.register(Item);

// ๐Ÿ‘ Only needed a business logic and ๐Ÿ’–
// "Create an item with given name and barcode,
// but the barcode must be unique"
app.post("/items", (req) => {
  const name = req.body.name;
  const barcode = req.body.barcode;

  const check = Item.find((i) => i.barcode === barcode);

  if (check) {
    throw "DUPLICATE_BARCODE";
  }

  return new Item(name, barcode);
});

app.listen(3000);

๐Ÿ’ก This is pretty much it, thanks to Nucleoid runtime, only with this ๐Ÿ‘†, you run your business logic and successfully persisted your object without external database.

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


Under the hood: Declarative 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.


OpenAPI Integration with Nucleoid IDE

Nucleoid IDE is a web interface that helps to run very same npm package with OpenAPI.

Go to Nucleoid IDE

Nucleoid IDE Screenshot 1 Nucleoid IDE Screenshot 2


Benchmark

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

https://nucleoid.com/ide/sample

Benchmark

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

https://github.com/NucleoidJS/benchmark

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.


Project Status ๐Ÿฅ‘

Track at Trello

  • Beta is out
  • ES6 support
  • ES2018 support
  • ES2020 support
  • TypeScript
  • IDE (WiP)
  • Production-ready

Please report an issue or ask a question at Discussions

Learn more at nucleoid.com



โญ๏ธ Star us on GitHub for the support

Thanks to declarative programming, we have a brand-new approach to data and logic. As we are still discovering what we can do with this powerful programming model, please join us with any types of contribution!

Nobel


Contributors

User NucBot
NucBot
User canmingir
canmingir
User 322332
322332
User dependabot[bot]
dependabot[bot]
User francisco-giancarelli-crombie
francisco-giancarelli-crombie
User Gulshanaggarwal
Gulshanaggarwal
User CanPacis
CanPacis
User durulkoca
durulkoca
User halilcengel
halilcengel
User EnesKeremAYDIN
EnesKeremAYDIN
User russle-smith
russle-smith
User russellgray
russellgray

Generated by NucBot

nucleoid's People

Contributors

322332 avatar canmingir avatar dependabot[bot] avatar halilcengel avatar nucbot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nucleoid's Issues

Less code snippets in Readme file

What's the issue?
I just installed the package mentioned in docs & pasted the code inside my editor. When I start server, It gives me error because the code I pasted in my editor doesn't include package import, class registration which confuses me. I could find those things at https://nucleoid.com/docs/learn. So the main idea to add more code snippet in Readme file so that users like me don't face these problems.

How to reach ?

Typescript Support

At the moment typescript linting tools does not like working with nucleoid. The way I understand this is that when I register a class I get static helper methods on the class in runtime but these do not exist in the code itself, nor their type declarations.

class User {
  constructor(public name: string) {
    this.name = name;
  }
}
nucleoid.register(User);

app.get("/user", () => User.filter(() => /* */));

So something like this will throw an error like Property 'filter' does not exist on type 'typeof User'.

Are you planning to add typescript support?

GrammarError in Home page

What is the issue?
There is a grammar error in text on the home page.

How to reach to the issue?

  1. Goto - https://nucleoid.com/
  2. Scroll down till the How it works
  3. See at 3rd statement text.

For clear view see the image below -

Annotation 2022-08-04 234002

ES6 Modules

CommonJS causes circular dependency issue and we manually have to manage dependencies like here. ES6 modules seems more sophisticated for managing imports.

Navigation problem

What is the issue?
Navigation on the Learn page of NucleoidJS doesn't work properly.

How to reproduce?

  • Goto the Learn page
  • Click on Express.js in the right-side navigation bar it doesn't scroll down to that section. Navigation doesn't work properly for all learning sections.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.