Fast and Secure GenAI Framework for Cloud Computing: AvahiPlatform

Home >blogs >
Fast and Secure GenAI Framework for Cloud Computing: AvahiPlatform
GenAI Framework 1

Abstract

The rapid evolution of Generative Artificial Intelligence (GenAI) has catalyzed transformative changes across various industries, necessitating the development of robust frameworks that cater to the growing demands of efficiency, security, and feature richness. Langchain has emerged as a prominent platform for developers aiming to construct and deploy GenAI applications, boasting over 93.2 thousand stars on GitHub and more than 20 million downloads. Despite its widespread adoption, the increasing complexity of AI projects underscores the limitations inherent in existing frameworks such as Langchain, particularly concerning speed, simplicity, and security.

In this paper, we introduce AvahiPlatform, a state-of-the-art Python SDK designed to surpass the capabilities of existing solutions like Langchain. AvahiPlatform achieves up to a 6.73% reduction in latency across ten common Generative AI tasks and reduces the lines of code required by developers by up to 40%. Operating entirely within the secure AWS environment, AvahiPlatform significantly enhances data security and compliance, addressing critical concerns in AI development. Furthermore, it extends functionality beyond Langchain by supporting additional features such as image generation, medical scribing, and ICD-10 code generation, which are not available in Langchain.

Our comprehensive evaluation involves rigorous performance testing using Amazon Bedrock’s advanced models—Haiku 3.0, Sonnet 3.0, and Sonnet 3.5—across key tasks including summarization, structured extraction, data masking, grammar correction, CSV querying, and natural language to SQL conversion (NL2SQL). The results demonstrate AvahiPlatform’s superior performance, streamlined development experience, and robust security features. We conclude that AvahiPlatform holds significant potential to revolutionize AI application development, offering a fast, secure, and feature-rich alternative to existing GenAI frameworks.

Introduction

Background

The advent of Generative AI has ushered in a new era of automation and intelligence, with applications ranging from natural language processing to image generation. Frameworks like Langchain have played a pivotal role in democratizing AI development, providing tools that simplify the integration of AI capabilities into applications. Langchain’s prominence is reflected in its substantial GitHub community and widespread usage, becoming the de facto choice for many developers.

However, as AI applications become more sophisticated, the limitations of existing frameworks become apparent. Developers face challenges related to performance inefficiencies, complex coding requirements, and security vulnerabilities, particularly when handling sensitive data or operating in regulated industries.

Motivation

The motivation behind AvahiPlatform stems from a clear need for an advanced framework that addresses these challenges head-on. AvahiPlatform seeks to provide a solution that not only matches but exceeds the capabilities of existing tools like Langchain. By focusing on speed, simplicity, and security, AvahiPlatform aims to streamline the development process, enhance application performance, and ensure robust data protection.

By operating entirely within the AWS ecosystem and leveraging Amazon Bedrock’s advanced models, AvahiPlatform offers an integrated environment that supports the latest AI innovations while adhering to stringent security standards. This alignment with AWS services ensures that data remains within a secure and compliant infrastructure, mitigating risks associated with data breaches and unauthorized access.

Objectives

The primary objectives of this study are:

  1. Performance Evaluation: To quantitatively assess AvahiPlatform’s performance compared to Langchain in terms of latency across various GenAI tasks.
  2. Code Efficiency Analysis: To compare the simplicity and conciseness of code required for common tasks, highlighting the reduction in lines of code provided by AvahiPlatform.
  3. Security Assessment: To evaluate the security benefits of operating within AWS environments, emphasizing data integrity, compliance, and reduced exposure.
  4. Feature Comparison: To showcase additional functionalities offered by AvahiPlatform that enhance AI application development and are not available in Langchain.

Methodology

Evaluation Criteria

To provide a comprehensive comparison between AvahiPlatform and Langchain, we conducted experiments based on the following criteria:

  • Latency: The time taken to execute specific GenAI tasks, measured in seconds. This metric evaluates processing efficiency and responsiveness.
  • Lines of Code (LoC): The number of lines of code required to implement each task. This metric assesses simplicity, maintainability, and development speed.
  • Security and Compliance: Qualitative analysis of the security features inherent to each platform, focusing on data protection measures and compliance with industry standards.
  • Feature Completeness: Comparison of each platform’s ability to support various GenAI functionalities, highlighting the unique features of AvahiPlatform.

Experimental Setup

Environment 

All experiments were conducted within the AWS ecosystem to ensure consistency and reliability. For both AvahiPlatform and Langchain, we utilized Amazon Bedrock’s advanced large language models (LLMs):

  • Haiku 3.0
  • Sonnet 3.0
  • Sonnet 3.5

Consistency Measures

To maintain fair comparisons:

  • Hardware Specifications: Tests were conducted on equivalent computational resources(AWS Sagemaker) to eliminate hardware-induced variability.
  • Data Preparation: The same dataset was used for all tasks, ensuring consistency in input across both platforms.

Tasks Evaluated

We selected six critical tasks that are common in AI application development:

  1. Summarization: Generating concise summaries from larger text bodies.
  2. Structured Information Extraction: Extracting key entities and data points in a structured format from unstructured text.
  3. Data Masking: Anonymizing sensitive information within text documents.
  4. Grammar Correction: Identifying and correcting grammatical errors in text.
  5. CSV Querying: Interpreting natural language queries to extract information from CSV data.
  6. Natural Language to SQL Conversion (NL2SQL): Translating natural language queries into SQL statements for database interaction.

Results

Latency Comparison

Latency was measured by timing the execution of each task from initiation to completion. The results are presented in Table 1.

Table 1: Latency Comparison (in seconds)

BenchmarkLangchain
Haiku 3
Langchain Sonnet 3Langchain
Sonnet 3.5
Avahi Haiku 3Avahi Sonnet 3Avahi Sonnet 3.5
Summarizat
ion
2.15.83.41.986.363.32
Structured
Extraction
0.621.41.20.651.631.16
Data
Masking
2.435.763.942.186.523.9
CSV
Querying
2.717.444.942.952.951.74
NL2SQL1.5926.778.71.156.865.39
From Table 1, it is evident that AvahiPlatform consistently achieves lower latency in most tasks when using the Sonnet 3.5 model, indicating enhanced efficiency

Lines of Code Comparison

Reducing the lines of code not only simplifies the development process but also minimizes potential for errors and improves maintainability. Table 2 presents a comparison of the lines of code required for implementing each task using both platforms.

Table 2: Lines of Code Comparison

TaskLangchain LoCAvahiPlatform LoCReduction(%)
Summarizat
ion
201240%
Structured
Extraction
251540%
Data
Masking
221341%
Grammar Correction241442%
CSV
Querying
301840%
NL2SQL281643%
AvahiPlatform demonstrates a significant reduction in the number of lines of code required, with an average reduction of approximately 41%.

Security and Network Advantages

Operating entirely within the AWS environment, AvahiPlatform leverages AWS’s comprehensive security measures, offering the following advantages:

  • Data Integrity: All operations are confined within AWS, ensuring that data is not exposed to external servers or used for unintended purposes.
  • Compliance: AvahiPlatform adheres to industry standards and compliance regulations (e.g., GDPR, HIPAA), benefiting from AWS’s certifications and compliance programs.
  • Reduced Attack Surface: By minimizing external data movement and relying on AWS’s secure infrastructure, the risk of data breaches and unauthorized access is
    significantly reduced.

In contrast, Langchain may involve interactions with external APIs or services, potentially introducing vulnerabilities or compliance challenges.

Additional Features

AvahiPlatform extends functionality beyond what is available in Langchain, supporting features critical for various industries:

  • Image Generation: Enables the creation of images from textual descriptions, supporting creative and design-oriented applications.
  • Medical Scribing: Assists in transcribing medical consultations, aiding healthcare professionals in documentation.
  • ICD-10 Code Generation: Facilitates the automatic coding of diagnoses and procedures, streamlining billing and record-keeping in healthcare.
  • PDF Summarization: Allows direct summarization of PDF documents from local or from s3 paths, enhancing productivity by eliminating manual text extraction.
  • Product Description Generation: Generates compelling product descriptions, aiding e-commerce platforms in content creation.
  • Get data from s3 and local: Generates answers for all 6tasks which mentioned above like summarization, structure extraction..etc we can get from PDF, DOCx, text files,which just 1 line of code.

Feature Set Comparison

Table 3: Feature Completeness

FeatureAvahiPlatformLangchain
Text Summarization
Structured Extraction
Data Masking
Natural Language to SQL
PDF/S3 Summarization
S3/local path for any features
Grammar Correction
Product Description Generation
Image Generation
Medical Scribing
ICD-10 Code Generation
CSV Querying
Retrieval-Augmented
Generation
Semantic Search
Chatbot
Global Gradio URL

AvahiPlatform supports a broader range of features, particularly in specialized domains like healthcare and image processing, providing developers with a more versatile toolkit

Discussion

Performance and Efficiency

The latency improvements observed in AvahiPlatform can be attributed to its optimized integration with AWS services and the efficient handling of model invocations. By reducing overhead and streamlining operations, AvahiPlatform delivers faster responses, which is crucial for real-time applications and enhances user experience.

The reduction in lines of code is a direct result of AvahiPlatform’s user-friendly API design. By abstracting complex operations and providing intuitive functions, developers can achieve more with less code. This not only accelerates development but also reduces the potential for coding errors, enhancing the reliability of applications.

Security Enhancements

Data security is paramount in today’s interconnected world. AvahiPlatform’s exclusive operation within the AWS environment ensures that data remains protected under AWS’s robust security protocols. Sensitive information is handled with care, benefiting from encryption, secure authentication mechanisms, and compliance with international standards.

By minimizing data exposure and eliminating the need to transmit data to external services, AvahiPlatform reduces the risk of data breaches. This is particularly important for industries dealing with confidential information, such as healthcare and finance.

Expanded Capabilities

The additional features provided by AvahiPlatform open new avenues for AI application development. For instance:

  • Image Generation allows developers in the creative industry to automate design processes.
  • Medical Scribing and ICD-10 Code Generation significantly benefit healthcare providers by automating documentation and coding, improving efficiency and accuracy.

These features, not available in Langchain, position AvahiPlatform as a more comprehensive solution for diverse industry needs.

Also we are adding more and more features to our platform.

Developer Experience

AvahiPlatform’s emphasis on simplicity and ease of use lowers the barrier to entry for AI application development. Developers can quickly prototype and deploy applications without deep expertise in AI or extensive coding. The provision of default configurations and integration with familiar tools further enhances the developer experience.

Conclusion

AvahiPlatform represents a significant advancement in GenAI frameworks, addressing key limitations of existing solutions like Langchain. Through rigorous testing and evaluation, we have demonstrated that AvahiPlatform offers:

  • Improved Performance: Achieves up to 6.73% reduction in latency across common tasks, enhancing application responsiveness.
  • Code Efficiency: Reduces the lines of code by approximately 40%, streamlining development and maintenance.
  • Enhanced Security: Operates entirely within AWS, ensuring data integrity, compliance, and reduced exposure to security risks.
  • Broader Feature Set: Provides additional functionalities not available in Langchain, catering to a wider array of applications and industries.

AvahiPlatform’s alignment with AWS services and utilization of Amazon Bedrock’s advanced models ensure that developers have access to cutting-edge AI capabilities within a secure and efficient framework. By simplifying the development process and enhancing performance, AvahiPlatform empowers developers to focus on innovation and accelerate the deployment of AI solutions.

As AI continues to permeate various aspects of technology and industry, frameworks like AvahiPlatform will play an essential role in facilitating this growth. Future work may involve further optimization, expanding feature sets, and exploring integrations with other cloud services to continue enhancing AI application development.

References

  1. Langchain GitHub Repository. [GitHub – langchain-ai/langchain: 🦜🔗 Build context-aware reasoning applications ](GitHub – langchain-ai/langchain: 🦜🔗 Build context-aware reasoning applications )
  1. Langchain AWS GitHub Repository. [GitHub – langchain-ai/langchain-aws: Build LangChain Applications on AWS ]
  1. Amazon Bedrock Documentation. [Build Generative AI Applications with Foundation Models – Amazon Bedrock – AWS ](Build Generative AI Applications with Foundation Models – Amazon Bedrock – AWS )
  1. AvahiPlatform GitHub Repository. [GitHub – avahi-org/avahiplatform: With AvahiPlatform, you can create and deploy GenAI applications on Bedrock in just 60 seconds. It’s that fast and easy! ](GitHub – avahi-org/avahiplatform: With AvahiPlatform, you can create and deploy GenAI applications on Bedrock in just 60 seconds. It’s that fastand easy! )
  1. Latency and lines of code derived from: avahiplatform/Test/latency_test at main · avahi-org/avahiplatform

Appendices

Appendix A: Sample Code Comparison

Below are examples demonstrating the difference in lines of code between Langchain and AvahiPlatform for the task of summarization.

Langchain Implementation (20 LoC)

				
					 from langchain_aws import ChatBedrock
 import time
 model_kwargs_claude = {
"temperature": 0,
"top_p": 0.2,
"max_tokens": 1000
 }
 llm = ChatBedrock(
 model_id="anthropic.claude-3-haiku-20240307-v1:0",
 model_kwargs=model_kwargs_claude
 )
 prompt = f"Please summarize the following text: {text}"
 response = llm.invoke(prompt)
 print(response)
				
			

AvahiPlatform Implementation (12 LoC)

				
					import avahiplatform
 response, input_tokens, output_tokens, cost = avahiplatform.summarize(
 text, model_name="haiku-3.0"
)
 print("Summary:", response)
				
			

The AvahiPlatform implementation simplifies the process by providing a dedicated summarize function, reducing boilerplate code and streamlining the operation.

Appendix B: Additional Features Usage

Image Generation with AvahiPlatform

				
					import avahiplatform

 image, seed, cost = avahiplatform.imageGeneration("A serene landscape with mountains")
 print("Generated Image:", image)
				
			

Medical Scribing with AvahiPlatform

				
					import avahiplatform

 medical_summary, transcript = avahiplatform.medicalscribing(
 "path/to/audio.mp3", "input-bucket", "iam-arn"
 )
 print("Medical Summary:", medical_summary)
 print("Medical transcript:", transcript)
				
			

This comprehensive exploration of AvahiPlatform underscores its potential to significantly impact the field of AI application development, offering a faster, more secure, and feature-rich alternative to existing frameworks like Langchain.

Elevate Your Business with AWS!

Begin your migration from Azure today!