manisnesan / til

collection of today i learned scripts
4 stars 0 forks source link

Practical LLMs #26

Open manisnesan opened 1 year ago

manisnesan commented 1 year ago

Landing Section

https://github.com/Aggregate-Intellect/practical-llms/blob/main/README.md

Update: Twitter thread, Slides and Recording available as of Mar 14, 2023

LLM Interfaces Workshop and Hackathon

https://lu.ma/llm-interfaces - Apr 28, 2023

Excellent talks

Considerations

Source : Pratik Pakodas - Substack

Courses

Check them out: deeplearning.ai/short-courses/

manisnesan commented 1 year ago

https://gist.github.com/joeddav/a11e5cc0850f0e540324177a53b547ae

Python wrapper around ChatGPT API

manisnesan commented 1 year ago

https://til.simonwillison.net/gpt3/chatgpt-api

manisnesan commented 1 year ago

Prompt Engineering Guide

Instruction: Tell the model what you want

Extract the name of the author from the quotation below.

“Some humans theorize that intelligent species go extinct before they can expand into outer space. If they're correct, then the hush of the night sky is the silence of the graveyard.” ― Ted Chiang, Exhalation Output:

Ted Chiang

Completion: Induce the model to complete the beginning of what you want

“Some humans theorize that intelligent species go extinct before they can expand into outer space. If they're correct, then the hush of the night sky is the silence of the graveyard.” ― Ted Chiang, Exhalation

The author of this quote is Output:

Ted Chiang

Demonstration: Show the model what you want, with either: A few examples in the prompt Many hundreds or thousands of examples in a fine-tuning training dataset - Few Shot prompts

Quote: “When the reasoning mind is forced to confront the impossible again and again, it has no choice but to adapt.” ― N.K. Jemisin, The Fifth Season Author: N.K. Jemisin

Quote: “Some humans theorize that intelligent species go extinct before they can expand into outer space. If they're correct, then the hush of the night sky is the silence of the graveyard.” ― Ted Chiang, Exhalation Author: Output:

Ted Chiang

Source : Openai cookbook

Tricks

Source: cohere.ai - prompt Engineering • Give clearer instructions – the more explicit you articulate the desired task, it's inputs, and outputs, the better the results will be.

• Ask the model to answer as if it was an expert.

• Supply better examples. If you're demonstrating examples in your prompt, make sure that your examples are diverse and high quality.

• Prompt the model to explain its reasoning using a prefix like "Let's think step by step". This is known as chain-of-thought reasoning

• Generate many outputs, and then use the model to pick the best one (an example of iterative refinement)

• If you're still having trouble, try splitting complex tasks into simpler subtasks

Takeaways

Blogs

the two that immediately came to mind: https://lilianweng.github.io/posts/2023-03-15-prompt-engineering/ and https://www.oneusefulthing.org/p/a-guide-to-prompting-ai-for-what and this repo also gave me lots of ideas: https://github.com/f/awesome-chatgpt-prompts

Additional Resources for Prompt Engineering 1️⃣ Microsoft - Introduction to prompt engineering https://lnkd.in/dAfVftGG

2️⃣ Chip Huyen - Building LLM applications for production https://lnkd.in/dEiZqzpT

3️⃣ DAIR.AI - Prompt Engineering Guide https://lnkd.in/dXZdgM7e

4️⃣ PromptsLab - Awesome Prompt Engineering https://lnkd.in/dF9naw2a

5️⃣ Lilian Weng (OpenAI) - Prompt Engineering https://lnkd.in/dBTJRpZd

6️⃣ Microsoft - Prompt engineering techniques https://lnkd.in/dDzsJXhb

7️⃣ Cobus Greyling - Generative AI Prompt Pipelines https://lnkd.in/d5U5XkFd

8️⃣ Xavier (Xavi) Amatriain (LinkedIn) - Prompt Engineering 101 - Introduction and resources https://lnkd.in/drT8Z_Rq

9️⃣ Xavier (Xavi) Amatriain - Prompt Engineering: How to Talk to the AIs (course) https://lnkd.in/dGKqcWFj

manisnesan commented 1 year ago

Paper - Language models and cognitive automation for economic research

manisnesan commented 1 year ago

Retrieval

Problem: ChatGPT - it doesn't know about YOUR data

Solution:

image

manisnesan commented 1 year ago

image

manisnesan commented 1 year ago

Quoting Simon Willison analogy for language models

Think of language models like ChatGPT as a “calculator for words”

Source

manisnesan commented 1 year ago

https://arxiv.org/pdf/2304.03153v1.pdf Twitter

manisnesan commented 1 year ago

cookbook

manisnesan commented 1 year ago

Twitter thread - how do we overcome 4096 token limit in OpenAI GPT requests?

manisnesan commented 1 year ago

Prompt Injection example to leak system prompts

manisnesan commented 1 year ago

Idea

To enhance an existing Large Language Model with custom knowledge, there are 2 main methods:

Pros & Cons

Prompt Engineering and Retrieval Augmented Generation

instead of simply it’d be: answer following question given ,

Source : Integrating ChatGPT with internal KB and Q&A

manisnesan commented 1 year ago

Demonstrate-Search-Predict

dsp - GitHub

manisnesan commented 1 year ago

Dolly - Open source Instruction tuned LLM

manisnesan commented 1 year ago

Related to https://github.com/manisnesan/til/issues/33

manisnesan commented 1 year ago

Simple poc

  1. Take an @arxiv AI research paper
  2. With the help of @LangChainAI, embed the data and store the data in @trychroma
  3. Use @streamlit to create a chatbot to chat with the data

image

Similar idea with pinecone embedding Youtube

manisnesan commented 1 year ago

Jeremy posed a Challenge if this can be written without langchain for comparison purpose in this tweet

manisnesan commented 1 year ago

Q&A over fsdl corpus

manisnesan commented 1 year ago

mood board:

https://www.lesswrong.com/posts/vJFdjigzmcXMhNTsx/simulators https://arxiv.org/abs/2302.07842 https://www.pinecone.io/learn/langchain/ https://arxiv.org/abs/2211.04325

manisnesan commented 1 year ago

Why In house LLMs : fine tune an open source LLM on one's own data

image

Source : Chip Huyen Tweet

manisnesan commented 1 year ago

"Help me build my intuition about ... "

A magic spell to learn anything

some examples, how to -get a fat ass -build a company -build an iOS app using the share sheet api -do advanced meditation techniques

Also add " with a memorable metaphor "

manisnesan commented 1 year ago

Expanding the Capabilities of Language Models with External Tools

Use case 1: Can LLM answer the question (using APIChain) "Who was the CTO of Apple when it's share prices was at its lowest point in the last 10 years"

Use case 2: "Find me flights from Toronto to Bangalore flying out on June 27 & returning on Aug 12, without transiting via the U.S and without involving a self-transfer"

Lean Approach: User Query -> [sequence of external API/data store calls] -> LLM synthesizes the answer Holy Grail: User Query -> LLM decomposes query -> calls appropriate external services where needed -> combines responses in coherent answer in requested format

OpenChatKit

LlamdaIndex Features

LangChain Utilities

Task decomposition

Next

Resources

manisnesan commented 1 year ago

Using LangChain Workshop Solutions

Google Colab

Questions:

Ideas

Resources

manisnesan commented 1 year ago

LLMs in your own environment

Why

Challenges

Resources

manisnesan commented 1 year ago

This is based on the idea from KnowledgeOps talk by Amir Feizpour

Generate Tasks to achieve Objective -> Prioritize -> Execute -> Reflect on Performance -> Ask for user feedback/input

Creating a lung cancer detection model using visual transformer using ChatGPT https://chat.openai.com/c/c990f5d0-39bc-4a74-b845-585a20bdf29f

Example https://github.com/Significant-Gravitas/Auto-GPT/blob/master/autogpt/config/ai_config.py screenshot-meet google com-2023 04 28-12_45_55

manisnesan commented 1 year ago

Exploring the limits of today's LLMs by Suhas Pai

Related: https://github.com/manisnesan/til/issues/26#issuecomment-1527493329 and https://github.com/Aggregate-Intellect/practical-llms/blob/main/README.md#llmops-expanding-the-capabilities-of-language-models-with-external-tools

LLM Evaluation

Cutting edge

Tool Integration & Workflows

Resources

https://instructor-embedding.github.io/

manisnesan commented 1 year ago

Challenges

Solution

What

manisnesan commented 1 year ago

Peter Bull's (from DrivenData) notes from the Full Stack Deep Learning LLM Bootcamp:

"Our new baseline for all NLP tasks will be asking an LLM to do the task."

Harnessing LLMs: Part I

https://www.linkedin.com/pulse/harnessing-llms-part-i-peter-bull/

manisnesan commented 1 year ago

Llm - Practical guide

manisnesan commented 1 year ago

Intro to Language safety - MLOpsLearners

manisnesan commented 1 year ago

LLM Observability

https://arize.com/blog/building-chatgpt-plugin/

manisnesan commented 1 year ago

Private GPT

manisnesan commented 1 year ago

Fine tuning LLMs on custom domain

https://armandolivares.tech/2023/04/22/how-to-fine-tune-a-model-like-chatgpt-in-spanish-using-alpaca-lora/

https://twitter.com/eugeneyan/status/1657412697678577671?s=46&t=aOEVGBVv9ICQLUYL4fQHlQ

manisnesan commented 1 year ago

LlamaIndex - Local only models : Google Colab

manisnesan commented 1 year ago

LLM university - cohere

manisnesan commented 1 year ago

https://docs.gpt4all.io/gpt4all_chat.html

manisnesan commented 1 year ago

Fine tuning red pajama OSS LLM

@johnrobinsn shows how to take a base model and instruction tune it using the Alpaca dataset, including the steps required to prepare the data - but we can adapt this easily to our own data.

manisnesan commented 1 year ago

brexhq prompt engineering

manisnesan commented 1 year ago

John Berryman quote from Inside GitHub working with LLMS behind GitHub copilot

The secret is that we don’t just have to provide the model with the original file that the GitHub Copilot user is currently editing; instead we look for additional pieces of context inside the IDE that can hint the model towards better completions.”

He continues, “There have been several changes that helped get GitHub Copilot where it is today, but one of my favorite tricks was when we pulled similar texts in from the user’s neighboring editor tabs. That was a huge lift in our acceptance rate and characters retained.”

manisnesan commented 1 year ago

Generative vs Extractive https://haystack.deepset.ai/blog/generative-vs-extractive-models/

manisnesan commented 1 year ago

State of GPT Karpathy talk notes Youtube

manisnesan commented 1 year ago

build a ChatGPT using llamaindex and mongodb

manisnesan commented 1 year ago

LLama Index with local only models

manisnesan commented 1 year ago

Wayde Gilliam tips on Retrieval LLM

Example: You many ONLY use the provided documents to provide your answer and you should always include a citation that is the document's Id where it is used in the answer.

manisnesan commented 1 year ago

Mini chain

https://srush-minichain.hf.space

https://srush.github.io/MiniChain/examples/qa/

https://github.com/explosion/spacy-llm

manisnesan commented 1 year ago

From @nirantk

How can you always keep your answers fresh and automatically updated?

Tutorial Colab Notebook here w/ Detailed Diagrams: bit.ly/updatedQAColab

Built with (@CohereAI + @OpenAI + @qdrant_engine) using @llama_index

manisnesan commented 1 year ago

Production

All the Hard Stuff Nobody Talks About when Building Products with LLMs

Phillip Carter shares lessons learned building LLM features for Honeycomb - hard won knowledge from building a query assistant for turning human questions into Honeycomb query filters.

manisnesan commented 1 year ago

https://weaviate.io/blog/llms-and-search

manisnesan commented 12 months ago

Building LLM Applications for Production - Chip Huyen

Discusses the MLOps Challenges such as the following in building LLM applications in production

Consistency | Hallucination | Privacy | Data Drift | Context Length | Model Updates & Compatibility | LM On the Edge

https://home.mlops.community/home/videos/building-llm-applications-for-production

Yet to review the other talks that I missed

Part 1 can found in this link (Apr 2023) https://home.mlops.community/home/collections/llms-in-production-conference-2023-04-13

manisnesan commented 11 months ago

h2ogpt

https://arxiv.org/pdf/2306.08161.pdf