首页›Chip Huyen›文章

Building A Generative AI Platform

2024年7月25日

AI 摘要 AI 生成,可能有误

The article outlines the common architecture of a generative AI platform, starting with a simple setup where a query is sent directly to a model, then progressively adding components such as context enhancement (including RAG, term-based and embedding-based retrieval, and query rewriting), guardrails, model routers and gateways, caching, and complex logic like write actions. It emphasizes that evaluation is necessary at every step, while observability and orchestration are essential platform-wide components. The piece focuses on architectural considerations for deployment rather than topics like prompt engineering, finetuning, or model evaluation.

After studying how companies deploy generative AI applications, I noticed many similarities in their platforms. This post outlines the common components of a generative AI platform, what they do, and how they are implemented. I try my best to keep the architecture general, but certain applications might deviate. This is what the overall architecture looks like.


This is a pretty complex system. This post will start from the simplest architecture and progressively add more components. In its simplest form, your application receives a query and sends it to the model. The model generates a response, which is returned to the user. There are no guardrails, no augmented context, and no optimization. The Model API box refers to both third-party APIs (e.g., OpenAI, Google, Anthropic) and self-hosted APIs.


From this, you can add more components as needs arise. The order discussed in this post is common, though you don’t need to follow the exact same order. A component can be skipped if your system works well without it. Evaluation is necessary at every step of the development process.

继续阅读全文

为了尊重作者,这里只展示开头几段。你可以去原文阅读,或者在 HorizonReader 里读:划线做笔记、让 AI 帮忙。

更多来自 Chip Huyen

Common pitfalls when building generative AI applications

AI 摘要The article outlines six common pitfalls in building generative AI applications: using gen AI when simpler solutions suffice, confusing bad product design with bad AI, starting with overly complex tools, over-indexing on early demo success, forgoing human evaluation in favor of AI judges, and crowdsourcing use cases without a strategic plan. The author emphasizes that while the technology is powerful, success depends on solving real problems, prioritizing product and UX, maintaining human oversight, and adopting a big-picture strategy to maximize return on investment.

Agents

AI 摘要This article provides an overview of AI agents, defining them as systems that perceive their environment through sensors and act upon it via actuators, and explains how foundation models have finally made autonomous agents capable of tasks like research, coding, and trip planning feasible. It examines two key factors that determine an agent's capabilities—its tools (including knowledge augmentation, capability extension, and environment-acting tools) and its planning ability—while noting that agents require more powerful models than typical applications due to compounding mistakes and higher stakes. Adapted from AI Engineering (2025), the piece concludes that agents' new modes of operation introduce new failure modes that must be caught through careful evaluation.

Measuring personal growth

AI 摘要Inspired by founder friends who obsessively measure business growth, the author proposes three heuristics for measuring personal growth: rate of change (aiming to become a 'new person' every 3–6 years, analogous to finance's rule of 72), the time it takes to solve big life problems like career, family, and finance, and the number of future options gained by choosing paths that maximize possibilities. Acknowledging that some friends find quantifying life 'sociopathic,' the author argues that measuring and living aren't mutually exclusive. These heuristics reflect a personal bias toward novelty and exploration that may one day change—which would itself be growth.

What I learned from looking at 900 most popular open source AI tools

AI 摘要The author analyzed 845 of the most popular open source AI software repositories on GitHub, organizing them into a three-layer AI stack (infrastructure, model development, and application development) and documenting an explosion of new tools in 2023 following the releases of Stable Diffusion and ChatGPT, with application development and AI engineering seeing the most growth. The analysis showed that a small number of accounts—mostly organizations but also prolific individuals like lucidrains and ggerganov—host a large share of repos, that individuals can compete effectively at the application layer but rarely at lower layers, and that over 20,000 developers have contributed nearly a million commits. It also highlighted how China's open source AI ecosystem has diverged from the West's, and how many repos follow a hype curve of rapid popularity followed by swift decline.

Predictive Human Preference: From Model Ranking to Model Routing

AI 摘要The article introduces predictive human preference—forecasting which AI model users will prefer for a specific prompt—as an extension of model ranking systems like LMSYS's Chatbot Arena. The author validates Chatbot Arena's Bradley-Terry ranking (74.1% accuracy in predicting match outcomes) and builds a prototype preference predictor using DistilBERT that improves accuracy to 76.2% by incorporating prompts. Key applications include model routing to cheaper or faster models when quality is equivalent, as well as generating domain-specific and query-specific leaderboards.