{"id":111475,"date":"2024-08-13T06:51:26","date_gmt":"2024-08-13T13:51:26","guid":{"rendered":"https:\/\/www.backblaze.com\/blog\/?p=111475"},"modified":"2024-08-27T15:01:38","modified_gmt":"2024-08-27T22:01:38","slug":"how-to-build-your-own-llm-with-backblaze-b2-jupyter-notebook","status":"publish","type":"post","link":"https:\/\/www.backblaze.com\/blog\/how-to-build-your-own-llm-with-backblaze-b2-jupyter-notebook\/","title":{"rendered":"How to Build Your Own LLM with Backblaze B2 + Jupyter Notebook"},"content":{"rendered":"\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"583\" src=\"https:\/\/www.backblaze.com\/blog\/wp-content\/uploads\/2024\/04\/bb-bh-What-Is-Model-Serving_Design-A-1-1024x583.png\" alt=\"A decorative image showing a computer, a cloud, and a building.\" class=\"wp-image-111090\" srcset=\"https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2024\/04\/bb-bh-What-Is-Model-Serving_Design-A-1-1024x583.png 1024w, https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2024\/04\/bb-bh-What-Is-Model-Serving_Design-A-1-300x171.png 300w, https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2024\/04\/bb-bh-What-Is-Model-Serving_Design-A-1-768x437.png 768w, https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2024\/04\/bb-bh-What-Is-Model-Serving_Design-A-1.png 1440w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<div style=\"height:15px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p>Last month, Backblaze Principal Storage Cloud Storyteller, Andy Klein, and I presented a webinar, <a href=\"https:\/\/www.youtube.com\/watch?v=WpOl1Y8IWhw\">Leveraging your Cloud Storage Data in AI\/ML Apps and Services<\/a>, in which we explored the various ways AI\/ML applications use and store data. In addition to sharing insights from our customers who leverage Backblaze B2 Cloud Object Storage for their AI\/ML needs, we also demonstrated a simple AI use case: a <a href=\"https:\/\/www.backblaze.com\/blog\/ai-101-why-rag-is-all-the-rage\/\">retrieval-augmented generation (RAG)<\/a> chatbot answering questions based on custom context downloaded from a private Backblaze B2 Bucket. After the webinar, I posted the demo source code to a GitHub repository: <a href=\"https:\/\/github.com\/backblaze-b2-samples\/ai-rag-examples\">https:\/\/github.com\/backblaze-b2-samples\/ai-rag-examples<\/a>.&nbsp;<\/p>\n\n\n\n<p>In this blog post, I\u2019ll recap a little of the webinar, and explain how you can use the demo source code as a basis for your own experiments with RAG and large language models (LLMs).<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">But why, Pat?<\/h2>\n\n\n\n<p>You might be asking yourself, why build a chatbot when multiple online services, such as ChatGPT, are just a click away? It\u2019s a good question. The main motivation is privacy. Suppose you want your chatbot to use confidential data in generating its responses. By running an LLM on your own machine, whether on-premises or on a virtual machine (VM) under your control in a public cloud provider\u2019s infrastructure, you eliminate the risks of that data surfacing in response to a question from a user outside your organization.<br \/><\/p>\n\n\n\n<p>In the webinar, I showed two Python apps running on a GPU-equipped VM at <a href=\"https:\/\/www.vultr.com\/\">Vultr<\/a>, one of Backblaze\u2019s compute partners. The first app used the <a href=\"https:\/\/docs.gpt4all.io\/gpt4all_python\/home.html\">GPT4All Python SDK<\/a> to create a very simple conversational chatbot running a local instance of a large language model (LLM), which it used in answering general questions. Here\u2019s an example from the webinar:<\/p>\n\n\n\n<p class=\"has-background\" style=\"background-color:#f5f4ff\"><code>Ask me a question: What were the causes of the First World War?<\/code><br \/><code><br \/>The causes of the First World War are complex and varied, but some key factors include nationalism, imperialism, militarism, alliances between nations, and the assassination of Archduke Franz Ferdinand. Nationalism led to tensions between ethnic groups and their respective governments, while imperialism saw countries competing for territories and resources around the world. Militarism also played a role as many European powers built up large armies and navies in preparation for potential conflicts. The complex web of alliances between nations meant that any conflict could quickly escalate into a latIer war, and the assassination of Archduke Franz Ferdinand by a Serbian nationalist was the spark that ignited the powder keg of tensions already present in Europe at the time.<\/code><\/p>\n\n\n\n<p>Now, I\u2019m not a history scholar, but that looks like a pretty good answer to me! (History scholars, you are welcome to correct me.)<\/p>\n\n\n\n<p>The second app used the <a href=\"https:\/\/python.langchain.com\/v0.2\/docs\/introduction\/\">Langchain framework<\/a> to implement a more elaborate chatbot, again running on my own machine at Vultr, that used PDF data downloaded from a private bucket in Backblaze B2 as context for answering questions. As much as I love our webinar attendees, I didn\u2019t want to share genuinely confidential data with them, so I used our <a href=\"https:\/\/www.backblaze.com\/docs\/cloud-storage-about-backblaze-b2-cloud-storage\">Backblaze B2 Cloud Storage documentation<\/a> as context. The chatbot was configured to use that context, <em>and only that context<\/em>, in answering questions. From the webinar:<\/p>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained\">\n<p class=\"has-background\" style=\"background-color:#f5f4ff\"><code>Ask me a question about Backblaze 82: What's the difference between the master application key and a standard application key?<\/code><br \/><br \/><code>The master application key provides complete access to your account with all capabilities, access to all buckets, and has no file prefix restrictions or expiration. On the other hand, a standard application key is limited to the level of access that a user needs and can be specific to a bucket.<\/code><br \/><br \/><code>Ask me a question about Backblaze B2: What were the causes of the First World War?<\/code><br \/><br \/><code>The exact cause of the First World War is not mentioned in these documents.<\/code><\/p>\n<\/div><\/div>\n\n\n\n<p>The chatbot provides a comprehensive, accurate answer to the question on Backblaze application keys, but doesn\u2019t answer the question on the causes of the First World War, since it was configured to use only the supplied context in generating its response.<\/p>\n\n\n\n<p>During the webinar\u2019s question-and-answer session, an attendee posed an excellent question: \u201cCan you ask [the chatbot] follow-up questions where it can use previous discussions to build a proper answer based on content?\u201d I responded, \u201cYes, absolutely; I\u2019ll extend the demo to do exactly that before I post it to GitHub.\u201d What follows are instructions for building a simple RAG chatbot, and then extending it to include message history.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Building a simple RAG chatbot<\/h2>\n\n\n\n<p>After the webinar, I rewrote both demo apps as <a href=\"https:\/\/jupyter.org\/\">Jupyter<\/a> notebooks, which allowed me to add commentary to the code. I\u2019ll provide you with edited highlights here, but you can find all of the details in the <a href=\"https:\/\/github.com\/backblaze-b2-samples\/ai-rag-examples\/blob\/main\/rag_demo.ipynb\">RAG demo notebook<\/a>.<\/p>\n\n\n\n<p>The first section of the notebook focuses on downloading PDF data from the private Backblaze B2 Bucket into a <a href=\"https:\/\/en.wikipedia.org\/wiki\/Vector_database\">vector database<\/a>, a storage mechanism particularly well suited for use with RAG. This process involves retrieving each PDF, splitting it into uniformly sized segments, and loading the segments into the database. The database stores each segment as a vector with many dimensions\u2014we\u2019re talking hundreds, or even thousands. The vector database can then vectorize a new piece of text\u2014say a question from a user\u2014and very quickly retrieve a list of matching segments.<\/p>\n\n\n\n<p>Since this process can take significant time\u2014about four minutes on my MacBook Pro M1 for the 225 PDF files I used, totaling 58MB of data\u2014the notebook also shows you how to archive the resulting vector data to Backblaze B2 for safekeeping and retrieve it when running the chatbot later.<\/p>\n\n\n\n<p>The vector database provides a \u201cretriever\u201d interface that takes a string as input, performs a similarity search on the vectors in the database, and outputs a list of matching documents. Given the vector database, it\u2019s easy to obtain its retriever:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>retriever = vectorstore.as_retriever()<\/code><\/pre>\n\n\n\n<p>The prompt template I used in the webinar provides the basic instructions for the LLM: use this context to answer the user\u2019s question, and don\u2019t go making things up!<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">prompt_template = \"\"\"Use the following pieces of context to answer the question at the end. \r\n    If you don't know the answer, just say that you don't know, don't try to make up an answer.\r\n    \r\n    {context}\r\n    \r\n    Question: {question}\r\n    Helpful Answer:\"\"\"\r\n\r\nprompt = PromptTemplate(\r\n    template=prompt_template, input_variables=[\"context\", \"question\"]\r\n)\r\n<\/pre>\n\n\n\n<p>The RAG demo app creates a local instance of an LLM, using GPT4All with <a href=\"https:\/\/huggingface.co\/NousResearch\/Nous-Hermes-2-Mistral-7B-DPO\">Nous Hermes 2 Mistral DPO<\/a>, a fast chat-based model. Here\u2019s an abbreviated version of the code:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">model = GPT4All(\r\n    model='Nous-Hermes-2-Mistral-7B-DPO.Q4_0.gguf',\r\n    max_tokens=4096,\r\n    device='gpu'\r\n)\r\n<\/pre>\n\n\n\n<p><a href=\"https:\/\/python.langchain.com\/v0.2\/docs\/introduction\/\">LangChain<\/a>, as its name suggests, allows you to combine these components into a chain that can accept the user\u2019s question and generate a response.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">chain = (\r\n        {\"context\": retriever, \"question\": RunnablePassthrough()}\r\n        | prompt\r\n        | model\r\n        | StrOutputParser()\r\n)\r\n<\/pre>\n\n\n\n<p>As mentioned above, the retriever takes the user\u2019s question as input and returns a list of matching documents. The user\u2019s question is also passed through the first step, and, in the second step, the prompt template combines the context with the user\u2019s question to form the input to the LLM. If we were to peek inside the chain as it was processing the question about application keys, the prompt\u2019s output would look something like this:<\/p>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained\">\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained\">\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained\">\n<pre class=\"wp-block-preformatted\">Use the following pieces of context to answer the question at the end. If you don't know the answer, just say that you don't know, don't try to make up an answer.\r\n\r\n&lt;Text of first matching document>\r\n\r\n&lt;Text of second matching document>\r\n\r\nQuestion: What's the difference between the master application key and a standard application key?\r\n\r\nHelpful Answer:\r\n<\/pre>\n\n\n\n<p>This is the basis of RAG: building an LLM prompt that contains the information required to generate an answer, then using the LLM to distill that prompt into an answer. The final step of the chain transforms the data structure emitted by the LLM into a simple string for display.<\/p>\n\n\n\n<p>Now that we have a chain, we can ask it a question. Again, abbreviated from the sample code:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">question = 'What is the difference between the master application key and a standard application key?'\r\nanswer = chain.invoke(question)\r\n<\/pre>\n\n\n\n<div style=\"height:15px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Adding message history to the simple RAG chatbot<\/h2>\n\n\n\n<p>The first step of extending the chatbot is to give the LLM new instructions, similar to its previous prompt template, but including the message history:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">prompt_template = \"\"\"Use the following pieces of context and the message history to answer the question at the end. If you don't know the answer, just say that you don't know, don't try to make up an answer.\r\n    \r\nContext: {context}\r\n    \r\nHistory: {history}\r\n    \r\nQuestion: {question}\r\n\r\nHelpful Answer:\"\"\"\r\n\r\nprompt = PromptTemplate(\r\n    template=prompt_template, input_variables=[\"context\", \"question\", \"history\"]\r\n)\r\n<\/pre>\n\n\n\n<p>The chain must be modified slightly to accommodate the message history:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">chain = (\r\n    {\r\n        \"context\": (\r\n                itemgetter(\"question\")\r\n                | retriever\r\n        ),\r\n        \"question\": itemgetter(\"question\"),\r\n        \"history\": itemgetter(\"history\")\r\n    }\r\n    | prompt\r\n    | model\r\n    | StrOutputParser()\r\n)\r\n<\/pre>\n\n\n\n<p>Now, we define a very simple in-memory message store that uses a session_id parameter to manage multiple simultaneous conversations:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">store = {}\r\n\r\ndef get_session_history(session_id: str) -> BaseChatMessageHistory:\r\n    if session_id not in store:\r\n        store[session_id] = InMemoryChatMessageHistory()\r\n    return store[session_id]\r\n<\/pre>\n\n\n\n<p>LangChain provides a wrapper, <code>RunnableWithMessageHistory<\/code>, that combines the message store with the above chain to create a new chain with message history capability:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">with_message_history = RunnableWithMessageHistory(\r\n    chain,\r\n    get_session_history,\r\n    input_messages_key=\"question\",\r\n    history_messages_key=\"history\",\r\n)\r\n<\/pre>\n\n\n\n<p>Now we can feed a series of related questions into the new chain:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">questions = [\r\n    'What is the difference between the master application key and a standard application key?',\r\n    'Which one would I use to work with a single bucket?',\r\n    'Can you tell me anything more about this topic?'\r\n]\r\n\r\nfor question in questions:\r\n    print(f'\\n{question}\\n')\r\n    answer = with_message_history.invoke(\r\n        {\"question\": question},\r\n        config={\"configurable\": {\"session_id\": \"abc123\"}},\r\n    )\r\n    print(f'{answer}\\n')\r\n<\/pre>\n\n\n\n<p>I have to admit, I was pleasantly surprised by the results:<\/p>\n\n\n\n<p class=\"has-background\" style=\"background-color:#f5f4ff\"><code>What is the difference between the master application key and a standard application key?<\/code><br \/><br \/><code>A master application key grants broad access privileges, while a standard application key is limited to the level of access that a user needs.<\/code><br \/><br \/><code>Which one would I use to work with a single bucket?<\/code><br \/><br \/><code>You would use a standard application key to work with a single bucket as it has limited access and only grants permissions needed for specific tasks, unlike the master application key which provides broad access privileges.<\/code><br \/><br \/><code>Can you tell me anything more about this topic?<\/code><br \/><br \/><code>Sure! The master application key is typically used by developers during development or testing phases to grant full access to all resources in a Backblaze B2 account, while the standard application key provides limited permissions and should be used for production environments where security is paramount.<\/code><\/p>\n\n\n\n<p>Processing this series of questions on my MacBook Pro M1 with no GPU-acceleration took three minutes and 25 seconds, and just 52 seconds with its 16-core GPU. For comparison, I spun up a VM at <a href=\"https:\/\/www.ori.co\/\">Ori<\/a>, another Backblaze partner offering GPU VM instances, with an <a href=\"https:\/\/www.nvidia.com\/en-us\/data-center\/l4\/\">Nvidia L4 Tensor Core GPU<\/a> and 24GB of VRAM. The only code change required was to set the LLM device to &#8216;cuda&#8217; to select the Nvidia GPU. The Ori VM answered those same questions in just 18 seconds.<\/p>\n<\/div><\/div>\n<\/div><\/div>\n<\/div><\/div>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"576\" src=\"https:\/\/www.backblaze.com\/blog\/wp-content\/uploads\/2024\/08\/image2-1024x576.png\" alt=\"An image of an Nvidia L4 Tensor Core GPU\" class=\"wp-image-111481\" srcset=\"https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2024\/08\/image2-1024x576.png 1024w, https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2024\/08\/image2-300x169.png 300w, https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2024\/08\/image2-768x432.png 768w, https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2024\/08\/image2.png 1290w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\">The Nvidia L4 Tensor Core GPU: not much to look at, but crazy-fast AI inference!<\/figcaption><\/figure>\n<\/div>\n\n\n<h2 class=\"wp-block-heading\">Go forth and experiment<\/h2>\n\n\n\n<p>One of the reasons I refactored the demo apps was that notebooks allow an interactive, experimental approach. You can run the code in a cell, make a change, then re-run it to see the outcome. The <a href=\"https:\/\/github.com\/backblaze-b2-samples\/ai-rag-examples\">RAG demo repository<\/a> includes instructions for running the notebooks, and both the GPT4All and LangChain SDKs can run LLMs on machines with or without a GPU. Use the code as a starting point for your own exploration of AI, and let us know how you get on in the comments!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We didn&#8217;t use an LLM to write this, but we did figure out how to build one on Backblaze B2. <\/p>\n","protected":false},"author":174,"featured_media":111090,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"content-type":"","footnotes":""},"categories":[7,434,438,483],"tags":[489,468],"class_list":["post-111475","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cloud-storage","category-featured-1","category-featured-cloud-storage","category-tech-lab","tag-ai-ml","tag-b2cloud","entry"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Build Your Own LLM with Backblaze B2 + Jupyter Notebook<\/title>\n<meta name=\"description\" content=\"Here&#039;s how you can use Backblaze B2 and a Jupyter Notebook to build your own, private LLM like ChatGPT, Claude, and Gemini.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.backblaze.com\/blog\/how-to-build-your-own-llm-with-backblaze-b2-jupyter-notebook\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Build Your Own LLM with Backblaze B2 + Jupyter Notebook\" \/>\n<meta property=\"og:description\" content=\"Here&#039;s how you can use Backblaze B2 and a Jupyter Notebook to build your own, private LLM like ChatGPT, Claude, and Gemini.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.backblaze.com\/blog\/how-to-build-your-own-llm-with-backblaze-b2-jupyter-notebook\/\" \/>\n<meta property=\"og:site_name\" content=\"Backblaze Blog | Cloud Storage &amp; Cloud Backup\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/backblaze\" \/>\n<meta property=\"article:published_time\" content=\"2024-08-13T13:51:26+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-08-27T22:01:38+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.backblaze.com\/blog\/wp-content\/uploads\/2024\/04\/bb-bh-What-Is-Model-Serving_Design-A-1.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1440\" \/>\n\t<meta property=\"og:image:height\" content=\"820\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Pat Patterson\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@backblaze\" \/>\n<meta name=\"twitter:site\" content=\"@backblaze\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Pat Patterson\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"10 minutes\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Build Your Own LLM with Backblaze B2 + Jupyter Notebook","description":"Here's how you can use Backblaze B2 and a Jupyter Notebook to build your own, private LLM like ChatGPT, Claude, and Gemini.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.backblaze.com\/blog\/how-to-build-your-own-llm-with-backblaze-b2-jupyter-notebook\/","og_locale":"en_US","og_type":"article","og_title":"How to Build Your Own LLM with Backblaze B2 + Jupyter Notebook","og_description":"Here's how you can use Backblaze B2 and a Jupyter Notebook to build your own, private LLM like ChatGPT, Claude, and Gemini.","og_url":"https:\/\/www.backblaze.com\/blog\/how-to-build-your-own-llm-with-backblaze-b2-jupyter-notebook\/","og_site_name":"Backblaze Blog | Cloud Storage &amp; Cloud Backup","article_publisher":"https:\/\/www.facebook.com\/backblaze","article_published_time":"2024-08-13T13:51:26+00:00","article_modified_time":"2024-08-27T22:01:38+00:00","og_image":[{"width":1440,"height":820,"url":"https:\/\/www.backblaze.com\/blog\/wp-content\/uploads\/2024\/04\/bb-bh-What-Is-Model-Serving_Design-A-1.png","type":"image\/png"}],"author":"Pat Patterson","twitter_card":"summary_large_image","twitter_creator":"@backblaze","twitter_site":"@backblaze","twitter_misc":{"Written by":"Pat Patterson","Est. reading time":"10 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.backblaze.com\/blog\/how-to-build-your-own-llm-with-backblaze-b2-jupyter-notebook\/#article","isPartOf":{"@id":"https:\/\/www.backblaze.com\/blog\/how-to-build-your-own-llm-with-backblaze-b2-jupyter-notebook\/"},"author":{"name":"Pat Patterson","@id":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/#\/schema\/person\/a724a8aee97b6451107442747cd101a4"},"headline":"How to Build Your Own LLM with Backblaze B2 + Jupyter Notebook","datePublished":"2024-08-13T13:51:26+00:00","dateModified":"2024-08-27T22:01:38+00:00","mainEntityOfPage":{"@id":"https:\/\/www.backblaze.com\/blog\/how-to-build-your-own-llm-with-backblaze-b2-jupyter-notebook\/"},"wordCount":1289,"commentCount":0,"publisher":{"@id":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.backblaze.com\/blog\/how-to-build-your-own-llm-with-backblaze-b2-jupyter-notebook\/#primaryimage"},"thumbnailUrl":"https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2024\/04\/bb-bh-What-Is-Model-Serving_Design-A-1.png","keywords":["AI\/ML","B2Cloud"],"articleSection":["Cloud Storage","Featured","Featured-Cloud Storage","Tech Lab"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.backblaze.com\/blog\/how-to-build-your-own-llm-with-backblaze-b2-jupyter-notebook\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.backblaze.com\/blog\/how-to-build-your-own-llm-with-backblaze-b2-jupyter-notebook\/","url":"https:\/\/www.backblaze.com\/blog\/how-to-build-your-own-llm-with-backblaze-b2-jupyter-notebook\/","name":"How to Build Your Own LLM with Backblaze B2 + Jupyter Notebook","isPartOf":{"@id":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.backblaze.com\/blog\/how-to-build-your-own-llm-with-backblaze-b2-jupyter-notebook\/#primaryimage"},"image":{"@id":"https:\/\/www.backblaze.com\/blog\/how-to-build-your-own-llm-with-backblaze-b2-jupyter-notebook\/#primaryimage"},"thumbnailUrl":"https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2024\/04\/bb-bh-What-Is-Model-Serving_Design-A-1.png","datePublished":"2024-08-13T13:51:26+00:00","dateModified":"2024-08-27T22:01:38+00:00","description":"Here's how you can use Backblaze B2 and a Jupyter Notebook to build your own, private LLM like ChatGPT, Claude, and Gemini.","breadcrumb":{"@id":"https:\/\/www.backblaze.com\/blog\/how-to-build-your-own-llm-with-backblaze-b2-jupyter-notebook\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.backblaze.com\/blog\/how-to-build-your-own-llm-with-backblaze-b2-jupyter-notebook\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.backblaze.com\/blog\/how-to-build-your-own-llm-with-backblaze-b2-jupyter-notebook\/#primaryimage","url":"https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2024\/04\/bb-bh-What-Is-Model-Serving_Design-A-1.png","contentUrl":"https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2024\/04\/bb-bh-What-Is-Model-Serving_Design-A-1.png","width":1440,"height":820,"caption":"A decorative image showing a computer, a cloud, and a building."},{"@type":"BreadcrumbList","@id":"https:\/\/www.backblaze.com\/blog\/how-to-build-your-own-llm-with-backblaze-b2-jupyter-notebook\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to Build Your Own LLM with Backblaze B2 + Jupyter Notebook"}]},{"@type":"WebSite","@id":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/#website","url":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/","name":"Backblaze Cloud Solutions Blog","description":"Cloud Storage &amp; Cloud Backup","publisher":{"@id":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/#organization","name":"Backblaze","url":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/i0.wp.com\/www.backblaze.com\/blog\/wp-content\/uploads\/2017\/12\/backblaze_icon_transparent.png?fit=512%2C512&ssl=1","contentUrl":"https:\/\/i0.wp.com\/www.backblaze.com\/blog\/wp-content\/uploads\/2017\/12\/backblaze_icon_transparent.png?fit=512%2C512&ssl=1","width":512,"height":512,"caption":"Backblaze"},"image":{"@id":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/backblaze","https:\/\/x.com\/backblaze","https:\/\/www.youtube.com\/user\/Backblaze","https:\/\/en.wikipedia.org\/wiki\/Backblaze"]},{"@type":"Person","@id":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/#\/schema\/person\/a724a8aee97b6451107442747cd101a4","name":"Pat Patterson","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2022\/01\/PatPatterson1920px-150x150.png","url":"https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2022\/01\/PatPatterson1920px-150x150.png","contentUrl":"https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2022\/01\/PatPatterson1920px-150x150.png","caption":"Pat Patterson"},"description":"Pat Patterson is the chief technical evangelist at Backblaze. Over his three decades in the industry, Pat has built software and communities at Sun Microsystems, Salesforce, StreamSets, and Citrix. In his role at Backblaze, he creates and delivers content tailored to the needs of the hands-on technical professional, acts as the \u201cvoice of the developer\u201d on the Product team, and actively participates in the wider technical community. Outside the office, Pat runs far, having completed ultramarathons up to the 50 mile distance. Catch up with Pat via Bluesky or LinkedIn.","url":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/author\/pat\/"}]}},"jetpack_featured_media_url":"https:\/\/backblazeprod.wpenginepowered.com\/wp-content\/uploads\/2024\/04\/bb-bh-What-Is-Model-Serving_Design-A-1.png","_links":{"self":[{"href":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/wp-json\/wp\/v2\/posts\/111475","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/wp-json\/wp\/v2\/users\/174"}],"replies":[{"embeddable":true,"href":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/wp-json\/wp\/v2\/comments?post=111475"}],"version-history":[{"count":0,"href":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/wp-json\/wp\/v2\/posts\/111475\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/wp-json\/wp\/v2\/media\/111090"}],"wp:attachment":[{"href":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/wp-json\/wp\/v2\/media?parent=111475"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/wp-json\/wp\/v2\/categories?post=111475"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/backblazeprod.wpenginepowered.com\/blog\/wp-json\/wp\/v2\/tags?post=111475"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}