A Fun Weekend Project: Q&A Chatbot Trained on My Own Content

Any book can now be transformed into a chatbot that can answer questions about its content. It doesn’t to have to be a book either. It can also be your own content. For example, you can use your own notes or favorite articles and ask any question about what’s mentioned in them — just as you would ask ChatGPT.

You can do this by fine-tuning OpenAI’s language models (GPT) on your own data. All you will need is the OpenAI API and two open-source libraries (LlamaIndex and Langchain). You can run this in a Google Colab (Jupyter) notebook for free. If this sounds interesting, here is how:

Steps

1. Open AI. Sign up for Open AI and get an API key.

2. Upload your content to GitHub.

3. Use a Colab notebook.

  • To simplify things, we’ll use Google Colab. It runs in the cloud, so you won’t need to install anything on your laptop.
  • To get started quickly, re-use a public Colab that has all the necessary code. This way you would only need to make a few changes. For example, you can copy this Colab (credit goes to Dan Shipper) to your Google Drive. For context, see Dan’s article in Lenny’s newsletter and this video walkthrough by Irina Nik.
  • Replace the GitHub link with your own.
  • Change runtime type to GPU (Menu: Runtime -> Change runtime type).
  • Run all the Colab cells.
  • Enter your OpenAI API code when prompted.
  • Ask any question when prompted.

And that’s it!


You can find a copy of the complete code below:

Continue reading

ChatGPT Use Cases ~2 Months In

It has been just over two months since the release of ChatGPT. During this time, I have explored various use cases and compared different tools. In this post, I would like to share the two uses for ChatGPT that have proven to be the most valuable so far. Of course, it can be used for a thousand other things, but these two have personally stood out to me as the most consistently useful.

Use Cases

I have found that ChatGPT is most consistently useful in the role of an expert, tutor, and editor.

1. Expert and Tutor

When: I want to learn X.

Expertise vs Tutoring

These are very similar conceptually, but I would make a small distinction:

  • Expertise. At times, I may want to get a brief overview (tldr) of a topic. This could be viewed as a quick chat with an expert. For example, if I wanted a brief summary of the life extension industry, but didn’t want to dive too deep, I could think of it as a quick chat with a friend who works in the industry.
  • Tutoring: In other instances, I may want to dive deeper into a specific topic and ask a series of questions. For instance, while I was learning about machine learning with PyTorch, I found ChatGPT to be very helpful as a tutor.”

How

  • Know Where to Start. If I don’t know where to begin, a general introductory question might be helpful, such as “What are the most important topics to master in order to learn X?”
  • Troubleshoot. If I encounter a specific problem or question, it’s best to address it directly. I’ve found that this approach works particularly well with programming questions, at least at a basic level.

Best Practices

  • Creative Prompting: Sometimes, getting creative with prompts can help. For example, instead of asking, “Explain general relativity as if I’m five years old,” it may be helpful to try, “Explain general relativity as if I’m five years old. Please respond as a physics professor at MIT who is good at communicating complex ideas without dumbing them down.”
  • Follow-up: In my experience, one of the main advantages of ChatGPT over traditional search engines and previous-generation AI assistants or chatbots is its interactivity and ability to maintain the thread of the conversation. So, just like with a real tutor, it may be helpful to ask for explanations in a different way, provide an example, elaborate on a particular point, or step back and explain how a certain concept fits into the big picture.

3. Editor

When: I want to change anything about a text.

How

Some examples include:

  • Checking grammar
  • Summarizing or rephrasing the text
  • Getting ideas on what else to consider and think about
  • Analyzing the argument. For example, “What are the likely influences behind this text?” or “What are the strongest counter-arguments to this?”

Context

Lessons and Challenges

  1. Hallucinations and Validation. Of course, one must watch out for hallucinations. That’s why I find that using ChatGPT in combination with Google may work best. The first step may be asking ChatGPT to provide an initial overview of a topic to save time reading long articles from the Google’s organic results that have been SEO’d in and out. And the next step may be to search for specific sub-topics — sometimes using search syntax/operators to find exact matches or limit the search to certain websites.
  2. Common Knowledge vs. Advanced/Niche Topics: I’ve found that ChatGPT is very good at summarizing and explaining common non-controversial knowledge, but is more likely to hallucinate or struggle when dealing with advanced or niche topics that may only be covered by a just few papers or blog posts. Another way to think about this is to consider how likely it is that this topic was prominent in the training dataset.

What I’ve Tested

Despite still relying on Google for the majority of my searches, I have come to the conclusion that ChatGPT — especially when combined with Google — is better or comparable for a specific subset of my use cases and queries. Depending on the question or query, I have also found Perplexity.ai, Neeva, You.com/chat, and Elicit.org to be worth trying out.

What’s Next

I am looking forward to trying Microsoft’s integration of ChatGPT with Bing and Google’s integration of Bard with Google Search. I find the intersection of search and conversational AI to be particularly intriguing, as these two tools are some of the best resources for organizing and retrieving information that we have today.




Examples

Please see — or skip — the three examples of actual “conversations” below:

Continue reading

Monthly Newsletter: Issue 1

This is an issue of my monthly newsletter. Main topics: technology, startups, business growth, and marketing. See other issues on my blog or subscribe. ~Max

Technology and Startups

  • Ten-year Futures – a presentation by A16z. New technologies enable new use cases. Seeing them, as well as non-obvious “second order” effects, is key. E.g. mobile enabled Instagram, Instacart, and ride-sharing.
  • Decrypting Crypto – another presentation by A16z. Bitcoin is a combination of three old technologies: hashcash, public key cryptography, and distributed ledger. Value of cryptocurrencies goes beyond the traditional store of value and medium of exchange. E.g. tokens can help bootstrap new protocol-level innovation and incentivize developers, customers, and investors to contribute.
  • AlphaGo Zero masters the game of Go from scratch. The ML algorithm learned the game without any pre-existing understanding of rules or strategies. Building a general or at least a-little-bit-less-narrow AI appears to be a big priority for DeepMind. Perhaps this can count as a small step in this direction?
  • Delivering blood with drones in Rwanda – a TED talk by the founder of Zipline. What an amazing application of new technology and a case study in social entrepreneurship.
  • Tacotron 2 is a new text-to-speech technology by Google that is (almost?) indistinguishable from a human voice. If Google manages to make it less computationally demanding and ship it as part of the Android OS, all kinds of interesting use cases will be made possible. I personally will listen to more of my Pocket articles in audio.
  • Magic Leap is launching its SDK, shipping in 2018. AR/VR is already quite a saturated market. It’s not entirely clear yet how hyped Magic Leap technology will compare to Microsoft HoloLens, as well as to VR headsets: HTC Vive and Oculus Rift.

Continue reading