An introduction to the AI ​​stack for JavaScript

Machine Learning


It’s hard to understand without using new software infrastructure technologies. At least that’s what the a16z infrastructure team discovered. And since many of us started our careers as programmers, we often learn by doing. This is especially true for waves of generative AI. The wave of generative AI is arriving very fast and spectacularly, and good documentation is often months behind code. Therefore, we have also built projects around large scale language models (LLMs), large scale image models, vector databases, etc. in order to gain a deeper understanding of this area.

In doing so, I realized that all of this is so new and changing so quickly that there really isn’t a good framework to start with. All projects require a large amount of boilerplate code and integration. Frankly, it’s a pain. So I decided to create something very simple. Get started with AIRemplate For those who want to try out the core technology but don’t have to think too much about the long tail of side concerns like authentication, hosting, and tool selection.

You can fork the template and deploy here. We would love to hear your thoughts and feedback so that we can further improve our templates.

component

Many of us are JavaScript/TypeScript enthusiasts, so we chose JavaS.Use the cript stack as a starting point. However, the framework can easily be modified to support other languages, and we plan to do so in the near future.

Here’s an overview of the introductory stack we put together with our longtime collaborators and open source enthusiasts. Tim Chian. The goal is to highlight the simplest path from pulling code on GitHub to a running generative AI app (both images and text). It is designed to be easily extensible for more sophisticated architectures and projects.

For a detailed overview of the new LLM stack, see the post titled .New architecture for LLM applications”.

model and inference

Hosting a model is a hassle and largely an issue not directly related to building AI apps. So we built it using OpenAI for text and Replicate for image inference. Replicate also offers text-based models (see how easy it is to do) Vicuna) so it can be used instead of OpenAI if desired.

Sample code for running stable diffusion inference with Replicate.

certification

Starter frameworks usually don’t bother to include authentication. But in this case, the model is so powerful and versatile that it has been the subject of a large and coordinated effort to make it available for free. Developers often find this out the hard way when they suddenly receive a $10,000 bill from a model provider. That’s why we chose to include Clerk, which does the heavy lifting around bot detection. Of course, when it comes to building more sophisticated apps, we offer full authentication support.

Example code for a drop-in Clerk component for user signup. Handle bot detection, enforce 2FA, and detect user impersonation.

vector database

LLM needs long-term hardened memory to save state and avoid context windows. This is handled by the vector database. Currently, Pinecone is the most mature and popular vector store among the generative AI crowd. That said, we want to provide support for all use cases and environment setups, so we’ve also included support for: page vector From the repository Supabase.

Sample code using Pinecone with Langchain.js. You can also find an example using Supabase pg-vector. here.

introduction

We use Fly.io for deployment. This is because it is multi-regional, easy to manage, and provides a very general computing environment (anything that runs inside a container). Over time, many AI projects will end up using multiple languages ​​or adding significant functionality to their backend. As such, Fly.io is a great compromise between JavaScript-native hosting environments such as Vercel and Netlify and the traditional cloud. That being said, the code easily supports other hosting environments if needed. Fly.io coming soon Providing GPUs If you want to host your own model.

Roadmap

We think this first iteration is a good starting point, but we’re in the process of adding more options and fleshing out the stack. Here’s an overview of our roadmap:

  • Interactive CLI for create-ai-stack. Developers can choose their own project scaffold and dependencies.
  • Transactional database for advanced use cases (e.g. persisting questions in Q&A, user preferences, etc.)
  • Add vector database and deployment platform options
  • Lightweight fine-tuning steps for open source models

For bug fixes, feature requests, and feedback, please open a PR. We are excited to contribute to the open source community and believe the ecosystem always wins.

We would like to thank the following open source projects that contributed to the creation of the AI ​​Getting Started stack: These essential tools have made complex tasks simple and manageable. Thanks to their tireless efforts and valuable contributions, the JavaScript ecosystem continues to thrive and thrive.

* * *

The views expressed herein are the individual views of AH Capital Management, LLC (“a16z”) cited and not those of a16z or its affiliates. Certain information contained herein is obtained from third party sources such as portfolio companies of funds managed by a16z. Although it has been obtained from sources believed to be reliable, a16z has not independently verified such information and makes no representations about its perpetual accuracy or suitability for any particular situation. not. Additionally, this content may include third party advertising. a16z has not reviewed such advertisements and does not endorse any advertising content contained therein.

This content is provided for informational purposes only and should not be relied upon as legal, business, investment or tax advice. You should consult your own advisor about these issues. Any reference to securities or digital assets is for illustrative purposes only and does not constitute an investment recommendation or offer of investment advisory services. Further, this content is not directed to or intended for use by any investor or prospective investor and should not be relied upon in any circumstances in deciding to invest in any fund managed by a16z. Do not. (Any offer to invest in an a16z fund is made solely by means of such fund’s private placement memorandum, subscription agreement, and other relevant documents, all of which must be read.) Investments mentioned, referenced, or referred to or any portfolio company, the ones described do not represent all investments in vehicles managed by a16z and that such investment will be profitable or that other investments made in the future may have similar characteristics or results. We cannot guarantee that it will result in A list of investments made by funds managed by Andreessen Horowitz (excluding investments for which the issuer has not given his a16z permission to publish, and unannounced investments in publicly traded digital assets) is as follows: Available at https://a16z.com/investments/.

The charts and graphs provided herein are for informational purposes only and should not be relied upon in making investment decisions. Past performance is not indicative of future results. Content is stated only as of the date indicated. The forecasts, estimates, forecasts, goals, outlook and/or opinions expressed in these materials are subject to change without notice and may differ from or contradict opinions expressed by others. .please refer to https://a16z.com/disclosures For additional important information,





Source link

Leave a Reply

Your email address will not be published. Required fields are marked *