Quantcast
Channel: Artificial Intelligence News, Analysis and Resources - The New Stack
Viewing all articles
Browse latest Browse all 321

5 Best Practices for Building Reliable GenAI Apps 

$
0
0
Booking travel

Business leaders are eager to have developers build apps that satisfy customers and accelerate results with generative AI (GenAI) and large language models (LLMs). However, three core problems undermine LLM-only solutions: hallucinations, black-box decision logic and the inability to reliably solve complex reasoning problems.

Organizations that want to adopt GenAI need to incorporate formal logic and constraint optimization capabilities in real time — a key requirement that LLMs lack. Elemental Cognition (EC) is a deep reasoning platform that solves complex problems by combining LLMs with other AI techniques to accelerate and improve critical decision-making in dynamic situations where trust, accuracy and transparency matter.

The company has developed an AI platform that uses Apache Kafka to continuously stream and vet customer data before it’s fed into the EC Reasoning Engine. Elemental Cognition’s platform uses LLMs at build time to help users write their application specification. They are also used at run time to communicate with end users. However, the Reasoning Engine generates the answer, not the LLM.

This is an example of neuro-symbolic AI, where we combine the best of neural systems with the best of formal symbolic systems to deliver reliable AI solutions.

Across EC’s platform, AI-driven solutions are always generated by the EC Reasoning Engine, which generates solutions using transparent, provably correct formal reasoning. The definitions, requirements and constraints of the application are written in natural language, enabling it to be reviewed and vetted by the business process owners who understand it.

With Confluent Cloud as its foundation, the AI platform also has the cloud native architecture it needs to enable real-time decision-making at scale with provenance back-to-source data, ensuring that user inputs are correctly ordered and never lost, no matter the infrastructure failures or code changes that may occur.

Here’s what developers and architects can learn from EC’s experience in taking a hybrid approach to GenAI use cases.

Apps With Real-Time Reasoning Can’t Rely Only on GenAI

In the software-consumed world we live in today, developers are constantly asked to build solutions with AI that quickly make decisions and generate answers to complex questions. Often, these questions boil down to constraint satisfaction problems — scenarios in which viable solutions are constrained to a limited set of combinations that satisfy pre-established rules.

Whether we’re talking about building apps that can generate bookable travel itineraries or optimal supply chain routes, there can easily be thousands, millions or even billions of possible configurations to compare against resource availability and end-user inputs, among other constraints. Not all configurations are valid, and it’s the developer’s responsibility to build apps and services that quickly guide users to the right answers, every time.

The frontend experience might look simple, but the backend processes could involve filtering information through thousands of business rules. The engineering challenge gets exponentially harder when constraints and variable values change in real time.

For example, imagine a financial firm wanting to use AI to build a system for intelligent investing. The AI solution would need to reliably make decisions within a set of dynamic constraints, like an account’s available balance, the investor’s risk tolerance, tax implications, regulatory conditions and the market performance of every investment vehicle of interest.

Solving constraint satisfaction problems with GenAI alone means developers and their end users have to contend with the hallucinations that LLMs often produce. These inaccurate or nonsensical responses make GenAI inherently untrustworthy for mission-critical use cases like logistics, complex research, educational planning or even travel booking.

This problem is only compounded when LLMs are built in a black box, obscuring the underlying machine learning (ML) models and business logic from scrutiny and making remediation virtually impossible. While LLMs have lowered the barrier to entry and made it easier to build conversational applications, they simply aren’t designed to solve complex constraint optimization problems reliably. This is a feature, not a bug.

Getting the Best of Both Worlds With a Hybrid AI Approach

Purely LLM-based solutions are best suited for use cases where an expert is the end user and has the knowledge and time to immediately vet and correct the outputs. When the end user isn’t an expert or doesn’t have access to all the information needed to make correct decisions for complex problems, they need AI solutions with the precise, accurate reasoning that LLMs lack.

For example, in benchmark tests with complex reasoning problems, the accuracy of responses generated by OpenAI’s GPT-4 dropped from 32% to 14% as the complexity increased. In comparison, the platform we’ve built at EC has maintained 100% accuracy, even for responses to problems requiring optional plan construction and plan validation — scenarios where the underlying AI has to assess the validity of its own outputs.

These results indicate why businesses need to take a hybrid approach when leveraging GenAI for critical business use cases like multi-continent travel booking, degree planning in higher education and logistics and fulfillment optimization for supply chain companies.

Using Kafka To Accelerate AI Decision-Making at Scale

A large part of delivering reliable reasoning depends on deploying a distributed, fault-tolerant AI platform in the cloud that is capable of integrating new data in real time.

Our platform relies on stream-based data ingestion via Kafka to gather information from clients’ data sources. For this information to be accessed by the EC Reasoning Engine and LLMs, source data needs to be processed, synchronized and indexed without any errors or interruptions in service.

Hundreds of millions of messages pass through up to 12 processing stages on the Elemental Cognition platform every day. Using a streaming architecture with a cloud native Kafka engine at its core ensures all of that data makes it through every stage.

Kafka’s ordering guarantees, durability and fault tolerance allow EC to build transactional workflows within the EC Reasoning Engine that accurately process user input based on predefined business rules because they have the confidence that:

  • The platform has the right context based on the order in which user requests were made.
  • Requests won’t be lost or dropped, even in the event of scaling issues, code changes or unexpected blackouts.
  • Outputs will maintain accuracy for increasingly complex requests, with provenance that can be traced back to source data.

EC uses Confluent Cloud to incrementally add data, rather than spending more to reprocess everything. This also means the platform can easily incorporate data from user inputs and new or updated business rules via our Cogent application.

In the future, EC plans to use Confluent to develop data pipelines to generate data to train ML models. Kafka will be the backbone for generating data and can be used to fine-tune existing ML models and add new supplemental models for more narrow use cases or build entirely new models from scratch. EC customers have certain use cases for which they need to protect proprietary data; EC will be able to build models on top of Confluent Cloud without the customer having to expose that data during the training process.

Best Practices for Building Trustworthy GenAI Apps

How can businesses and their developers take advantage of GenAI’s strengths without subjecting their users and critical business decisions to its weaknesses?

For use cases that require complex reasoning, we’d recommend adhering to these best practices:

  1. Never put the source of truth inside of an LLM: Across our platform, the source of truth comes from the EC Reasoning Engine, which uses data that has been peer-reviewed or vetted by the business process owners who understand it so the business has some confidence in its correctness. Then, the Reasoning Engine generates a solution and uses an LLM to support an interactive planning conversation with the end user based on facts.
  2. Use a reasoning engine capable of solving constraint satisfaction and optimization problems: This engine should be able to understand and apply the business rules defined by the customer to solve complex logistics, scheduling or planning problems that can’t be solved with automation or other technologies alone.
  3. Use GenAI to facilitate natural conversations with end users: Formalize their inputs to interact with the reasoning engine and communicate the outputs back to them in natural language to facilitate seamless interactions. Tightly integrating the EC Reasoning Engine with fine-tuned LLMs to communicate with end users is key.
  4. Capture expert knowledge using GenAI: Automatically record existing business rules, update them regularly and gather feedback on reasoning engine outputs.
  5. Stream data between your LLMs and reasoning engine with a cloud native architecture: Your AI solution’s value is only as good as its data. Use a fault-tolerant, scalable streaming engine like Kafka to stream data between your LLMs and reasoning engine while other parts of the platform manage all computations and transactions. At the core of the EC platform, the reasoning engine runs in the cloud and is connected to critical data in real time so end users can configure plans based on the most up-to-date information.

With this approach, LLMs serve as the natural language interface between the systems, algorithms and computational devices needed to solve complex reasoning problems and automate them. End users get personalized assistance facilitated via a user-friendly interaction with the solution, while businesses have the reliable, transparent reasoning they need to make faster, more intelligent decisions with AI.

The post 5 Best Practices for Building Reliable GenAI Apps  appeared first on The New Stack.

How Apache Kafka serves as the backbone for trustworthy GenAI solutions at Elemental Cognition.

Viewing all articles
Browse latest Browse all 321

Trending Articles