[{"data":1,"prerenderedAt":726},["ShallowReactive",2],{"navigation_docs_en":3,"\u002Fen\u002Fai-engineering\u002Fintro\u002Fch013-planning-ai-applications":46,"\u002Fen\u002Fai-engineering\u002Fintro\u002Fch013-planning-ai-applications-surround":721},[4],{"title":5,"icon":6,"path":7,"stem":8,"children":9,"page":45},"AI Engineering",null,"\u002Fen\u002Fai-engineering","en\u002F1.ai-engineering",[10],{"title":11,"icon":12,"path":13,"stem":14,"children":15,"page":45},"Introduction to Building AI Applications with Foundation Models","i-lucide-brain-circuit","\u002Fen\u002Fai-engineering\u002Fintro","en\u002F1.ai-engineering\u002F1.intro",[16,20,25,30,35,40],{"title":11,"path":17,"stem":18,"icon":19},"\u002Fen\u002Fai-engineering\u002Fintro\u002Fch01","en\u002F1.ai-engineering\u002F1.intro\u002Fch01","i-lucide-sparkles",{"title":21,"path":22,"stem":23,"icon":24},"The Rise of AI Engineering","\u002Fen\u002Fai-engineering\u002Fintro\u002Fch011-the-rise-of-ai-engineering","en\u002F1.ai-engineering\u002F1.intro\u002Fch011-the-rise-of-ai-engineering","i-lucide-history",{"title":26,"path":27,"stem":28,"icon":29},"Foundation Model Use Cases","\u002Fen\u002Fai-engineering\u002Fintro\u002Fch012-foundation-model-use-cases","en\u002F1.ai-engineering\u002F1.intro\u002Fch012-foundation-model-use-cases","i-lucide-layout-grid",{"title":31,"path":32,"stem":33,"icon":34},"Planning AI Applications","\u002Fen\u002Fai-engineering\u002Fintro\u002Fch013-planning-ai-applications","en\u002F1.ai-engineering\u002F1.intro\u002Fch013-planning-ai-applications","i-lucide-clipboard-list",{"title":36,"path":37,"stem":38,"icon":39},"The AI Engineering Stack","\u002Fen\u002Fai-engineering\u002Fintro\u002Fch014-the-ai-engineering-stack","en\u002F1.ai-engineering\u002F1.intro\u002Fch014-the-ai-engineering-stack","i-lucide-layers",{"title":41,"path":42,"stem":43,"icon":44},"Summary","\u002Fen\u002Fai-engineering\u002Fintro\u002Fch015-summary","en\u002F1.ai-engineering\u002F1.intro\u002Fch015-summary","i-lucide-flag",false,{"id":47,"title":31,"body":48,"description":715,"extension":716,"links":6,"meta":717,"navigation":718,"path":32,"seo":719,"stem":33,"__hash__":720},"docs_en\u002Fen\u002F1.ai-engineering\u002F1.intro\u002Fch013-planning-ai-applications.md",{"type":49,"value":50,"toc":700},"minimark",[51,75,80,87,148,156,161,170,225,228,241,248,257,290,297,301,308,325,332,335,371,395,399,406,420,431,438,473,476,480,487,498,507,534,538,544,561,567,579,582,636,646,649],[52,53,54,58],"u-page-hero",{},[55,56,31],"template",{"v-slot:title":57},"",[55,59,60,69],{"v-slot:description":57},[61,62,63,64,68],"p",{},"Given the seemingly limitless potential of AI, it's tempting to jump into building applications. If you just want to learn and have fun, ",[65,66,67],"strong",{},"jump right in"," — building is one of the best ways to learn.",[61,70,71,72],{},"But if you're doing this for a living, take a step back and consider why you're building this and how. ",[65,73,74],{},"It's easy to build a cool demo with foundation models. It's hard to create a profitable product.",[76,77,79],"h2",{"id":78},"use-case-evaluation","Use Case Evaluation",[61,81,82,83,86],{},"The first question to ask is ",[65,84,85],{},"why"," you want to build this application. Like many business decisions, building an AI application is often a response to risks and opportunities. Here are a few examples of different levels of risks, ordered from high to low:",[88,89,90,118,126],"card-group",{},[91,92,95,99,100,107,108,111,112,117],"card",{"icon":93,"title":94},"i-lucide-shield-alert","Existential Threat",[96,97,98],"em",{},"If you don't do this, competitors with AI can make you obsolete."," If AI poses a major existential threat to your business, incorporating AI must have the highest priority. In the 2023 ",[101,102,106],"a",{"href":103,"rel":104},"https:\u002F\u002Fwww.gartner.com\u002Fen\u002Ftopics\u002Fgenerative-ai",[105],"nofollow","Gartner study",", ",[65,109,110],{},"7%"," cited business continuity as their reason for embracing AI. This is more common for businesses involving document processing and information aggregation — financial analysis, insurance, data processing — and creative work like advertising, web design, and image production. See the 2023 OpenAI study, \"GPTs are GPTs\" (",[101,113,116],{"href":114,"rel":115},"https:\u002F\u002Farxiv.org\u002Fabs\u002F2303.10130",[105],"Eloundou et al., 2023","), to see how industries rank in their exposure to AI.",[91,119,122,125],{"icon":120,"title":121},"i-lucide-trending-up","Profit & Productivity",[96,123,124],{},"If you don't do this, you'll miss opportunities to boost profits and productivity."," Most companies embrace AI for the opportunities it brings. AI can make user acquisition cheaper through more effective copywrites, product descriptions, and visuals; increase retention by improving customer support and personalizing experience; and help with sales lead generation, internal communication, market research, and competitor tracking.",[91,127,130,133,134,137,138],{"icon":128,"title":129},"i-lucide-compass","Don't Get Left Behind",[96,131,132],{},"You're unsure where AI will fit yet, but you don't want to be left behind."," While a company shouldn't chase every hype train, many have failed by waiting too long (cue ",[65,135,136],{},"Kodak, Blockbuster, and BlackBerry","). Investing resources into understanding how a transformational technology can impact your business isn't a bad idea if you can afford it. At bigger companies, this can be part of R&D.",[139,140,141],"sup",{},[101,142,147],{"href":143,"ariaDescribedBy":144,"dataFootnoteRef":57,"id":146},"#user-content-fn-19",[145],"footnote-label","user-content-fnref-19","1",[149,150,151,152,155],"note",{},"Once you've found a good reason to develop this use case, consider whether you have to ",[65,153,154],{},"build it yourself",". If AI poses an existential threat to your business, you might want to do AI in-house instead of outsourcing it to a competitor. However, if you're using AI to boost profits and productivity, you might have plenty of buy options that save time and money while delivering better performance.",[157,158,160],"h3",{"id":159},"the-role-of-ai-and-humans-in-the-application","The Role of AI and Humans in the Application",[61,162,163,164,169],{},"What role AI plays in the AI product influences the application's development and its requirements. ",[101,165,168],{"href":166,"rel":167},"https:\u002F\u002Fdeveloper.apple.com\u002Fdesign\u002Fhuman-interface-guidelines\u002Fmachine-learning",[105],"Apple"," has a great document explaining different ways AI can be used in a product. Here are three key dimensions:",[88,171,172,186,208],{},[91,173,176,183],{"icon":174,"title":175},"i-lucide-cpu","Critical or Complementary",[61,177,178,179,182],{},"If an app can still work without AI, AI is ",[65,180,181],{},"complementary",". Face ID wouldn't work without AI-powered facial recognition; Gmail would still work without Smart Compose.",[61,184,185],{},"The more critical AI is, the more accurate and reliable it has to be. People are more accepting of mistakes when AI isn't core to the application.",[91,187,190,201],{"icon":188,"title":189},"i-lucide-zap","Reactive or Proactive",[61,191,192,193,196,197,200],{},"A ",[65,194,195],{},"reactive"," feature responds to user requests; a ",[65,198,199],{},"proactive"," feature appears when there's an opportunity. A chatbot is reactive; traffic alerts on Google Maps are proactive.",[61,202,203,204,207],{},"Reactive features usually need to happen fast. Proactive features can be precomputed, but since users didn't ask for them, low quality feels intrusive — so they typically have a ",[65,205,206],{},"higher quality bar",".",[91,209,212,222],{"icon":210,"title":211},"i-lucide-refresh-cw","Dynamic or Static",[61,213,214,217,218,221],{},[65,215,216],{},"Dynamic"," features update continually with user feedback; ",[65,219,220],{},"static"," features update periodically. Face ID adapts as faces change; object detection in Google Photos updates only when the app is upgraded.",[61,223,224],{},"Dynamic features might mean each user has their own model — finetuned on their data, or personalized via mechanisms like ChatGPT's memory. Static features typically share one model across users.",[61,226,227],{},"It's also important to clarify the role of humans. Will AI provide background support, make decisions directly, or both? For a customer support chatbot, AI responses can be used in different ways:",[229,230,231,235,238],"ul",{},[232,233,234],"li",{},"AI shows several responses that human agents can reference to write faster responses.",[232,236,237],{},"AI responds only to simple requests and routes more complex requests to humans.",[232,239,240],{},"AI responds to all requests directly, without human involvement.",[242,243,244,245,207],"tip",{},"Involving humans in AI's decision-making processes is called ",[65,246,247],{},"human-in-the-loop",[61,249,250,251,256],{},"Microsoft (2023) proposed a framework for gradually increasing AI automation in products called ",[101,252,255],{"href":253,"rel":254},"https:\u002F\u002Fwww.microsoft.com\u002Fen-us\u002Fmicrosoft-cloud\u002Fblog\u002Fretail-and-consumer-goods\u002F2023\u002F10\u002F23\u002Ffrom-discussion-to-deployment-4-key-lessons-in-generative-ai\u002F",[105],"Crawl-Walk-Run",":",[258,259,260,264,270,274,280,284],"steps",{},[157,261,263],{"id":262},"crawl","Crawl",[61,265,266,267,207],{},"Human involvement is ",[65,268,269],{},"mandatory",[157,271,273],{"id":272},"walk","Walk",[61,275,276,277,207],{},"AI can directly interact with ",[65,278,279],{},"internal employees",[157,281,283],{"id":282},"run","Run",[61,285,286,287,207],{},"Increased automation, potentially including direct AI interactions with ",[65,288,289],{},"external users",[61,291,292,293,296],{},"The role of humans can change over time as the quality of the AI system improves. For example, in the beginning you might use AI to generate suggestions for human agents. If the acceptance rate is high — say, ",[65,294,295],{},"95%"," of AI-suggested responses to simple requests are used verbatim — you can let customers interact with AI directly for those simple requests.",[157,298,300],{"id":299},"ai-product-defensibility","AI Product Defensibility",[61,302,303,304,307],{},"If you're selling AI applications as standalone products, defensibility matters. The low entry barrier is both a blessing and a curse: ",[65,305,306],{},"if something is easy for you to build, it's also easy for your competitors",". What moats do you have?",[309,310,311,312,320,321,324],"warning",{},"Building applications on top of foundation models means providing a layer on top of these models.",[139,313,314],{},[101,315,319],{"href":316,"ariaDescribedBy":317,"dataFootnoteRef":57,"id":318},"#user-content-fn-20",[145],"user-content-fnref-20","2"," If the underlying models expand in capabilities, your layer might be ",[65,322,323],{},"subsumed"," by the models, rendering your app obsolete. Imagine building a PDF-parsing app on top of ChatGPT assuming it can't parse PDFs well. Your ability to compete weakens once that assumption fails. (Even then, a PDF-parsing app might still make sense built on top of open source models, for users who want to host in-house.)",[61,326,327,328,331],{},"One general partner at a major VC firm told me she's seen many startups whose entire products could be ",[65,329,330],{},"a feature for Google Docs or Microsoft Office",". If their products take off, what would stop Google or Microsoft from allocating three engineers to replicate them in two weeks?",[61,333,334],{},"In AI, there are generally three types of competitive advantages:",[88,336,337,346,363],{},[91,338,341,342,345],{"icon":339,"title":340},"i-lucide-microscope","Technology","With foundation models, the ",[65,343,344],{},"core technologies of most companies will be similar",". Hard to differentiate here.",[91,347,350,351,354,355],{"icon":348,"title":349},"i-lucide-database","Data","Big companies likely have more existing data. But a startup that gets to market first and gathers usage data to continually improve their products can make ",[65,352,353],{},"data their moat",". Even when usage data can't train models directly, it gives invaluable insights into user behavior and product shortcomings to guide future data collection.",[139,356,357],{},[101,358,362],{"href":359,"ariaDescribedBy":360,"dataFootnoteRef":57,"id":361},"#user-content-fn-21",[145],"user-content-fnref-21","3",[91,364,367,368,207],{"icon":365,"title":366},"i-lucide-megaphone","Distribution","The ability to bring your product in front of users. This advantage ",[65,369,370],{},"likely belongs to big companies",[242,372,373,374,377,378,381,382,385,386,394],{},"Many successful companies' original products could've been features of larger products. ",[65,375,376],{},"Calendly"," could've been a feature of Google Calendar. ",[65,379,380],{},"Mailchimp"," could've been a feature of Gmail. ",[65,383,384],{},"Photoroom"," could've been a feature of Google Photos.",[139,387,388],{},[101,389,393],{"href":390,"ariaDescribedBy":391,"dataFootnoteRef":57,"id":392},"#user-content-fn-22",[145],"user-content-fnref-22","4"," Many startups eventually overtake bigger competitors by building a feature those competitors overlooked. Perhaps yours can be next.",[76,396,398],{"id":397},"setting-expectations","Setting Expectations",[61,400,401,402,405],{},"Once you've decided to build this AI application yourself, the next step is to figure out what success looks like. The most important metric is how this will impact your ",[65,403,404],{},"business",". For a customer support chatbot, business metrics might include:",[229,407,408,411,414,417],{},[232,409,410],{},"What percentage of customer messages do you want the chatbot to automate?",[232,412,413],{},"How many more messages should the chatbot allow you to process?",[232,415,416],{},"How much quicker can you respond using the chatbot?",[232,418,419],{},"How much human labor can the chatbot save you?",[149,421,422,423,426,427,430],{},"A chatbot can answer more messages, but that doesn't mean it'll make users happy — track ",[65,424,425],{},"customer satisfaction and feedback"," in general. ",[96,428,429],{},"\"User Feedback\""," on page 474 discusses how to design a feedback system.",[61,432,433,434,437],{},"To ensure a product isn't put in front of customers before it's ready, have clear expectations on its ",[65,435,436],{},"usefulness threshold",": how good it has to be for it to be useful.",[88,439,440,444,456,461],{},[91,441,443],{"icon":19,"title":442},"Quality","Measure the quality of the chatbot's responses.",[91,445,448,451,452,455],{"icon":446,"title":447},"i-lucide-timer","Latency",[65,449,450],{},"TTFT"," (time to first token), ",[65,453,454],{},"TPOT"," (time per output token), and total latency. What's acceptable depends on your use case — if humans currently respond with a median of an hour, anything faster is good enough.",[91,457,460],{"icon":458,"title":459},"i-lucide-dollar-sign","Cost","How much it costs per inference request.",[91,462,465,466,469,470,207],{"icon":463,"title":464},"i-lucide-scale","Other","Metrics such as ",[65,467,468],{},"interpretability"," and ",[65,471,472],{},"fairness",[61,474,475],{},"If you're not yet sure what metrics you want to use, don't worry — the rest of the book will cover many of these.",[76,477,479],{"id":478},"milestone-planning","Milestone Planning",[61,481,482,483,486],{},"Once you've set measurable goals, you need a plan to achieve them. How to get there depends on where you start. ",[65,484,485],{},"Evaluate existing models"," to understand their capabilities — the stronger the off-the-shelf models, the less work you'll have to do.",[61,488,489,490,493,494,497],{},"For example, if your goal is to automate ",[65,491,492],{},"60%"," of customer support tickets and an off-the-shelf model can already handle ",[65,495,496],{},"30%",", the effort needed is much less than if it could automate none. It's likely that your goals will change after evaluation. You may realize the resources needed to get the app to the usefulness threshold exceed its potential return — and decide not to pursue it.",[309,499,500,503,504],{},[65,501,502],{},"The last mile challenge."," Initial success with foundation models can be misleading. Base capabilities are already quite impressive, so building a fun demo doesn't take long. But a good demo doesn't promise a good end product. ",[65,505,506],{},"It might take a weekend to build a demo but months — or years — to build a product.",[149,508,509,510,515,516,519,520,525,526,529,530,533],{},"In the paper UltraChat, ",[101,511,514],{"href":512,"rel":513},"https:\u002F\u002Farxiv.org\u002Fabs\u002F2305.14233",[105],"Ding et al. (2023)"," shared that ",[96,517,518],{},"\"the journey from 0 to 60 is easy, whereas progressing from 60 to 100 becomes exceedingly challenging.\""," ",[101,521,524],{"href":522,"rel":523},"https:\u002F\u002Fwww.linkedin.com\u002Fblog\u002Fengineering\u002Fgenerative-ai\u002Fmusings-on-building-a-generative-ai-product",[105],"LinkedIn (2024)"," shared the same sentiment: it took them ",[65,527,528],{},"one month"," to achieve 80% of the experience they wanted, but ",[65,531,532],{},"four more months"," to surpass 95%. A lot of time was spent on product kinks and hallucinations. The slow speed of achieving each subsequent 1% gain was discouraging.",[76,535,537],{"id":536},"maintenance","Maintenance",[61,539,540,541],{},"Product planning doesn't stop at achieving its goals. You need to think about how this product will change over time and how it should be maintained. AI's fast pace of change adds extra challenge. ",[65,542,543],{},"Building on top of foundation models today means committing to riding this bullet train.",[61,545,546,547,519,550,554,555,560],{},"Many changes are good. Limitations are being addressed: ",[65,548,549],{},"context lengths are getting longer, model outputs are getting better, and inference is getting faster and cheaper.",[101,551,553],{"href":552},".\u002Fmedia\u002Ffig-1-11.png","Figure 1-11"," shows the evolution of inference cost and model performance on ",[101,556,559],{"href":557,"rel":558},"https:\u002F\u002Farxiv.org\u002Fabs\u002F2009.03300",[105],"Massive Multitask Language Understanding (MMLU) (Hendrycks et al., 2020)",", a popular foundation model benchmark, between 2022 and 2024.",[61,562,563],{},[564,565],"img",{"alt":566,"src":552},"Figure 1-11. The cost of AI reasoning rapidly drops over time.",[568,569,570],"blockquote",{},[61,571,572,573,578],{},"Figure 1-11. The cost of AI reasoning rapidly drops over time. Image from ",[101,574,577],{"href":575,"rel":576},"https:\u002F\u002Fsemaphore.substack.com\u002Fp\u002Fthe-cost-of-reasoning-in-raw-intelligence",[105],"Nguyen"," (2024).",[61,580,581],{},"But even good changes cause friction. You'll have to constantly run a cost-benefit analysis of each technology investment.",[88,583,584,597,606,615],{},[91,585,588,589,592,593,596],{"icon":586,"title":587},"i-lucide-wallet","Pricing Whiplash","You may decide to ",[65,590,591],{},"build a model in-house"," because it seems cheaper than paying for model providers, only to find out after three months that providers have ",[65,594,595],{},"dropped their prices in half"," — making in-house the expensive option.",[91,598,601,602,605],{"icon":599,"title":600},"i-lucide-plug","Vendor Risk","You might invest in a third-party solution and tailor your infrastructure around it, only for the ",[65,603,604],{},"provider to go out of business"," after failing to secure funding.",[91,607,610,611,614],{"icon":608,"title":609},"i-lucide-shuffle","Model Swaps","As model providers converge to the same API, swapping one for another is getting easier. But each model has its ",[65,612,613],{},"quirks, strengths, and weaknesses"," — workflows, prompts, and data still need adjustment. Without proper versioning and evaluation infrastructure, the process can cause headaches.",[91,616,619,620,623,624,629,630,635],{"icon":617,"title":618},"i-lucide-gavel","Regulations","Technologies surrounding AI are considered national security issues for many countries. ",[65,621,622],{},"GDPR"," was estimated to cost businesses ",[101,625,628],{"href":626,"rel":627},"https:\u002F\u002Fwww.forbes.com\u002Fsites\u002Foliversmith\u002F2018\u002F05\u002F02\u002Fthe-gdpr-racket-whos-making-money-from-this-9bn-business-shakedown\u002F",[105],"$9 billion"," to comply with. Compute availability can change overnight (see the ",[101,631,634],{"href":632,"rel":633},"https:\u002F\u002Foreil.ly\u002FeYTmr",[105],"US October 2023 Executive Order","). If your GPU vendor is suddenly banned from selling to your country, you're in trouble.",[637,638,639,642,643,207],"caution",{},[65,640,641],{},"Some changes can be fatal."," Regulations around intellectual property and AI usage are still evolving. If you build your product on top of a model trained using other people's data, can you be certain your product's IP will always belong to you? Many IP-heavy companies — game studios, for example — hesitate to use AI for fear of ",[65,644,645],{},"losing their IPs later on",[61,647,648],{},"Once you've committed to building an AI product, let's look into the engineering stack needed to build these applications.",[650,651,654,659],"section",{"className":652,"dataFootnotes":57},[653],"footnotes",[76,655,658],{"className":656,"id":145},[657],"sr-only","Footnotes",[660,661,662,673,682,691],"ol",{},[232,663,665,666],{"id":664},"user-content-fn-19","Smaller startups, however, might have to prioritize product focus and can't afford to have even one person to \"look around.\" ",[101,667,672],{"href":668,"ariaLabel":669,"className":670,"dataFootnoteBackref":57},"#user-content-fnref-19","Back to reference 1",[671],"data-footnote-backref","↩",[232,674,676,677],{"id":675},"user-content-fn-20","A running joke in the early days of generative AI is that AI startups are OpenAI or Claude wrappers. ",[101,678,672],{"href":679,"ariaLabel":680,"className":681,"dataFootnoteBackref":57},"#user-content-fnref-20","Back to reference 2",[671],[232,683,685,686],{"id":684},"user-content-fn-21","During the process of writing this book, I could hardly talk to any AI startup without hearing the phrase \"data flywheel.\" ",[101,687,672],{"href":688,"ariaLabel":689,"className":690,"dataFootnoteBackref":57},"#user-content-fnref-21","Back to reference 3",[671],[232,692,694,695],{"id":693},"user-content-fn-22","Disclaimer: I'm an investor in Photoroom. ",[101,696,672],{"href":697,"ariaLabel":698,"className":699,"dataFootnoteBackref":57},"#user-content-fnref-22","Back to reference 4",[671],{"title":57,"searchDepth":701,"depth":701,"links":702},2,[703,711,712,713,714],{"id":78,"depth":701,"text":79,"children":704},[705,707,708,709,710],{"id":159,"depth":706,"text":160},3,{"id":262,"depth":706,"text":263},{"id":272,"depth":706,"text":273},{"id":282,"depth":706,"text":283},{"id":299,"depth":706,"text":300},{"id":397,"depth":701,"text":398},{"id":478,"depth":701,"text":479},{"id":536,"depth":701,"text":537},{"id":145,"depth":701,"text":658},"How to evaluate use cases, build vs buy, set success metrics, plan milestones, and maintain AI products in a fast-moving landscape.","md",{},{"icon":34},{"title":31,"description":715},"JExVJe0KVHI55cUyEbXALLC_faV1X68xQTW_oiTOf9I",[722,724],{"title":26,"path":27,"stem":28,"description":723,"icon":29,"children":-1},"A tour of industry-proven and promising use cases for foundation models — from coding and creative work to writing, education, chatbots, information aggregation, data organization, and workflow automation.",{"title":36,"path":37,"stem":38,"description":725,"icon":39,"children":-1},"The three layers of the AI stack, how AI engineering differs from ML engineering and full-stack development, and how foundation models reshape model and application development.",1778484800915]