Dev.to AI πŸ€– Ai πŸ‘ 0 πŸ“– 3 min read

Kolibrie: a neuro-symbolic stream reasoning engine in Rust

I've released Kolibrie v0.2.0, an open-source engine that combines machine learning, explicit logical rules, and knowledge graphs to reason over continuously arriving data. The idea is to let predictions and rules wor

Kolibrie: a neuro-symbolic stream reasoning engine in Rust

I've released Kolibrie v0.2.0, an open-source engine that combines machine learning, explicit logical rules, and knowledge graphs to reason over continuously arriving data.

Kolibrie

The idea is to let predictions and rules work together. A rule can derive information that becomes input to a model, and the model's prediction can become evidence for another rule. Time windows let that reasoning operate over recent events alongside existing knowledge.

For example, a fraud detection system may need the account's profile, the merchant's risk category, and the number of transactions made in the last five minutes to interpret a model's prediction. Kolibrie brings those inputs into a shared graph that models, rules, and queries can use.

Explore Kolibrie on GitHub

"Neuro-symbolic" means combining neural learning and predictions with symbolic reasoning: explicitly defined facts, relationships, and rules. In Kolibrie, these components communicate through an RDF knowledge graph.

If RDF is unfamiliar, it represents information as subject-predicate-object statements. An account has a home country. A transaction belongs to an account. A merchant belongs to a risk category. Those relationships can be queried with SPARQL and used as conditions in rules.

The key design choice is that rule outputs and model predictions both become graph facts. They can feed subsequent computations and remain accessible to queries.

Our fraud detection example shows how this works:

  1. Collect recent events. Transactions enter a five-minute sliding window, evaluated every minute.
  2. Apply domain rules. Combine transactions with account and merchant information to identify signals such as transaction bursts, foreign transactions, and large amounts.
  3. Run the classifier. Feed those signals and transaction features into the model, then write its fraud score back into the graph.
  4. Reason over the prediction. Further rules combine the score with the available evidence to derive a verdict: Fraud, Suspicious, Review, or Clear.

In one case in the demo, the classifier assigns a fraud probability of about 6%, but the rules identify high-risk conditions. The final verdict is Suspicious. The graph contains the symbolic facts behind that decision, allowing someone to inspect which conditions triggered it.

That particular example uses gradient boosting. Kolibrie also supports neural models, and v0.2.0 adds Candle-based CPU training. Neural relation declarations specify which graph patterns provide input features, while training declarations connect those features to labelled graph data.

Training, prediction, and rules can therefore be expressed within one program.

Uncertainty introduces another problem. Suppose two rules support the same conclusion, but both depend on the same observation. Combining their confidence scores as though they were independent can count that observation twice.

Kolibrie's probabilistic inference tracks the logical derivations behind a conclusion. Its Sentential Decision Diagram backend supports weighted model counting over those dependencies. RDF-star annotations expose probabilities and provenance through graph queries, so applications can inspect the supporting evidence as well as the result.

For developers interested in the implementation, the Rust engine uses dictionary-encoded RDF terms, indexed storage, semi-naive rule evaluation, and batch-oriented query execution. Query optimization follows a Volcano-style design.

Other additions in v0.2.0 include:

  • Temporal reasoning with DatalogMTL, for rules involving time intervals.
  • Multiple stream windows joined with static data, including incremental reasoning across windows.
  • Named graphs and RDF-star, alongside expanded SPARQL query support.
  • Six forms of SPARQL Update, including inserts and deletes driven by query results.
  • Improvements to query planning, window expiration, and stream output behavior.

We also have a drone traffic safety example exploring temporal rules over incoming observations.

There is still work to do. SPARQL coverage is incomplete, and efficiently maintaining probabilistic proof structures as stream windows change remains a research question.

The repository includes a Rust API, Python bindings, a local WebUI, and examples. The fraud example requires the optional ml feature, Python, and scikit-learn; it runs separately from the basic WebUI setup.

Our ESWC paper, β€œNeuro-Symbolic Stream Reasoning with Kolibrie,” describes the original architecture and evaluation. The newer training and probabilistic inference work extends that foundation.

I'd like to get more people trying Kolibrie on their own data. Queries that fail, confusing APIs, and workloads where performance falls over would all be useful feedback.

If you're interested in contributing, there’s room to help with query parsing, streaming behavior, tests, benchmarks, or documentation. You don’t need to tackle the reasoning engine itself to make a useful contribution.

Questions are welcome in the comments. You can also join our Discord to discuss use cases or figure out where to start contributing.

Source code Β· v0.2.0 release notes

If you're upgrading from v0.1.1, check the release notes for API and storage changes.

πŸ“° Read the original article on Dev.to AI

Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.