Skip to content

Conversation

Copy link

Copilot AI commented Feb 8, 2026

For changes to the core ggml library (including to the CMake build system), please open a PR in https://github.com/ggml-org/llama.cpp. Doing so will make your PR more visible, better tested and more likely to be reviewed.

Description

Implements OpenCog cognitive architecture using GGML tensor operations for semantic reasoning and attention allocation.

Core Features:

  • Tensor embeddings: Vector representations for atoms with compositional semantics (links blend target embeddings)
  • PLN reasoning: Deduction, induction, abduction, revision, modus ponens with probabilistic truth values
  • ECAN attention: STI/LTI/VLTI allocation with automatic attention spreading through graph
  • Pattern matching: Cosine similarity-based matching on embeddings with sorted results
  • Compute similarity: Fast embedding comparisons for semantic reasoning

Example usage:

auto* atomspace = ggml_opencog_atomspace_new(128);

// Create atoms with embeddings
uint64_t dog_id = ggml_opencog_add_atom(atomspace, GGML_OPENCOG_CONCEPT_NODE, 
                                        "Dog", {0.9f, 0.8f}, {});
uint64_t mammal_id = ggml_opencog_add_atom(atomspace, GGML_OPENCOG_CONCEPT_NODE,
                                           "Mammal", {0.9f, 0.8f}, {});

// Create link (automatically blends embeddings)
ggml_opencog_add_atom(atomspace, GGML_OPENCOG_INHERITANCE_LINK,
                     "Dog->Mammal", {0.95f, 0.9f}, {dog_id, mammal_id});

// Compute semantic similarity
float sim = ggml_opencog_compute_similarity(atomspace, dog_id, mammal_id);

// Allocate attention
ggml_opencog_update_attention(atomspace, dog_id, 15.0f, 2.0f);

Implementation details:

  • Embeddings stored as std::vector<float> to avoid per-atom tensor context overhead
  • Type embeddings shared across atoms, combined with hash-based perturbation
  • PLN formulas follow standard confidence propagation rules
  • Attention spreads to connected atoms at 10% factor with [-100, 100] STI clamping

Testing:

  • 9 unit tests covering all features (embeddings, similarity, attention, PLN operations)
  • 3 example programs: basic, reasoning, advanced features
  • Comprehensive README documentation

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 4 commits February 8, 2026 15:17
…ECAN

Co-authored-by: drzo <15202748+drzo@users.noreply.github.com>
Co-authored-by: drzo <15202748+drzo@users.noreply.github.com>
Co-authored-by: drzo <15202748+drzo@users.noreply.github.com>
Co-authored-by: drzo <15202748+drzo@users.noreply.github.com>
Copilot AI changed the title [WIP] Continue implementation of OpenCog cognitive architecture Implement OpenCog cognitive architecture with tensor-based embeddings and PLN reasoning Feb 8, 2026
Copilot AI requested a review from drzo February 8, 2026 15:27
@drzo drzo marked this pull request as ready for review February 8, 2026 18:06
@drzo drzo merged commit 6be1a3d into master Feb 8, 2026
11 of 23 checks passed
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.

2 participants