AI Application Architectures

Jun 24, 2024

AI Application Architectures Lecture Summary

Introduction

  • Rapid advancements in AI are influencing software engineering and development.
  • Companies are integrating AI into their products.
  • Understanding AI application architecture is crucial.

Components of AI Applications

  • Similar to normal applications: consist of frontend and backend layers.
  • Additional component for AI applications: Model Management and Deployment.

General Architecture

  • Frontend layer (Client-side): Mobile app, web app, smartwatch app, etc.
  • Backend layer (Server-side): Processes requests from frontend, communicates with databases, AI models, smart contracts (in case of blockchain), etc.
  • AI Model: Can be integrated within the frontend or the backend.

Key Architectures for AI Applications

Architecture 1: AI Model Embedded in Frontend

  • AI model embedded directly within the frontend code.
  • Use Case Scenarios: Low latency required, smaller model complexity and size, immediate and sensitive data processing.

Architecture 2: AI Model Connected to Server

  • AI model operates as a standalone service and communicates with the app server via APIs.
  • Use Case Scenarios: Higher model complexity, larger model size, ongoing model management and updates, lower latency tolerance.

Considerations for Choosing an Architecture

1. Latency:

  • Low latency needs -> Architecture 1.
  • High latency tolerance -> Architecture 2.

2. Complexity:

  • Simple models -> Architecture 1.
  • Complex models requiring more computing power -> Architecture 2.

3. Model Size:

  • Small models -> Architecture 1.
  • Large models (GB range) -> Architecture 2.

4. Sensitivity of Data:

  • Sensitive data that must remain on the device -> Architecture 1.
  • Data secured through server-side processing -> Architecture 2.

5. Model Management:

  • Frequent updates and changes -> Architecture 2.
  • Static models with infrequent updates -> Architecture 1.

Tools and Frameworks for Building AI Applications

Frontend Development

  • Mobile apps: Flutter, React Native, Xamarin, Cordova, Swift.
  • Web apps: React, Angular.

AI Model Development

  • Libraries: PyTorch, TensorFlow, Scikit-learn, Pandas, NumPy, Hugging Face Transformers.

Embedding AI Models in Frontend

  • TensorFlow Lite: Reduces model size for mobile/web apps.
  • Creates lighter versions of AI models for embedding in frontend applications.

Tools and Frameworks for Backend and Server

Backend Development

  • Node.js, Spring Boot, Rust, Go, Python (Django, Flask, FastAPI).

AI Model Deployment

  • Cloud Services: Azure ML, Google Cloud Platform (GCP), AWS SageMaker.
  • Models built with traditional libraries and deployed on cloud platforms.

Client-Server Interaction

  • Client sends request -> Server processes -> Server interacts with AI model -> AI model returns results to server -> Server returns processed data to client.
  • seamless interaction and robust architecture result from understanding and leveraging these components efficiently.

Conclusion

  • Understand the pros and cons of each architecture for practical implementation.
  • Encourage building projects for a deeper understanding and hands-on experience.
  • Additional Resources: Resume Pal app for interview preparation and resume building.

Note: Regular updates and advancements in technology necessitate continuous learning and adaptation.