Back-of-the-Envelope Estimates by kirupa (https://www.kirupa.com/me/index.htm) | filed under Data & Decisions (https://www.kirupa.com/data_and_decisions/index.htm) TL;DR: A quick, rough calculation that breaks a big unknown into small pieces we can guess, rounds them to friendly numbers, and multiplies them is called a back-of-the-envelope estimate. In five minutes, one showed that sending Biscuit's whole menu with every message would cost about $790 a month instead of about $70. - Split the question into pieces we can look up or guess, like chats a day, messages per chat, tokens per message, and the price per million tokens, then round each one and multiply. - Check the napkin against something real, like $67.50 against Biscuit's real $58.20 invoice. Then change one piece to estimate what we can't check yet, and redo the shakiest piece low and high to get a range. - Aim for the right order of magnitude: tens, hundreds, or thousands. The whole menu jumps Biscuit's bill from the tens to the hundreds, and $787.50 is no more trustworthy than about $790. - The same napkin works for usage and latency. Looking up an order on every message means about 500 lookups a day and about 50 seconds of waiting in a 5-message chat. Biscuit, the help desk bot that Wren built for Crumb & Co., just finished its first month. It handled 3,214 chats across both of our bakery's shops, and an AI agent turned those chats into a tidy report. One headline in that report says, "Easy win: send the whole menu with every message." That way, Biscuit could answer any allergen question on its own. The owner forwards the report to Wren with one question: "What will that cost us?" Wren could spend a day on a spreadsheet, or five minutes on a napkin. In this article, we'll learn how to do the five-minute version for cost, usage, and latency, before we build anything. Onwards! A Day or Five Minutes? Here are the two ways Wren can answer the owner: [Image: A gag comparing two ways to answer the owner's question. On the left, a huge spreadsheet named menu_cost_v7_FINAL.xlsx, packed with rows and columns, next to a yawning face and the label about a day. On the right, a paper napkin with three short lines of math, 100 chats times 30 days, times 5 messages, roughly hundreds a month, next to a cup of coffee and the label 5 minutes.] (https://www.kirupa.com/data_and_decisions/images/back_of_the_envelope_two_options.png) The spreadsheet would look more precise, but nearly every cell in it would still be a guess. The owner doesn't need the bill down to the penny. The owner just needs to know if this idea costs about as much as a coffee, a nice dinner, or a used car each month. So Wren grabs a napkin. A quick calculation like this, rough on purpose and small enough to fit on the back of whatever paper is nearby, is called a back-of-the-envelope estimate. Breaking the Question Into Pieces Nobody can guess our monthly bill for Biscuit out of thin air, so we split that one big unknown into smaller numbers we can look up or guess, starting with Biscuit as it runs today. Our napkin will look as follows: [Image: Biscuit's monthly bill, an unknown, broken into pieces we can look up or guess, multiplied together on a napkin: chats a day, times days in a month, times messages in a chat, times tokens per message, times the price per million tokens. Every value is still a question mark.] (https://www.kirupa.com/data_and_decisions/images/back_of_the_envelope_pieces.png) Our first pieces are easy. Biscuit's 3,214 chats in 30 days work out to about 107 a day, and when Wren skims a dozen of those chats, a typical one has about 5 messages from the customer. Our tokens piece needs a quick detour. The AI model behind Biscuit reads and writes text in small chunks called tokens, and our price list charges for each token in and out (Tokens and How They Set Your Bill (https://www.kirupa.com/ai_fundamentals/tokens_and_your_bill.htm) has the details). Here is what one of our messages sends and gets back: [Image: What happens each time a customer sends Biscuit a message. Biscuit's instructions, the chat so far, and the new question go in, about 1,000 tokens at $3 per million. A reply comes back out, about 100 tokens (about 75 words) at $15 per million.] (https://www.kirupa.com/data_and_decisions/images/back_of_the_envelope_one_message.png) Every message re-sends Biscuit's instructions and our customer's chat so far. That's why about 1,000 tokens go in, while only about 100 come out. Here is our napkin with all of its pieces filled in: [Image: The same napkin, now filled in with friendly numbers: 100 chats a day (the real 107 crossed out and rounded), 30 days in a month, 5 messages in a chat, 1,000 tokens in and 100 tokens out for each message, and $3 per million tokens in and $15 per million tokens out. A handwritten note, Round it!, points at the 100. Biscuit's monthly bill is still a question mark.] (https://www.kirupa.com/data_and_decisions/images/back_of_the_envelope_napkin.png) We rounded 107 chats down to 100, because 100 is a number we can multiply in our heads. Our answer will be a few percent less exact, and in exchange, all of our math will fit on a napkin. Multiply, Then Check It Against Something Real With our friendly numbers, multiplying is the easy part: [Image: The napkin math for Biscuit as it runs today. 100 chats times 30 days times 5 messages is 15,000 messages a month. 15,000 messages times 1,000 tokens is 15 million tokens in, which at $3 per million is $45. 15,000 messages times 100 tokens is 1.5 million tokens out, which at $15 per million is $22.50. The total is $67.50, about $70 a month.] (https://www.kirupa.com/data_and_decisions/images/back_of_the_envelope_bill_today.png) That gives us $67.50, or about $70 a month, for Biscuit as it runs today. That's about 2 cents a chat, and each message costs less than half a penny...which is why any one message feels free. It's the 15,000 of them that add up (Cost per Query and Cost per User (https://www.kirupa.com/ai_fundamentals/cost_per_query_and_user.htm) goes deeper on this). Before we trust our napkin, let's check it against something real. Biscuit's first month gives us its actual invoice, $58.20, and its actual chat count, 3,214: [Image: A bar chart comparing our napkin with Biscuit's real first month. Our napkin's bill is $67.50 a month, and the real invoice was $58.20, so the napkin is about 16% high. Our napkin's 3,000 chats compare with 3,214 real chats, about 7% low. A handwritten note says Close enough!] (https://www.kirupa.com/data_and_decisions/images/back_of_the_envelope_sanity_check.png) Our napkin bill is about 16% high, and our chat count is about 7% low. Close enough! A napkin that said $6 or $600 would tell us that one of our pieces was badly wrong. This is the trick we'll lean on next. We calibrate our napkin on a number we can check, like today's bill. Then we change one piece to estimate the thing we can't check yet, like the bill for an idea we haven't built. By the way, for a bill, an average like our 5 messages per chat is exactly the right number to multiply, because we pay for every message however they're spread out (Averages Lie (https://www.kirupa.com/data_and_decisions/averages_lie.htm) covers when an average misleads). What Happens When We Add the Whole Menu? Now we can answer the owner's question. Only one piece on our napkin changes, and it's the tokens in each message. Wren pastes our menu page, allergen notes and all, into a word counter and gets about 12,000 words. At about three-quarters of a word per token, that's about 16,000 tokens: [Image: The whole menu page, with every description and allergen note, is about 12,000 words. At about three-quarters of a word per token, that's about 16,000 tokens. Two bars compare one message. Today, a message sends about 1,000 tokens. With the whole menu, it sends 1,000 plus 16,000 menu tokens, about 17,000 tokens.] (https://www.kirupa.com/data_and_decisions/images/back_of_the_envelope_menu_tokens.png) Each of our messages will now carry about 17,000 tokens instead of 1,000, while the reply stays at about 100. Here is our new bill next to the old one: [Image: A bar chart of the monthly bill. Today: $45 for input tokens plus $22.50 for output tokens, $67.50, about $70. With the whole menu: $765 plus $22.50, $787.50, about $790, roughly 12 times as much. A handwritten note says $720 more a month!] (https://www.kirupa.com/data_and_decisions/images/back_of_the_envelope_bill_menu.png) The whole menu takes our bill from about $70 a month to about $790, or about $720 more a month. That's roughly 12 times today's bill, and a lot more than an "easy win" suggests. How Sure Are We? Give a Range Our chat count comes from real data, and our prices come straight from the price list. The shakiest piece is the 5 messages per chat, since Wren's skim turned up chats with as few as 3 messages and as many as 8. Let's redo our napkin with both: [Image: A ruler of monthly cost from $10 to $10,000, one step per factor of 10. With 3 to 8 messages per chat, today's Biscuit costs about $40 to $110 a month (about $70 at 5 messages), and the whole menu costs about $470 to $1,260 (about $790). The two ranges don't overlap.] (https://www.kirupa.com/data_and_decisions/images/back_of_the_envelope_range.png) Even our lowest guess puts the whole menu at about $470 a month, which is still more than 4 times today's highest guess. Since messages per chat multiplies both napkins the same way, the whole menu will stay about 12 times as expensive however chatty our customers turn out to be. Is It Tens, Hundreds, or Thousands? Notice that we never pinned our bill down to the penny. What we really want to know is which column it lands in: tens of dollars a month, hundreds, or thousands. Each column is 10 times bigger than the one before it, and the column a number lands in is called its order of magnitude. Today's Biscuit sits in the tens, and the whole menu jumps up a column, into the hundreds. Here is where both bills land, and what happens if our whole-menu napkin is off by 2x or by 10x: [Image: A ruler of monthly cost from $1 to $10,000, split into columns: ones, tens, hundreds, and thousands of dollars. Today's Biscuit, about $70, sits in the tens. The whole menu, about $790, sits in the hundreds. Off by 2x, the whole menu would cost $395 to $1,580, still about the same call. Off by 10x, it would be $79 or $7,900, a different column and a different call.] (https://www.kirupa.com/data_and_decisions/images/back_of_the_envelope_magnitude.png) Being off by 2x or even 3x is fine for us. Whether the whole menu costs $395 or $1,580 a month, it's still many times today's bill, and the owner's answer will be about the same. Being off by 10x is what hurts. A $79 bill looks a lot like what we pay today, and a $7,900 bill is a used car every month. Those lead to very different conversations! This is also why we shouldn't trust a number just because it looks precise. Our napkin says the whole menu costs $787.50, and it's tempting to send the owner exactly that: [Image: A gag. A napkin of rough guesses, each with a question mark (about 100 chats a day, about 5 messages a chat, about 12,000 menu words), feeds a crisp receipt that says the whole menu costs exactly $787.50 a month. A face with a monocle admires it, and a handwritten note says To the penny!] (https://www.kirupa.com/data_and_decisions/images/back_of_the_envelope_precision.png) Those 50 cents came from our guesses like "about 5 messages a chat." Telling the owner "about $790, somewhere between $470 and $1,260" is honest about what we really know. Why Do Rough Guesses Work So Well? We are in good company. On July 16, 1945, the physicist Enrico Fermi was about ten miles from the Trinity test, the first atomic bomb explosion. As the blast wave reached him, he dropped small scraps of paper and watched how far the wave pushed them: [Image: On the left, Enrico Fermi drops small pieces of paper from about six feet up as the blast wave from the Trinity test reaches him. The blast pushes the falling scraps about 2.5 meters sideways. On the right, two bars: Fermi's paper-scrap estimate of 10 kilotons of TNT and the official figure of 21 kilotons, about 2 times as much.] (https://www.kirupa.com/data_and_decisions/images/back_of_the_envelope_fermi.png) From that 2½-meter shift, Fermi estimated a blast of about ten thousand tons of TNT (his own account (https://www.atomicarchive.com/resources/documents/trinity/fermi.html) is short). The official figure (https://en.wikipedia.org/wiki/Trinity_(nuclear_test)) is about 21 kilotons, so he was off by about 2x using paper scraps. Fermi also liked to challenge his classes with questions like how many piano tuners work in Chicago. Here is the classic answer, as NASA's Glenn Research Center tells it (https://www.grc.nasa.gov/WWW/K-12/Numbers/Math/Mathematical_Thinking/fermis_piano_tuner.htm): [Image: Fermi's classic estimate of the piano tuners in Chicago. About 3,000,000 people, divided by 4 people per family, is 750,000 families. One family in 5 owns a piano, so that's 150,000 pianos, each tuned about once a year. One tuner handles 4 pianos a day, 5 days a week, 50 weeks a year, or 1,000 a year, so 150,000 divided by 1,000 is about 150 piano tuners. A handwritten note says Not 15 or 1,500!] (https://www.kirupa.com/data_and_decisions/images/back_of_the_envelope_piano_tuners.png) A quick estimate built by multiplying a few guessable pieces like this is called a Fermi estimate, and our napkin for Biscuit is one too. All of the pieces on our napkin are guesses, so why does the answer land close? Some of our guesses come out high and some low, and when we multiply them, those misses partly cancel out: [Image: Two rows of 5 guesses, each one off by a factor of 2. In the top row, every guess is 2 times too high, so the misses pile up: 2x, 4x, 8x, 16x, and finally 32x off. In the bottom row, some guesses are too high and some too low, so the misses cancel out as we go: 2x, 1x, 2x, 1x, and finally 2x off.] (https://www.kirupa.com/data_and_decisions/images/back_of_the_envelope_errors_cancel.png) Five guesses that are each 2x too high multiply into an answer that's 32x too high, while mixed misses land within 2x. What gets us in trouble is a habit that pushes every guess the same way, like rounding everything up to be safe. Numbers Worth Memorizing Napkin math goes faster when a few numbers live in our heads instead of a search box. Here are the ones we'll reach for most: [Image: A card of numbers worth memorizing. 86,400 seconds in a day. About 2.6 million seconds in a 30-day month. One token is about three-quarters of an English word, or about 4 characters. About 150 milliseconds for a packet of data to go from California to the Netherlands and back.] (https://www.kirupa.com/data_and_decisions/images/back_of_the_envelope_cheat_sheet.png) Our token rule of thumb is OpenAI's own guidance (https://help.openai.com/en/articles/4936856-understanding-and-counting-tokens) for English (other languages often take more tokens, as What Is Tokenization? (https://www.kirupa.com/ai_fundamentals/what_is_tokenization.htm) explains). The 150 milliseconds comes from Jeff Dean's slide Numbers Everyone Should Know (https://www.cs.cornell.edu/projects/ladis2009/talks/dean-keynote-ladis2009.pdf), part of a 2009 talk, and Peter Norvig's essay Teach Yourself Programming in Ten Years (https://norvig.com/21-days.html#answers) has a similar table. Right before that list, Dean calls estimating how a design will perform an important skill, done without actually having to build it! Estimating Usage and Latency Too Our napkin works for more than cost. Let's say Wren also wants Biscuit to look up the customer's order on every message. How often would that call our bakery's ordering system? Our 86,400 seconds come in handy: [Image: Napkin math for looking up the customer's order on every message. 100 chats a day times 5 messages is 500 lookups a day. 86,400 seconds in a day divided by 500 is one lookup about every 173 seconds, or about every 3 minutes on average. A 15-minute stretch of the day shows 5 lookups, about 3 minutes apart.] (https://www.kirupa.com/data_and_decisions/images/back_of_the_envelope_usage.png) That's about one lookup every 3 minutes on average, and more during the lunch rush, which gives Wren a number to test our ordering system against. We can estimate the waiting too. In Averages Lie, the replies that called the order-lookup tool took 7.8 to 12.4 seconds, while most replies took about a second. If every message waits on a lookup, a 5-message chat looks like this: [Image: Two timelines for a 5-message chat. Today, most replies take about 1 second, so the whole chat waits about 5 seconds. If every message waits on an order lookup, each reply takes about 10 seconds, so the chat waits about 50 seconds, somewhere from 39 to 62 seconds.] (https://www.kirupa.com/data_and_decisions/images/back_of_the_envelope_latency.png) Our customers would spend about 50 seconds watching Biscuit's typing dots instead of about 5. That's roughly 83 minutes of our customers waiting every day, so Biscuit will only look up an order when someone asks about one. Where Napkin Math Falls Short Our napkin only has the pieces we thought of, and real launches bring surprises that none of them cover: - A slow or failed request gets retried, and we can end up paying for the same message twice. - A few very long chats re-send a bigger and bigger conversation with every message. - Bots and spammers find our chat box, and they never get tired. That's why we compare our range with the real bill a week after launch. If the two are 10x apart, one of our pieces was wrong, and finding it teaches us how people really use our product. Our napkin still did its main job, though. Wren tells the owner that the whole menu would cost about $720 more a month, and suggests a cheaper design where Biscuit looks up only the menu items a question mentions: [Image: A smarter design in three steps. A customer asks, Does the pecan pie have nuts? Biscuit looks up just the pecan pie in the menu. The message it sends is about 1,000 tokens plus that one menu item, instead of 17,000 tokens with the whole menu.] (https://www.kirupa.com/data_and_decisions/images/back_of_the_envelope_fetch_only.png) If the whole menu really must ride along, prompt caching (https://www.kirupa.com/ai_fundamentals/prompt_caching.htm) bills the repeated text at the start of each message at a reduced rate, and we can run a second napkin to see if that's enough. Try It This Week Pick a feature you're about to build, set a five-minute timer, and fill in a napkin of your own: 1. Write down the one number you want, like dollars a month, calls a day, or seconds of waiting. 2. Break it into four or five pieces you can look up or guess, and round each one to a friendly number. 3. Multiply, then check one piece against something real, like last month's traffic. 4. Redo it with a low and a high guess for your shakiest piece, and write the answer as a range. 5. A week after launch, compare your range with the real numbers. Frequently Asked Questions What Is a Back-of-the-Envelope Calculation? It’s a quick, rough estimate that breaks a big unknown into small pieces we can look up or guess, rounds them to friendly numbers, and multiplies them. The goal is an answer that’s good enough to make a decision in about five minutes. We then check one piece against something real and give a low-to-high range. What Is a Fermi Estimate? A Fermi estimate is a quick estimate built by multiplying a few guessable pieces, named after the physicist Enrico Fermi. At the 1945 Trinity test, he estimated the blast at about ten thousand tons of TNT from how far it pushed falling scraps of paper, and the official figure is about 21 kilotons. He also liked to challenge his classes with questions like how many piano tuners work in Chicago. What Does Order of Magnitude Mean? A number’s order of magnitude is the column it lands in, like tens, hundreds, or thousands, where each column is 10 times bigger than the one before it. For an estimate, landing in the right column matters most. Being off by 2x rarely changes a decision, while being off by 10x usually does. How Do You Estimate the Monthly Cost of an AI Feature? Multiply the chats a day, the days in a month, the messages in a chat, the tokens in each message, and the price per million tokens. For Biscuit, 100 chats a day, 30 days, 5 messages, 1,000 tokens in and 100 out, at $3 and $15 per million tokens, comes to about $70 a month, close to its real $58.20 invoice. Then change one piece to estimate the idea we can’t check yet, and redo the shakiest piece low and high to get a range. Conclusion Alright, let's wrap things up. The owner asked what the whole menu would cost, and five minutes on a napkin answered it: about $790 a month instead of about $70. A back-of-the-envelope estimate works because we break a big unknown into pieces we can guess, round them, multiply, and check the result against something real. We are aiming for the right order of magnitude, since being 2x off rarely changes a decision and being 10x off almost always does. Speaking of numbers that deserve a second look, Biscuit's report also says that customers who chat spend 41% more. Does chatting make people spend more? We'll find out next in Correlation vs. Causation (https://www.kirupa.com/data_and_decisions/correlation_vs_causation.htm). Before you go, here are a few things you can do: 1. Read the next article in the series, Correlation vs. Causation (https://www.kirupa.com/data_and_decisions/correlation_vs_causation.htm), or check out some related content: - Appetite and Scope Cutting (https://www.kirupa.com/product_thinking/appetite_and_scope.htm). Deciding how much time a feature is worth before anyone designs or builds it. - Prioritization Frameworks and Their Limits (https://www.kirupa.com/product_thinking/prioritization_frameworks.htm). Ranking feature ideas with RICE and cost of delay, and spotting when exact-looking scores fool us. - Cost per Query and Cost per User (https://www.kirupa.com/ai_fundamentals/cost_per_query_and_user.htm). Turning token prices into a cost per question and a cost per user. 2. Stuck on something, or curious about a detail we skipped? Ask on the forums (https://forum.kirupa.com/), and we’ll help you out. [Mastery Quiz] Test your knowledge! Take the Back-of-the-Envelope Estimates Quiz: https://www.kirupa.com/quizzes/back_of_the_envelope.htm Practice with 6 multiple-choice questions and an explanation after every answer. [/Mastery Quiz]