Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Deep Dive into Google AI Studio (By: Mashhood R...

Deep Dive into Google AI Studio (By: Mashhood Rastgar) - DevFest Lahore 2023

Workshop by Mashhood Rastgar (https://www.linkedin.com/in/mashhoodr/) at DevFest Lahore 2023 by GDG Lahore.

GDG Lahore

December 23, 2023
Tweet

More Decks by GDG Lahore

Other Decks in Programming

Transcript

  1. Hello! I am Mashhood. I am currently Head of Engineering

    at Taleemabad where we are infusing AI with education, And community leader as a Google Developer Expert, I also run a micro-podcast, karachiwala.dev
  2. What are tokens? Tokens can be thought of as pieces

    of words. 1 token ~= 4 chars in English 1 token ~= ¾ words 100 tokens ~= 75 words Or 1-2 sentence ~= 30 tokens 1 paragraph ~= 100 tokens 1,500 words ~= 2048 tokens
  3. Foundation models vs Fine-tuned models. Foundational models offer broad knowledge,

    like a library, while fine-tuned models are specialized experts, trained on specific tasks for higher accuracy. The ability to “ask questions” is something not present in a foundational model. Lama2 by Meta has released both foundational and fine tuned models. https://medium.com/mantisnlp/supervised-fine-tuning-customizing-llms-a2c1edbf22c3
  4. What is a LangChain? LangChain is an open-source framework designed

    to simplify the creation of applications using large language models (LLMs). It provides a standard interface for chains, lots of integrations with other tools, and end-to-end chains for common applications.
  5. The prompt below is an attempt to complete a sentiment

    analysis task using a zero-shot prompt. Text: i'll bet the video game is a lot more fun than the film. Sentiment: Zero-shot Prompts
  6. The prompt below is an attempt to complete a sentiment

    analysis task using a few-shot prompt. Text: (lawrence bounces) all over the stage, dancing, running, sweating, mopping his face and generally displaying the wacky talent that brought him fame in the first place. Sentiment: positive Text: despite all evidence to the contrary, this clunker has somehow managed to pose as an actual feature movie, the kind that charges full admission and gets hyped on tv and purports to amuse small children and ostensible adults. Sentiment: negative Text: for the first time in years, de niro digs deep emotionally, perhaps because he's been stirred by the powerful work of his co-stars. Sentiment: positive Text: i'll bet the video game is a lot more fun than the film. Sentiment: Few-shot Prompt
  7. Few shot prompting can be expensive due to a larger

    context, we can try giving the instruction directly. Please label the sentiment towards the movie of the given movie review. The sentiment label should be "positive" or "negative". Text: i'll bet the video game is a lot more fun than the film. Sentiment: Describe what is quantum physics to a 6-year-old. Instruction Prompting
  8. Insert into Pinecone. You can add one vector at a

    time into PineconeDB. However in our case we had several thousand vectors generated for our content so we opted for their upsert API which allows for 100 vectors at a time.
  9. Resources - Introduction to Generative AI (https://www.cloudskillsboost.google/paths/118) - Prompting Guide

    (https://www.promptingguide.ai/) - ChatGPT Prompt Engineering for Developers (https://www.deeplearning.ai/short-courses/)
  10. Activity (10 mins) - Visit bard.google.com - Let’s write some

    prompts to get comfortable - Try out the multi-modal capability - Make the model hallucinate - Bonus: Ask it some math questions!
  11. 1. Prompt to generate a quiz. 2. Prompt to generate

    a quiz in json. You are a product marketer targeting a Gen Z audience. Create exciting and fresh advertising copy for products and their simple description. Keep copy under a few sentences long. Let’s build a quiz app.
  12. 1. Prompt to generate a script for the video. 2.

    Prompt to generate a quiz in json. 3. Let’s build a automated animation.
  13. Let’s understand them settings… • Temperature. • Max Outputs. •

    Safety Settings. • Top K • Top P • Stop Sequence https://www.marktechpost.com/2023/09/14/meet-next-gpt-an-end-to-end-general-purpose-any-to-any-multimodal-
  14. Types of inputs. • Free form prompts • Structured prompts

    • Chat prompts https://www.marktechpost.com/2023/09/14/meet-next-gpt-an-end-to-end-general-purpose-any-to-any-multimodal-
  15. What is a transformer? Input embeddings represent words as numbers,

    which machine learning models can then process. These embeddings are like a dictionary that helps the model understand the meaning of words by placing them in a mathematical space where similar words are located near each other. https://rpradeepmenon.medium.com/introduction-to-large-language-models-and-the-transformer-architecture-534408ed7e61
  16. Dynamic Book Mapping We have 100s of publishers which issue

    books with for the same SNC Student Learning Objectives. How can we automatically map our Lesson Plans to these book chapters?
  17. Results? ❏ Very effective for some subjects / grades. ❏

    OpenAI wins on multi-lingual mapping (Islamiat is in Urdu) ❏ Some LLM models work better with some subjects. ❏ Objective is to get around 90% accuracy in mappings! ❏ Right now we are using it to recommend SLOs, however in the future we intend to fully automate.
  18. Rinse and repeat with other LLMs. ❏ OpenAI ❏ Hugging

    Face ❏ minilm ❏ Mpnet ❏ Lama2 70b ❏ Falcon 180b ❏ Alpaca 13b . . . https://www.searchenginejournal.com/new-open-source-llm-with-zero-guardrails-rivals-google-palm-2/496212/#close