Thursday, June 29, 2023

Generative AI - Introduction to Large Language Models (LLM)

  Note: The below is from my learning from https://www.cloudskillsboost.google/course_templates/536 (Introduction to Generative AI).

Large Language Models (LLMs) are a subset of Deep Learning.

They can be pre-trained and then fine tuned for specific purposes.

What do we mean by pre-trained and fine tuned?

Assume in our everyday life we train dogs basic commands such as sit/stand/walk etc. This is basic training. But if need to train a dog to be a police dog, we need more fine training apart from the basic ones. This is the difference between pre-trained and fine tuned.

Similar idea applies to LLMs.

LLMs are trained to solve common language problems like document summarization, text classification, text generation etc.

They can then be tailored to solve specific problems in the field of finance, retail etc.

Benefits of using LLMs:

  • Single model can be used for various purposes
  • Fine tuning a LLM requires minimum field data
  • Performance grows continuously as more data and parameters are added.




Note: the above image has been taken from the internet.

If we think of an example of getting answers for questions, the question answering model is able to search for an answer from a large document. Depending on the model used, the answer will either be extracted from a document or a new answer will be generated.

e.g. see the answer from Google's AI chatbot BARD which can be access by going to bard.google.com



In the above example, we gave the prompt (question) to get the desired answer.
Prompts involve instructions and context passed to the language model to achieve the desired result.

There are three main LLMs (and each need prompting in a different way).

  • Generic (or Raw) Language Model
    • Predict the next word
  • Instruction Tuned
    • Predict a response
  • Dialog Tuned
    • Have a dialog by predicting the next response


Tuesday, June 27, 2023

Generative AI (Introduction)

 Note: The below is from my learning from https://www.cloudskillsboost.google/course_templates/536 (Introduction to Generative AI).

What is Generative AI?

Generative AI is a type of artificial Intelligence technology that can produce various types of content like text, images, speech, audio etc.

What is AI?

AI has to do with the theory and methods to build machines that think and act like humans.

Machine learning (ML), which is a subfield of AI, is a program or system that trains a model from input data. Trained model can make useful predictions. ML gives the computers the ability to learn without programming. 

Two of the most common classes of machine learning models are unsupervised and supervised (Labeled data) ML models.

What problem can a supervised ML model solve?

Supervised ML model implies the model has labelled data. If we have historical labelled data of bill amount and how much different people tipped based on order type, the model learns from past examples to predict future values.

If you want to look at tenure and income and then group or cluster employees to see whether someone is on the fast track, would be a case for Unsupervised ML model. Unsupervised problems are all about discovery, about looking at the raw data and seeing if it naturally falls into groups.

What is Deep Learning?

Deep learning is a type of machine learning that uses artificial neural networks, allowing them to process more complex patterns than machine learning. Deep learning models typically have many layers of neurons, which allows them to learn more complex patterns than traditional machine learning models.

Gen AI is a subset of deep learning. Large language models are also a subset of deep learning.

Deep learning models can be divided into two types, generative and discriminative.

A discriminative model is a type of model that is used to classify or predict labels for data points. Discriminative models are typically trained on a data set of labeled data points. Once trained, it can be used to predict the label for new data points.

A generative model generates new data instances based on a learned probability distribution of existing data. Thus generative models generate new content.

A discriminative model, given input dog classifies it as a dog and not a cat.

The generative model learns and predicts the conditional probability that this is a dog and can then generate a picture of a dog.

So generative models can generate new data instances while discriminative models discriminate between different kinds of data instances

In generative AI, we as users can generate our own content, whether it be text, images, audio, video etc, for example models like PaLM or Pathways Language Model (PaLM API lets you test and experiment with Google's large language models and gen AI toolsingest very, very large data from the multiple sources across the internet and build foundation language models we can use simply by asking a question using a prompt.

Given the above, lets now formally define Generative AI.

  • Generative AI is a type of artificial intelligence that creates new content based on what it has learned from existing content.
  • The process of learning from existing content is called training and results in the creation of a statistical model when given a prompt.
  • AI uses the model to predict what an expected response might be and this generates new content.

Generative AI Studio helps developers create and deploy Generative AI models by providing a variety of tools and resources that make it easy to get started.

Generative AI App Builder lets you create gen AI apps without having to write any code. It has a drag and drop interface.











Tuesday, May 30, 2023

Make a talking Avataar in 5 min (using AI)

Yes, you read it right!

Make an AI talking Avataar in 5 min.

How?

Step 1 - Go to https://playgroundai.com/ and make your own avataar. (You need to sign in). Alternatively you can skip this and go to 2 and 3 (in 3 you can choose from existing avataars)

Step 2 - Go to https://beta.elevenlabs.io/ and convert text to Audio

Step 3 - Go to https://studio.d-id.com/ and create your own video

  • Take the Avataar from 1 (or already existing one in this site)
  • Upload the audio from 2
  • Click Generate video.
Example below:




Sunday, February 5, 2023

Kafka - Basics

 Hello All!!!

Starting a new series on learning Kafka (from basics)!!!

What is Kafka?

Apache Kafka allows you to decouple your data streams and your systems. So your source system will feed data into Kafka and target system will take data from Kafka.




Why Apache Kafka?
  • Open Source
  • Resilient Architecture
  • Distributed
  • Fault Tolerant
  • Horizontally scalable
  • High performance with low latency


















Why Apache Kafka?







Saturday, July 30, 2022

Google Cloud - Q&A

 

  1. What is critical outcome of API Management? - Measuring and tracking business performance.
  2. Who provides highest level of security? Titan Security Keys 
  3. 4 key benefits to manage cloud costs? Visibility, Accountability, Control and Intelligent recommendations.
  4. What is Chronicle? Its is a service built on top of Google Cloud Infrastructure, to ingest data (logs etc) and scan for threats.
  5. Types of support? Basic, Standard, Enhanced and Premium. 
  6. What is
    1. DataProc - Hadoop/Spark
    2. DataFlow - Streaming Data
    3. DataPrep - wrangle data based on tabular/interactive or visual structure
    4. DataPlex - Unified Data Management
  7. Three components of Google Clouds defence-in-depth data security design? Sharding, encryption key, key encryption key
  8. What is
    1. Cloud Profiler - Analyze application performance (CPU)
    2. Cloud Debugger - Monitor Performance
    3. Cloud trace - Optimize code
    4. Cloud Monitoring - monitor the performance of the entire cloud infra.
    5. Cloud Vision API - identify images/text etc in a document
  9. What is BYOIP? - Bring your own IP.
  10. Build a new application on cloud while keeping old application On-Premise. What is this pattern called? - Invent in Brownfield. [Greenfield implies something completely new]
  11. Minimize payment for traffic from Google cloud to Internet? use Cloud VPN.
  12. Your org uses Active Directory to authenticate users. Google account access must be removed when their AD account is terminated. ---- Use single sign on in the Google domain
  13. Migrating on Premise to Google Cloud. Functions owned by the cloud provider? - Infra arch and Hardware Maintenance
  14. Which product provides consistent platform for multi-cloud application deployments and extends other Google Cloud services to your environment? - Anthos
  15. Your organization needs to restrict access to a Cloud Storage bucket. Only employees who are based in Canada should be allowed to view the contents.What is the most effective and efficient way to satisfy this requirement? - Configure Armor to allow access to only IP from Canada

  16. Google Cloud managed solutions to automate your build, testing, and deployment process? - Cloud Build

  17. Google Cloud to privately and securely access your large volume of on-premises data, and you also want to minimize latency? - Google Edge network

  18. 2 hour SLA - Enhanced support model

  19. Plug-and-play AI components which can easily build ML services -AI Hub

  20. Recommendations AI delivers highly personalized product recommendations at scale.

  21. Document AI uses AI to unlock insights from documents.

  22. Cloud Talent Solution uses AI with job search and talent acquisition capabilities.

  23. Preview, Early Access, Alpha, and Beta do not have any SLA commitments.

  24. Which of the following NIST Cloud characteristics uses the business model of shared resources in a cloud environment? - Multi-Tenancy

  25. What are the network requirements for Private Google Access?

    1. Because Private Google Access is enabled on a per-subnet basis, you must use a VPC network. Legacy networks are not supported because they don't support subnets.
    2. - Private Google Access does not automatically enable any API. You must separately enable the Google APIs you need to use via the APIs & services page in the Google Cloud Console.
    3. If you use the private.googleapis.com or the restricted.googleapis.com domain names, you'll need to create DNS records to direct traffic to the IP addresses associated with those domains.
    4. Your network must have appropriate routes for the destination IP ranges used by Google APIs and services. These routes must use the default internet gateway next hop. If you use the private.googleapis.com or the restricted.googleapis.com domain names, you only need one route (per domain). Otherwise, you'll need to create multiple routes.
    5. Egress firewalls must permit traffic to the IP address ranges used by Google APIs and services. The implied allow egress firewall rule satisfies this requirement. For other ways to meet the firewall requirement.
  26. manage a bunch of API keys for external services that are accessed by different applications, which are used by a few teams - Store the information in Secret Manager is a secure and convenient storage system for API keys, passwords, certificates, and other sensitive data. Secret Manager provides a central place and single source of truth to manage access, and audit secrets across Google Cloud.
  27. Which Google Cloud product gives you a consistent platform for multi-cloud application deployments and extends other Google Cloud services to your environment? - Anthos
  28. Bigtable is the best suited for time series data. It also has high read-write throughput and ability to scale globally.
  29. VM instances that only have internal IP addresses (no external IP addresses) can use Private Google Access. They can reach the external IP addresses of Google APIs and services. 
  30. Google offers Firebase, In terms of Firebase Console, any particular message that has to be delivered to a customer at a certain degree of change in behavior can be managed through _________________ >> notification composer
  31. Google Clouds WebApp and API Protection (WAAP) protects the application from BOTS.
  32. You are working with a user to set up an application in a new VPC behind a firewall and it is noticed that the user is concerned about data egress. Therefore, to provide assistance you want to configure the fewest open egress ports >>> Setup a low priority rule (65534) that blocks all egress. Create a high priority rule (1000) that allows only specific port.
  33. Container Registry is only multi-regional but Artifact Registry supports multi regional or regional repositories

Thursday, July 28, 2022

Google Cloud - Costs

One of the most important factor to decide on moving to cloud is Cost savings apart from the flexibility provided by Cloud.

How are costs broken down in Google Cloud?

Fixed Price Models and Consumption based Models.

Consumption based Models implies billing for the resources being used/consumed.

e.g. Cloud storage Billed for the amount of storage

Fixed Price Models implies billing fixed irrespective of the usage.

e.g. VM Instance, GKE Cluster (till you delete)

Costs are based on:

  • Data transfer (ingress and egress)
    • Ingress is mostly free
    • Egress to same zone with Google cloud using internal IP is free
    • Egress from one region to another region in Google Cloud is not free
  • Capacity (memory/CPU etc)
  • Invocations 
  • Time (VM running)
  • Region wise price difference




Billing account gives you an overview of the total costs (forecasted as well).





On the left hand side menu, you will see multiple options



Reports will give you reports (as expected) and trends per project or services (timeline as well).
Cost Table More details and can download an invoice for a specific month.



Cost Breakdown gives details of the base usage cost and adjustments, credits and taxes.


Commitment is the summary of the committed use discounts by commitment type.
e.g put a commitment of a VM for 3 months etc.


Budget and alerts helps you to avoid surprises by creating a budget and an alert mechanism when the costs are going over board than the set budget (alert levels 50%, 90% or 100% via email or message).






Tuesday, July 26, 2022

Google Cloud - Miscellaneous - Part 3

Building apps for Android/iOS?

Use FireBase

  • Google Cloud mobile platform
  • Server less
  • Backend DB is Firestore (No SQL DB)
  • Authentication
  • Monitoring
  • Check out firebase.google.com

Container Registry and Artifact Registry

  • To store docker images
  • Container Registry uses Google Cloud Storage buckets to store images
    • Cannot store jar/zip etc. Only container images only similar to Docker Hub
  • Artifact Registry is an evolution of Container Registry
    • Can store jar, zip, container images etc
    • Create repositories for different formats like docker, npm, python etc
    • Does not store in Google Cloud Storage buckets but in repositories
    • Repositories can be multi-region
    • Automatically encrypted
Security related services?
  • KMS
    • Key management service
    • Create and manage cryptographic keys
    • For encrypting and decrypting data
  • Secret Manager
    • To manage DB passwords
    • Manage API Keys
  • Cloud Data Loss Prevention
    • Mask data like credit card numbers, passwords, credentials
    • Provides API
  • Cloud Armor
    • SQL Injection prevention
    • DDos Attack prevention
    • Cross site scripting (XSS) prevention
  • Web Security Scanner
    • Identifies vulnerability by running security tests
  • Binary Authorization
    • Ensures only trusted containers are deployed
  • Container Threat Detection
    • Checks for threats at runtime to containers
  • Cloud DLP
    • Find sensitive data in your cloud storage buckets