Data Science Talent Logo
Call Now

Enhanced Large Language Models as Reasoning Engines By Anthony Alcaraz

 width=Anthony Alcaraz is Chief AI Officer at Fribl, a company dedicated to automating HR processes. He’s also a consultant for startups, where his expertise in decision science is applied to foster innovation and strategic development. Anthony is a leading voice in the construction of retrieval-augmented generation (RAG) and reasoning engines. He’s an avid writer, sharing daily insights on AI applications with his 30,000+ followers on Medium.
In this post, Anthony explores the current limitations of large language models. There’s still a real risk that LLMs will make basic logical and mathematical errors, because their knowledge is intrinsically statistical and lacking semantic structure. The solution to bridging this reasoning gap, Anthony argues, could lie in knowledge graphs:

The recent exponential advances in natural language processing capabilities from large language models (LLMs) have stirred tremendous excitement about their potential to achieve human-level intelligence. Their ability to produce remarkably coherent text and engage in dialogue after exposure to vast datasets seems to point towards flexible, general-purpose reasoning skills.

However, a growing chorus of voices urges caution against unchecked optimism by highlighting fundamental blindspots that limit neural approaches. LLMs still frequently make basic logical and mathematical mistakes that reveal a lack of systematicity behind their responses. Their knowledge remains intrinsically statistical without deeper semantic structures.

More complex reasoning tasks further expose these limitations. LLMs struggle with causal, counterfactual, and compositional reasoning challenges that require going beyond surface pattern recognition. Unlike humans who learn abstract schemas to flexibly recombine modular concepts, neural networks memorise correlations between co-occurring terms. This results in brittle generalisation outside narrow training distributions.

The chasm underscores how human cognition employs structured symbolic representations to enable systematic composability and causal models for conceptualising dynamics. We reason by manipulating modular symbolic concepts based on valid inference rules, chaining logical dependencies, leveraging mental simulations, and postulating mechanisms relating to variables. The inherently statistical nature of neural networks precludes developing such structured reasoning.

It remains mysterious how symbolic-like phenomena emerge in LLMs despite their subsymbolic substrate. But clearer acknowledgement of this ‘hybridity gap’ is imperative. True progress requires embracing complementary strengths – the flexibility of neural approaches with structured knowledge representations and causal reasoning techniques – to create integrated reasoning systems.

We first outline the growing chorus of analyses exposing neural networks’ lack of systematicity, causal comprehension, and compositional generalisation –underscoring differences from innate human faculties.

Next, we detail salient facets of the ‘reasoning gap’, including struggles with modular skill orchestration, unravelling dynamics, and counterfactual simulation. We consider the innate human capacities contemporary ML lacks, explaining the resulting brittleness.

Seeking remedies, we discuss knowledge graphs as scaffolds for explicit conceptual relationships missing from statistical learning. We highlight approaches for structured knowledge injection – querying interfaces and vectorised graph embeddings – to contextualise neural generation.

We present techniques like dimensional typing in embeddings and parallel knowledge retrieval to improve inductive biases for logical deduction and efficient inference. Finally, we make the case for patiently cultivating high-quality knowledge graphs as strategic assets for enterprises pursuing substantive AI progress.

Knowledge graphs offer a promising method for overcoming the ‘reasoning gap’ plaguing modern LLMs. By explicitly modelling concepts as nodes and relationships as edges, knowledge graphs provide structured symbolic representations that can augment the flexible statistical knowledge within LLMs.

Establishing explanatory connections between concepts empowers more systematic, interpretable reasoning across distant domains. LLMs struggle to link disparate concepts purely through learned data patterns. But knowledge graphs can effectively relate concepts not directly co-occurring in text corpora by providing relevant intermediate nodes and relationships. This scaffolding bridges gaps in statistical knowledge, enabling logical chaining.

Such knowledge graphs also increase transparency and trust in LLM-based inference. Requiring models to display full reasoning chains over explicit graph relations mitigates risks from unprincipled statistical hallucinations. Exposing the graph paths makes statistical outputs grounded in validated connections.

Constructing clean interfaces between innately statistical LLMs and structured causal representations shows promise for overcoming today’s brittleness. Combining neural knowledge breadth with external knowledge depth can nurture the development of AI systems that learn and reason both flexibly and systematically.

KNOWLEDGE GRAPH QUERYING AND GRAPH ALGORITHMS

Knowledge graph querying and graph algorithms are powerful tools for extracting and analysing complex relationships from large datasets. Here’s how they work and what they can achieve:

Knowledge Graph Querying:

Knowledge graphs organise information as entities (like books, people, or concepts) and relationships (like authorship, kinship, or thematic connection). Querying languages like SPARQL and Cypher enable the formulation of queries to extract specific information from these graphs. For instance, the query mentioned in your example finds books related to ‘Artificial Intelligence’ by matching book nodes connected to relevant topic nodes.

Graph Algorithms:

Beyond querying, graph algorithms can analyse these structures in more profound ways. Some typical graph algorithms include:

  • Pathfinding Algorithms (e.g., Dijkstra’s, A*): Find the shortest path between two nodes, useful in route planning and network analysis.
  • Community Detection Algorithms (e.g., Louvain method): Identify clusters or communities within graphs, helping in social network analysis and market segmentation.
  • Centrality Measures (e.g., PageRank, betweenness centrality): Determine the importance of different nodes in a network, applicable in analysing influence in social networks or key infrastructure in transportation networks.
  • Recommendation Systems: By analysing useritem graphs, these systems can make personalised recommendations based on past interactions.

LLMs can generate queries for knowledge graphs based on natural language input. While they excel in understanding and generating human-like text, their statistical nature means they’re less adept at structured logical reasoning. Therefore, pairing them with knowledge graphs and structured querying interfaces can leverage the strengths of both: the LLM for understanding and contextualising user input and the knowledge graph for precise, logical data retrieval.

Incorporating graph algorithms into the mix can further enhance this synergy. For instance, an LLM could suggest a community detection algorithm on a social network graph to identify influential figures within a specific interest group. However, the challenge lies in integrating these disparate systems in a way that is both efficient and interpretable.

KNOWLEDGE GRAPH EMBEDDINGS

Knowledge graph embeddings encode entities and relations as dense vector representations. These vectors can be dynamically integrated within LLMs using fused models.

For example, a cross-attention mechanism can contextualise language model token embeddings by matching them against retrieved graph embeddings. This injects relevant external knowledge.

Mathematically fusing these complementary vectors grounds the model, while allowing gradient flows across both components. The LLM inherits relational patterns, improving reasoning.

 

So both querying and embeddings provide mechanisms for connecting structured knowledge graphs with the statistical capacities of LLMs. This facilitates interpretable, contextual responses informed by curated facts.

The path towards safe, performant, and explainable AI undoubtedly lies in architecting hybrid systems with distinct reasoning modules suited to their strengths while mitigating individual weaknesses through symbiotic integration. Knowledge graphs offer the structural scaffolding to elevate LLMs from pattern recognisers to context-aware, disciplined reasoners.

Knowledge graph embeddings can be further enhanced by incorporating additional constraints and structure beyond just encoding factual entities and relationships. This provides useful inductive biases to orient semantic similarity and reasoning in more reliable ways.

Some examples include:

Dimensional typing

Assigning dedicated dimensions in the embedding space to model specific hierarchical knowledge categories (like types, attributes, temporal bins etc.) allows interpreting vector arithmetic and symmetry operations.

Logical rules as vector equations

Modelling logical rules like transitivity as vector equations over relation embeddings bakes in compliance with first-order logic when querying the vector space.

Entity Linking Regularisation

Adding a linkage loss that pulls together vector representations for the same real-world entities improves generalisation across surface forms.

Temporal Ordering

Encoding time series knowledge by chronologically positioning entity embeddings assists in analogical reasoning over time.

Overall, embellishing knowledge graph embeddings with structured inductive biases – whether through typed dimensions, vector logic, or temporal ordering – makes the vector arithmetic better comport with real-world constraints. This strengthens their ability to tackle complex reasoning tasks, providing useful scaffolds that can likewise elevate the performance of integrated language models.

The core benefit is infusing domain knowledge to orient the latent geometry in precise ways, amplifying the reasoning capacity of connectionist models interacting with the vector space. Guiding the primitives the neural engine operates upon through structured initialisation fosters more systematic compositional computation accessible through queries.

Complementary Approaches:

First retrieving relevant knowledge graph embeddings for a query before querying the full knowledge graph. This twostep approach allows efficient focus of graphical operations:

Step 1: Vector Embedding Retrieval

Given a natural language query, relevant knowledge graph embeddings can be quickly retrieved using approximate nearest neighbour search over indexed vectors.

For example, using a query like: ‘Which books discuss artificial intelligence’, vector search would identify embeddings of the Book, Topic, and AI Concept entities.

This focuses the search without needing to scan the entire graph, improving latency. The embeddings supply useful query expansion signals for the next step.

Step 2: Graph Query/Algorithm Execution

The selected entity embeddings suggest useful entry points and relationships for structured graphical queries and algorithms.

In our example, the matches for Book, Topic, and AI Concept cues exploration of BOOK-TOPIC and TOPICCONCEPT connections.

Executing a query like:

This traverses books linked to AI topics to produce relevant results.

Overall, the high-level flow is:

1. Use vector search to identify useful symbolic handles

2. Execute graph algorithms seeded by these handles

This tight coupling connects the strength of similarity search with multi-hop reasoning.

The key benefit is focusing complex graph algorithms using fast initial embedding matches. This improves latency and relevance by avoiding exhaustive graph scans for each query. The combination enables scalable, efficient semantic search and reasoning over vast knowledge.

PARALLEL QUERYING OF MULTIPLE GRAPHS OR THE SAME GRAPH

The key idea behind using multiple knowledge graphs in parallel is to provide the language model with a broader scope of structured knowledge to draw from during the reasoning process. Let me expand on the rationale:

  1. Knowledge Breadth: No single knowledge graph can encapsulate all of humanity’s accrued knowledge across every domain. By querying multiple knowledge graphs in parallel, we maximise the factual information available for the language model to leverage.
  2. Reasoning Diversity: Different knowledge graphs may model domains using different ontologies, rules, constraints etc. This diversity of knowledge representation exposes the language model to a wider array of reasoning patterns to learn.
  3. Efficiency: Querying knowledge graphs in parallel allows retrieving relevant information simultaneously. This improves latency compared to sequential queries. Parallel search allows more rapid gathering of contextual details to analyse.
  4. Robustness: Having multiple knowledge sources provides redundancy in cases where a particular graph is unavailable or lacks information on a specific reasoning chain.
  5. Transfer Learning: Being exposed to a multitude of reasoning approaches provides more transferable learning examples for the language model. This enhances few-shot adaptation abilities.

So in summary, orchestrating a chorus of knowledge graphs provides breadth and diversity of grounded knowledge to overcome limitations of individual knowledge bases. Parallel retrieval improves efficiency and robustness. Transfer learning across diverse reasoning patterns also accelerates language model adaption. This combination aims to scale structured knowledge injection towards more humanlike versatile understanding.

LARGE LANGUAGE

MODELS AS A FLUID SEMANTIC GLUE BETWEEN STRUCTURED MODULES

While vector search and knowledge graphs provide structured symbolic representations, LLMs like GPT-3 offer unstructured yet adaptive semantic knowledge. LLMs have demonstrated remarkable few-shot learning abilities, quickly adapting to new domains with only a handful of examples.

This makes LLMs well-suited to act as a fluid semantic glue between structured modules – ingesting the symbolic knowledge, interpreting instructions, handling edge cases through generalisation, and producing contextual outputs. They leverage their vast parametric knowledge to rapidly integrate with external programs and data representations.

We can thus conceive of LLMs as a dynamic, everoptimising semantic layer. They ingest forms of structured knowledge and adapt on the fly based on new inputs and querying contexts. Rather than replacing symbolic approaches, LLMs amplify them through rapid binding and contextual response generation. This fluid integration saves the effort of manually handling all symbol grounding and edge cases explicitly.

Leveraging the innate capacities of LLMs for semantic generalisation allows structured programs to focus on providing logical constraints and clean interfaces. The LLM then handles inconsistencies and gaps through adaptive few-shot learning. This symbiotic approach underscores architecting AI systems with distinct reasoning faculties suited for their inherent strengths.

STRUCTURED KNOWLEDGE AS AI’S BEDROCK

The exponential hype around artificial intelligence risks organisations pursuing short-sighted scripts promising quick returns. But meaningful progress requires patient cultivation of high-quality knowledge foundations. This manifests in structured knowledge graphs methodically encoding human expertise as networked representations over time.

Curating clean abstractions of complex domains as interconnected entities, constraints and rules is no trivial investment. It demands deliberate ontology engineering, disciplined data governance and iterative enhancement. The incremental nature can frustrate business leaders accustomed to rapid software cycles.

However, structured knowledge is AI’s missing pillar – curbing unbridled statistical models through grounding signals. Knowledge graphs provide the scaffolding for injectable domain knowledge, while enabling transparent querying and analysis. Their composable nature also allows interoperating with diverse systems.

All this makes a compelling case for enterprise knowledge graphs as strategic assets. Much like databases evolved from flexible spreadsheets, the constraints of structure ultimately multiply capability. The entities and relationships within enterprise knowledge graphs become reliable touchpoints for driving everything from conversational assistants to analytics.

In the rush to the AI frontier, it is tempting to let unconstrained models loose on processes. But as with every past wave of automation, thoughtfully encoding human knowledge to elevate machine potential remains imperative. Managed well, maintaining this structured advantage compounds over time across applications, cementing market leadership. Knowledge powers better decisions – making enterprise knowledge graphs indispensable AI foundations.

Back to blogs
Share this:
© Data Science Talent Ltd, 2024. All Rights Reserved.