<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:media="http://search.yahoo.com/mrss/"><channel><title><![CDATA[Kamil Nicieja · Before Growth]]></title><description><![CDATA[When the best startups go mainstream, it’s often too late. The secret is to scout below the radar.]]></description><link>https://kamil.fyi/</link><image><url>https://kamil.fyi/favicon.png</url><title>Kamil Nicieja · Before Growth</title><link>https://kamil.fyi/</link></image><generator>Ghost 5.75</generator><lastBuildDate>Mon, 20 Apr 2026 14:04:17 GMT</lastBuildDate><atom:link href="https://kamil.fyi/blog/rss/" rel="self" type="application/rss+xml"/><ttl>60</ttl><item><title><![CDATA[Introducing Lammy]]></title><description><![CDATA[An LLM library for Ruby]]></description><link>https://kamil.fyi/introducing-lammy/</link><guid isPermaLink="false">6707754cd38d8a001dac588f</guid><category><![CDATA[Engineering]]></category><dc:creator><![CDATA[Kamil Nicieja]]></dc:creator><pubDate>Thu, 10 Oct 2024 18:03:57 GMT</pubDate><media:content url="https://kamil.fyi/content/images/2024/10/39f4cbdc8cad4296902199e617122ad6.jpeg" medium="image"/><content:encoded><![CDATA[<img src="https://kamil.fyi/content/images/2024/10/39f4cbdc8cad4296902199e617122ad6.jpeg" alt="Introducing Lammy"><p>I apologize if this is more technical than what you&#x2019;re here for, but it&#x2019;s what I&#x2019;ve been focused on lately, and I wanted to share.</p><p><a href="https://github.com/nicieja/lammy?ref=kamil.fyi">Lammy</a> is a simple LLM library for Ruby I wrote over the last few weeks. It doesn&#x2019;t treat prompts as just strings. They represent the entire code that generates the strings sent to a LLM. The abstraction also makes it easy to attach these methods directly to models, avoiding the need for boilerplate service code.</p><p>The approach is inspired by&#xA0;<a href="https://github.com/MadcowD/ell?ref=kamil.fyi">Python&#x2019;s ell</a>. I haven&apos;t come across a Ruby port yet, so I decided to start experimenting on my own.</p><h2 id="why">Why?</h2><p>I wanted to create a simple library that would let me use LLMs in my Ruby projects without dealing with a lot of boilerplate code.</p><p>Using something like&#xA0;Langchain&#xA0;felt too complex for many of my needs. Another option would be to integrate a library directly with a framework like Ruby on Rails, leveraging its conventions. You could, for example, store prompts in the database or as views. But that seemed like overkill for what I needed, and it would add a dependency on the framework, making it harder to use in simple programs.</p><p>Personally, I don&#x2019;t think prompt engineering needs to be that complicated, which is why the&#xA0;ell approach&#x2014;treating prompts like simple functions&#x2014;really resonated with me. I wanted to bring something similar to Ruby. I don&#x2019;t see why LLMs can&#x2019;t be treated like databases in Active Record, where all the complexity is abstracted away. You can query without needing to think much about the underlying SQL. With Lammy, the idea is similar: you just define your prompt in a method on a model and call it like any other method.</p><h2 id="installation">Installation</h2><h3 id="bundler">Bundler</h3><p>Add this line to your application&#x2019;s Gemfile:</p><pre><code>gem &quot;lammy&quot;</code></pre><p>And then execute:</p><pre><code>$ bundle install</code></pre><p>You can find a basic example of how to use Lammy in Rails in the&#xA0;<a href="https://github.com/nicieja/lammy-rails-example?ref=kamil.fyi">lammy-rails-example</a>&#xA0;repository.</p><h3 id="gem-install">Gem install</h3><p>Or install with:</p><pre><code>$ gem install lammy</code></pre><p>and require with:</p><pre><code>require &quot;lammy&quot;</code></pre><h2 id="usage">Usage</h2><p>Lammy currently supports OpenAI&#x2019;s models and Anthropic&#x2019;s Claude. You can use any model that supports the OpenAI API or Claude. Make sure to set the&#xA0;<code>OPENAI_API_KEY</code>&#xA0;environment variable for OpenAI models or the&#xA0;<code>ANTHROPIC_API_KEY</code>&#xA0;for Claude models.</p><h3 id="chat">Chat</h3><p>Lammy allows you to interact with a chat model using the&#xA0;<code>llm</code>&#xA0;decorator. The&#xA0;<code>llm</code>&#xA0;decorator accepts a&#xA0;<code>model</code>argument, where you specify the name of the model you&#x2019;d like to use.</p><pre><code class="language-ruby">class User
  # To be able to make LLM calls, we first include `L` at the top of our class
  include L

  attr_reader :name

  def initialize(name:)
    @name = name
  end

  # Take a message as input and return a model-generated message as output
  llm(model: &quot;gpt-4o&quot;)
  def welcome
    # User message goes here
    &quot;Say hello to #{name.reverse} with a poem.&quot;
  end
end

user = User.new(name: &quot;John Doe&quot;)
user.welcome

# =&gt; &quot;Hello eoD nhoJ, let&apos;s make a cheer,\n
# With a whimsical poem to bring you near.\n
# Though your name&apos;s in reverse, it&#x2019;s clear and bright,\n
# Let&apos;s dance in verse on this delightful night!&quot;</code></pre><h3 id="system-message">System message</h3><p>You can provide a system message to the model through the&#xA0;<code>context</code>&#xA0;method. This is an optional approach that allows you to give the model additional context. I chose not to use the&#xA0;<code>system</code>&#xA0;method because it&#x2019;s a potentially risky Ruby method.</p><pre><code class="language-ruby">class User
  include L

  # (...)

  llm(model: &quot;gpt-4o&quot;)
  def welcome
    # An optional system message
    context &quot;You are an AI that only writes in lower case.&quot;
    # User message goes here
    &quot;Say hello to #{name.reverse} with a poem.&quot;
  end
end

user = User.new(name: &quot;John Doe&quot;)
user.welcome

# =&gt; &quot;hello eod nhoj, let&apos;s make a cheer,\n
# with a whimsical poem to bring you near.\n
# though your name&apos;s in reverse, it&#x2019;s clear and bright,\n
# let&apos;s dance in verse on this delightful night!&quot;</code></pre><h3 id="structured-output-for-openai%E2%80%99s-models">Structured output for OpenAI&#x2019;s models</h3><p>You can request OpenAI&#x2019;s models to return a structured JSON output by using the&#xA0;<code>schema</code>&#xA0;option in the decorator. This is an optional feature that allows you to define a structured output format for the model. To handle arrays of objects, use&#xA0;<code>L.to_a</code>, and for a single object, use&#xA0;<code>L.to_h</code>.</p><pre><code class="language-ruby">class User
  include L

  # (...)

  # Define a structured output schema for Lammy to handle JSON responses.
  # For a single object instead of an array, use `L.to_h`.
  llm(model: &quot;gpt-4o-2024-08-06&quot;, schema: L.to_a(name: :string, city: :string))
  def friends
    &quot;Hallucinate a list of friends for #{name}.&quot;
  end
end

user = User.new(name: &quot;John Doe&quot;)
user.friends

# =&gt; [{&quot;name&quot;=&gt;&quot;Alice Summers&quot;, &quot;city&quot;=&gt;&quot;Austin&quot;},
#   {&quot;name&quot;=&gt;&quot;Brian Thompson&quot;, &quot;city&quot;=&gt;&quot;Denver&quot;},
#   {&quot;name&quot;=&gt;&quot;Charlie Herrera&quot;, &quot;city&quot;=&gt;&quot;Seattle&quot;},
#   {&quot;name&quot;=&gt;&quot;Diana Flores&quot;, &quot;city&quot;=&gt;&quot;San Francisco&quot;},
#   {&quot;name&quot;=&gt;&quot;Eli Grant&quot;, &quot;city&quot;=&gt;&quot;New York&quot;},
#   {&quot;name&quot;=&gt;&quot;Fiona Collins&quot;, &quot;city&quot;=&gt;&quot;Chicago&quot;},
#   {&quot;name&quot;=&gt;&quot;George Baker&quot;, &quot;city&quot;=&gt;&quot;Los Angeles&quot;},
#   {&quot;name&quot;=&gt;&quot;Hannah Kim&quot;, &quot;city&quot;=&gt;&quot;Miami&quot;},
#   {&quot;name&quot;=&gt;&quot;Isaac Chen&quot;, &quot;city&quot;=&gt;&quot;Boston&quot;},
#   {&quot;name&quot;=&gt;&quot;Jessica Patel&quot;, &quot;city&quot;=&gt;&quot;Houston&quot;}]</code></pre><h3 id="prefilling-assistant-responses-for-claude">Prefilling assistant responses for Claude</h3><p>Anthtopic decided to improve output consistency and implement JSON mode by allowing users to prefill the model&#x2019;s response. Lammy enables this feature through its array syntax, along with the&#xA0;<code>L.user</code>&#xA0;and&#xA0;<code>L.system</code> helper methods.</p><pre><code class="language-ruby">class User
  include L

  # (...)

  llm(model: &quot;claude-3-5-sonnet-20240620&quot;)
  def welcome
    # Provide a list of messages to the model for back-and-forth conversation
    [
      # User message goes here
      L.user(&quot;Say hello to #{name.reverse} with a poem.&quot;),
      # When using Claude, you have the ability to guide its responses by prefilling it
      L.assistant(&quot;Here&apos;s a little poem for you:&quot;)
    ]
  end
end</code></pre><p>Although only Claude models prefill responses, the array syntax can be applied to both OpenAI and Claude models. For OpenAI&#x2019;s models, this feature is used to continue the conversation from where the previous message left off, enabling multi-message conversations like the one in our upcoming example.</p><h3 id="streaming">Streaming</h3><p>You can use the&#xA0;<code>stream</code>&#xA0;method to stream responses from the LLM in real time, which can be much faster and help create a more engaging user experience. To receive chunks of the response as they come in, pass a lambda to the&#xA0;<code>stream</code>&#xA0;method.</p><pre><code class="language-ruby">class Bot
  include L

  llm(model: &quot;gpt-4o&quot;)
  def talk(message)
    # Use the `stream` method to stream chunks of the response.
    # In this case, we&apos;re just printing the chunks.
    stream -&gt;(content) { puts content }
    # Nothing fancy, simply transfer the message to the model
    message
  end
end

bot = Bot.new
bot.talk(&quot;Hello, how are you?&quot;)

# =&gt; &quot;I&apos;m here and ready to help. How can I assist you today?&quot;</code></pre><p>This is a simplified explanation of how you can use the&#xA0;<code>stream</code>&#xA0;method. For a complete example, refer to&#xA0;<a href="https://github.com/nicieja/lammy/blob/main/examples/streaming.rb?ref=kamil.fyi">this file</a>. This implementation allows to hold an actual conversation with the model, which is the most common use case for chatbots, and does it using Lammy&#x2019;s array syntax.</p><h3 id="vision">Vision</h3><p>You can use a vision model to generate a description of an image this way:</p><pre><code class="language-ruby">class Image
  include L

  attr_accessor :file

  llm(model: &quot;gpt-4o&quot;)
  def describe
    L.user(&quot;Describe this image.&quot;, image: file)
  end
end

image = Image.new
image.file = File.read(&quot;./examples/assets/ruby.jpg&quot;)
image.describe

# =&gt; &quot;The image is an illustration of a red gem, specifically a ruby.
# The gem is depicted with facets that reflect light, giving it a shiny
# and polished appearance. This image is often associated with
# the Ruby programming language logo.&quot;</code></pre><p>The&#xA0;<code>L.user</code>&#xA0;helper method must be used to attach the image to the prompt.</p><h3 id="custom-clients">Custom clients</h3><p>For a more robust setup, you can configure the client directly and pass it to the decorator.</p><pre><code class="language-ruby"># Helicone is an open-source LLM observability platform for developers
# to monitor, debug, and optimize their apps
$helicone = OpenAI::Client.new(
  access_token: &quot;access_token_goes_here&quot;,
  uri_base: &quot;https://oai.hconeai.com/&quot;,
  request_timeout: 240,
  extra_headers: {
    &quot;X-Proxy-TTL&quot; =&gt; &quot;43200&quot;,
    &quot;X-Proxy-Refresh&quot;: &quot;true&quot;,
    &quot;Helicone-Auth&quot;: &quot;Bearer HELICONE_API_KEY&quot;,
    &quot;helicone-stream-force-format&quot; =&gt; &quot;true&quot;,
  }
)

class User
  include L

  # (...)

  # Pass the Helicone client to Lammy&apos;s decorator
  llm(model: &quot;gpt-4o&quot;, client: $helicone)
  def description
    &quot;Describe #{name} in a few sentences.&quot;
  end
end</code></pre><h3 id="embeddings">Embeddings</h3><p>You can use the embeddings endpoint to obtain a vector of numbers that represents an input. These vectors can be compared across different inputs to efficiently determine their similarity. Currently, Lammy supports only OpenAI&#x2019;s embeddings endpoint.</p><pre><code class="language-ruby">class User
  include L

  # (...)

  # Text embeddings measure the relatedness of text strings. The response
  # will contain a list of floating point numbers, which you can extract,
  # save in a vector database, and use for many different use cases.
  v(model: &quot;text-embedding-3-large&quot;, dimensions: 256)
  def embeddings
    %Q{
      Hi, I&apos;m #{name}. I&apos;m a software engineer with a passion for Ruby
      and open-source development.
    }
  end
end

user = User.new(name: &quot;John Doe&quot;)
user.embeddings

# =&gt; [0.123, -0.456, 0.789, ...]
# This will be the embedding vector returned by the model</code></pre><p>Now you&#x2019;re able to store this vector in a vector database, such as&#xA0;<code>pgvector</code>, and use it to compare the similarity of different inputs. For example, you can use the&#xA0;<a href="https://en.wikipedia.org/wiki/Cosine_similarity?ref=kamil.fyi" rel="nofollow">cosine similarity</a>&#xA0;to determine the similarity between two vectors. More work with embeddings is on the way, as this is just a basic implementation. I wanted to start small so I can build and expand later.</p><h2 id="license">License</h2><p>Lammy is open source and released under the MIT License.</p>]]></content:encoded></item><item><title><![CDATA[From Zero to Product with Generative AI]]></title><description><![CDATA[My new ebook offers case studies and just enough theory for you to build your next app with gen AI.]]></description><link>https://kamil.fyi/from-zero-to-product-with-generative-ai/</link><guid isPermaLink="false">66e1c185d38d8a001dac4cdd</guid><category><![CDATA[Projects]]></category><dc:creator><![CDATA[Kamil Nicieja]]></dc:creator><pubDate>Wed, 11 Sep 2024 16:46:41 GMT</pubDate><media:content url="https://kamil.fyi/content/images/2024/09/a-well-worn-leather-journal-open-to-a-fresh-page-filled-with-neat-flowing-cursive-awaiting-the-next-710721383.jpeg" medium="image"/><content:encoded><![CDATA[<div class="kg-card kg-callout-card kg-callout-card-blue"><div class="kg-callout-emoji">&#x1F989;</div><div class="kg-callout-text"><a href="https://kamil.fyi/" rel="noreferrer"><i><b><strong class="italic" style="white-space: pre-wrap;">Before Growth</strong></b></i></a> is a newsletter about startups before product&#x2013;market fit by 3x founder and programmer Kamil Nicieja.</div></div><img src="https://kamil.fyi/content/images/2024/09/a-well-worn-leather-journal-open-to-a-fresh-page-filled-with-neat-flowing-cursive-awaiting-the-next-710721383.jpeg" alt="From Zero to Product with Generative AI"><p>As I&#x2019;ve mentioned before, I&#x2019;ve been working on an ebook, and now it&#x2019;s finally finished! It&#x2019;s about 107 pages long and focuses on how today&#x2019;s builders are developing apps using LLMs and other AI models. The content is a blend of technology and business&#x2014;it&#x2019;s not highly technical, as it centers around case studies and products, but it also dives into some implementation details. I think people in the startup world will like it. I had previewed parts of it on my blog, but now it&#x2019;s fully done and available online for everyone to read.</p><div class="kg-card kg-callout-card kg-callout-card-green"><div class="kg-callout-emoji">&#x1F4D6;</div><div class="kg-callout-text"><a href="https://read.kamil.fyi/2/from-zero-to-product-with-generative-ai?ref=kamil.fyi"><b><strong style="white-space: pre-wrap;">Read it here.</strong></b></a></div></div><p>It includes case studies on AI products and companies like Sweep, Playground, Nibble, Czat.ai, ChatGPT (of course), Fin, Strut, Meta Smart Glasses, Rewind, Humane, Rabbit, Character, and more. If you read it and would like to be featured, feel free to reach out. I&#x2019;m open to expanding the content.</p><h2 id="about-the-book">About the book&#xA0;</h2><p>In most industries, I&#x2019;d be considered middle-aged or even young by some standards, having just passed 30. However, in tech&#x2014;I&#x2019;m old. (Can&#x2019;t imagine how people who remember the dot-com bubble must feel.) This means I experienced the earlier wave of AI firsthand, which eventually became known as machine learning. I witnessed attempts to create products similar to ChatGPT using technology that we now recognize as a dead end. Archaic.</p><p>But it also means I&#x2019;m uniquely equipped for this new generative age. Many topics that are new to those who recently discovered the benefits and challenges of, say, chatbots are familiar to me. I learned them the hard way. In 2015, I tried to build a company around this technology. But it was too early, and we failed. Now, I read the same pitches I once made on the landing pages of others and think,&#xA0;<em>what if.</em></p><p>Thankfully, every failure brings gifts too, known as experience. The goal of this book is to share that experience with you, my reader, and equip you with the skills to:</p><ul><li>Grasp the fundamentals of generative AI based on practical case studies with just the right amount of theory</li><li>Incorporate gen AI methods into your product design efforts</li><li>Create new applications, ventures, and startups using generative AI technologies such as OpenAI&#x2019;s GPT-4, DALL-E, or open-source alternatives like Llama and Stable Diffusion</li><li>Hone your ability to effectively prompt these models</li><li>Navigate the complete journey of crafting products powered by generative AI, from budget allocation and design to selecting between in-house and third-party solutions, and then to building prototypes</li></ul><p>The book discusses various industries that could be transformed by generative AI, providing case studies to explain these impacts. It also explores both real and hypothetical examples of products to show how this emerging technology is reshaping the way the tech industry approaches the design, prototyping, and implementation of apps, services, and experiences.</p><h2 id="who-should-read-it">Who should read it</h2><p>This book is intended for intermediate-level readers eager to apply generative AI models, particularly in the realm of new product development. When I refer to &#x201C;product design,&#x201D; I&#x2019;m talking about more than just the user experience or user interface. I mean the comprehensive, high-level process of developing a product from start to finish. Keep in mind: design isn&#x2019;t just what something looks and feels like&#x2014;the design is how it&#xA0;<em>works.</em></p><p>While this book is technical in nature, coding skills aren&#x2019;t a prerequisite for grasping its content. It&#x2019;s tailored for professionals&#x2014;be they engineers, designers, project managers, executives, or founders&#x2014;who have already brought products to market and are now seeking an introductory guide to integrating generative AI into their process.</p><p>Instead of focusing too much on technical challenges, this book maintains a high-level perspective. This approach allows non-engineers to understand how they can meaningfully contribute to their team&#x2019;s AI initiatives without necessarily running code themselves. For those with technical expertise, the book offers insights into practical applications of their deep knowledge of AI model internals, especially when it comes to developing and launching new applications.</p><p>If you&#x2019;re not familiar with the core terminology of modern artificial intelligence&#x2014;concepts such as models, prompts, training, tokens, and hallucination, to name a few&#x2014;this book will provide some foundational understanding. However, we won&#x2019;t dwell on these terms excessively. If you find you need a deeper dive into such topics, it would be beneficial to consult additional resources before returning to this book.</p><div class="kg-card kg-callout-card kg-callout-card-green"><div class="kg-callout-emoji">&#x1F4D6;</div><div class="kg-callout-text"><a href="https://read.kamil.fyi/2/from-zero-to-product-with-generative-ai?ref=kamil.fyi"><b><strong style="white-space: pre-wrap;">Get &#x201C;From Zero to Product with Generative AI&#x201D; here.</strong></b></a></div></div><hr><p>&#x1F4E3;&#xA0;<strong>Before Growth has grown through word of mouth.</strong> Want to help? Share it&#xA0;on Twitter&#xA0;<a href="https://twitter.com/intent/tweet?url=https%3A%2F%2Fkamil.fyi&amp;text=Love+this+newsletter+about+early-stage+projects.+Hand-picked+startup+intel+that%E2%80%99ll+put+you+ahead+of+the+curve%2C+straight+from+one+founder+to+another.+Check+it+out%21&amp;ref=kamil.fyi" rel="noreferrer">here,</a> Facebook&#xA0;<a href="https://facebook.com/sharer/sharer.php?u=https://kamil.fyi" rel="noreferrer">here,</a> or LinkedIn <a href="https://linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fkamil.fyi&amp;ref=kamil.fyi" rel="noreferrer">here</a>.</p><div class="kg-card kg-callout-card kg-callout-card-blue"><div class="kg-callout-emoji">&#x1F4EC;</div><div class="kg-callout-text">Did a friend forward this to you? <a href="https://kamil.fyi/#/portal/signup" rel="noreferrer">Subscribe</a> now to get the latest updates delivered straight to your inbox every week.</div></div>]]></content:encoded></item><item><title><![CDATA[Flavors of Ruby on Rails Architectures]]></title><description><![CDATA[I gave this talk at the SF Bay Area Ruby meetup on Sep 3rd, 2024, at GitHub HQ in San Francisco.]]></description><link>https://kamil.fyi/flavors-of-ruby-on-rails-architectures/</link><guid isPermaLink="false">66d26458d38d8a001dac3b86</guid><category><![CDATA[Talks]]></category><category><![CDATA[Engineering]]></category><dc:creator><![CDATA[Kamil Nicieja]]></dc:creator><pubDate>Wed, 04 Sep 2024 07:12:20 GMT</pubDate><media:content url="https://kamil.fyi/content/images/2024/09/an-engaging-public-speaker-passionately-delivering-a-persuasive-speech-standing-on-a-raised-wooden--653168541.jpeg" medium="image"/><content:encoded><![CDATA[<div class="kg-card kg-callout-card kg-callout-card-blue"><div class="kg-callout-emoji">&#x1F989;</div><div class="kg-callout-text">I gave this talk at the SF Bay Area Ruby meetup on September 3rd, 2024, at GitHub HQ in San Francisco. <a href="https://drive.google.com/file/d/1QVyEPMu5oyfuDMafl5E8IsD3YI_Bw9Wh/view?usp=sharing&amp;ref=kamil.fyi">You can download it here.</a></div></div><figure class="kg-card kg-image-card kg-width-full"><img src="https://kamil.fyi/content/images/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_1.jpg" class="kg-image" alt="Flavors of Ruby on Rails Architectures" loading="lazy" width="1024" height="576" srcset="https://kamil.fyi/content/images/size/w600/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_1.jpg 600w, https://kamil.fyi/content/images/size/w1000/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_1.jpg 1000w, https://kamil.fyi/content/images/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_1.jpg 1024w"></figure><img src="https://kamil.fyi/content/images/2024/09/an-engaging-public-speaker-passionately-delivering-a-persuasive-speech-standing-on-a-raised-wooden--653168541.jpeg" alt="Flavors of Ruby on Rails Architectures"><p>Hi, I&#x2019;m Kamil Nicieja, and today I&#x2019;ll be discussing the various types of Ruby on Rails architectures.</p><figure class="kg-card kg-image-card kg-width-full"><img src="https://kamil.fyi/content/images/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_2.jpg" class="kg-image" alt="Flavors of Ruby on Rails Architectures" loading="lazy" width="1024" height="576" srcset="https://kamil.fyi/content/images/size/w600/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_2.jpg 600w, https://kamil.fyi/content/images/size/w1000/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_2.jpg 1000w, https://kamil.fyi/content/images/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_2.jpg 1024w"></figure><p>But first, let me share a bit about myself. I&#x2019;m currently the lead software engineer at Plane, a Y Combinator startup. In the past, I&#x2019;ve co-founded a few startups myself and authored books on testing and product management. I recently moved to San Francisco, just two months ago, so I wanted to say hello and ask&#x2014;what&#x2019;s the preferred flavor of Rails around here?</p><figure class="kg-card kg-image-card kg-width-full"><img src="https://kamil.fyi/content/images/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_3.jpg" class="kg-image" alt="Flavors of Ruby on Rails Architectures" loading="lazy" width="1024" height="576" srcset="https://kamil.fyi/content/images/size/w600/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_3.jpg 600w, https://kamil.fyi/content/images/size/w1000/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_3.jpg 1000w, https://kamil.fyi/content/images/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_3.jpg 1024w"></figure><p>Let&apos;s start with vanilla Rails, the starting point for most developers.</p><figure class="kg-card kg-image-card kg-width-full"><img src="https://kamil.fyi/content/images/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_4.jpg" class="kg-image" alt="Flavors of Ruby on Rails Architectures" loading="lazy" width="1024" height="576" srcset="https://kamil.fyi/content/images/size/w600/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_4.jpg 600w, https://kamil.fyi/content/images/size/w1000/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_4.jpg 1000w, https://kamil.fyi/content/images/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_4.jpg 1024w"></figure><p>This part will be pretty straightforward, but it&#x2019;s important to set a baseline. We have a model, some concerns, callbacks&#x2014;the usual components that everyone is familiar with because it&#x2019;s the Rails way, taught to most of us when we&#x2019;re just starting out.</p><figure class="kg-card kg-image-card kg-width-full"><img src="https://kamil.fyi/content/images/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_5.jpg" class="kg-image" alt="Flavors of Ruby on Rails Architectures" loading="lazy" width="1024" height="576" srcset="https://kamil.fyi/content/images/size/w600/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_5.jpg 600w, https://kamil.fyi/content/images/size/w1000/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_5.jpg 1000w, https://kamil.fyi/content/images/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_5.jpg 1024w"></figure><p>In vanilla Rails, the models are often &#x201C;rich,&#x201D; meaning they contain a lot of code. To manage this, much of the code is typically extracted into concerns. For example, you can see a straightforward part of a model moved into a role concern.</p><figure class="kg-card kg-image-card kg-width-full"><img src="https://kamil.fyi/content/images/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_6.jpg" class="kg-image" alt="Flavors of Ruby on Rails Architectures" loading="lazy" width="1024" height="576" srcset="https://kamil.fyi/content/images/size/w600/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_6.jpg 600w, https://kamil.fyi/content/images/size/w1000/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_6.jpg 1000w, https://kamil.fyi/content/images/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_6.jpg 1024w"></figure><p>Here&#x2019;s a more complex example. Since we&#x2019;re at GitHub HQ, I thought this would be a fitting choice. In this example, we have a Repository model with a Pull concern that allows you to fetch git repositories from the API, along with the commits. This shows that it&#x2019;s not just simple tasks that can be handled with this approach&#x2014;pretty much anything can be managed this way.</p><figure class="kg-card kg-image-card kg-width-full"><img src="https://kamil.fyi/content/images/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_7.jpg" class="kg-image" alt="Flavors of Ruby on Rails Architectures" loading="lazy" width="1024" height="576" srcset="https://kamil.fyi/content/images/size/w600/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_7.jpg 600w, https://kamil.fyi/content/images/size/w1000/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_7.jpg 1000w, https://kamil.fyi/content/images/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_7.jpg 1024w"></figure><p>Now, with this approach, we might encounter a problem: what if we have some code that interacts with multiple models but doesn&#x2019;t naturally fit into any of them? 37signals addresses this by placing such transaction scripts into separate domain concepts and treating them as models as well. This way, it becomes another noun in the ubiquitous language of the domain.</p><figure class="kg-card kg-image-card kg-width-full"><img src="https://kamil.fyi/content/images/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_8.jpg" class="kg-image" alt="Flavors of Ruby on Rails Architectures" loading="lazy" width="1024" height="576" srcset="https://kamil.fyi/content/images/size/w600/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_8.jpg 600w, https://kamil.fyi/content/images/size/w1000/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_8.jpg 1000w, https://kamil.fyi/content/images/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_8.jpg 1024w"></figure><p>The biggest benefit of this approach is that it&#x2019;s fully supported out of the box and is part of Rails&#x2019; well-known magic: it just works.</p><figure class="kg-card kg-image-card kg-width-full"><img src="https://kamil.fyi/content/images/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_9.jpg" class="kg-image" alt="Flavors of Ruby on Rails Architectures" loading="lazy" width="1024" height="576" srcset="https://kamil.fyi/content/images/size/w600/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_9.jpg 600w, https://kamil.fyi/content/images/size/w1000/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_9.jpg 1000w, https://kamil.fyi/content/images/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_9.jpg 1024w"></figure><p>Let&#x2019;s move on to the second approach. I briefly mentioned it earlier when I talked about transaction scripts. This approach builds on that concept, and I like to call it service-oriented Rails.</p><figure class="kg-card kg-image-card kg-width-full"><img src="https://kamil.fyi/content/images/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_10.jpg" class="kg-image" alt="Flavors of Ruby on Rails Architectures" loading="lazy" width="1024" height="576" srcset="https://kamil.fyi/content/images/size/w600/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_10.jpg 600w, https://kamil.fyi/content/images/size/w1000/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_10.jpg 1000w, https://kamil.fyi/content/images/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_10.jpg 1024w"></figure><p>When working with vanilla Rails, some developers find that the standard approach tends to overload the models with too much code. To address this, they look for clearer, more refined abstractions, leading them to start experimenting with different approaches.</p><figure class="kg-card kg-image-card kg-width-full"><img src="https://kamil.fyi/content/images/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_11.jpg" class="kg-image" alt="Flavors of Ruby on Rails Architectures" loading="lazy" width="1024" height="576" srcset="https://kamil.fyi/content/images/size/w600/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_11.jpg 600w, https://kamil.fyi/content/images/size/w1000/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_11.jpg 1000w, https://kamil.fyi/content/images/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_11.jpg 1024w"></figure><p>They likely end up with something like this: services, form objects, view components, and representers for handling views and APIs.</p><figure class="kg-card kg-image-card kg-width-full"><img src="https://kamil.fyi/content/images/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_12.jpg" class="kg-image" alt="Flavors of Ruby on Rails Architectures" loading="lazy" width="1024" height="576" srcset="https://kamil.fyi/content/images/size/w600/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_12.jpg 600w, https://kamil.fyi/content/images/size/w1000/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_12.jpg 1000w, https://kamil.fyi/content/images/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_12.jpg 1024w"></figure><p>This is actually the approach we&#x2019;re currently using at Plane, and we&#x2019;ve even developed our own custom library to support our specific needs. I&#x2019;m going to give you a quick look at it. Unfortunately, it&#x2019;s not open source, but if you&#x2019;re interested in this kind of approach, there are similar options available, like the <a href="https://trailblazer.to/2.1/?ref=kamil.fyi" rel="noreferrer">Trailblazer</a> framework or the <a href="https://dry-rb.org/?ref=kamil.fyi" rel="noreferrer">dry-rb</a> stack.</p><figure class="kg-card kg-image-card kg-width-full"><img src="https://kamil.fyi/content/images/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_13.jpg" class="kg-image" alt="Flavors of Ruby on Rails Architectures" loading="lazy" width="1024" height="576" srcset="https://kamil.fyi/content/images/size/w600/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_13.jpg 600w, https://kamil.fyi/content/images/size/w1000/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_13.jpg 1000w, https://kamil.fyi/content/images/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_13.jpg 1024w"></figure><p>Let&#x2019;s start from the basics. We define a simple service object, which we refer to as an &#x201C;operation.&quot;</p><figure class="kg-card kg-image-card kg-width-full"><img src="https://kamil.fyi/content/images/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_14.jpg" class="kg-image" alt="Flavors of Ruby on Rails Architectures" loading="lazy" width="1024" height="576" srcset="https://kamil.fyi/content/images/size/w600/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_14.jpg 600w, https://kamil.fyi/content/images/size/w1000/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_14.jpg 1000w, https://kamil.fyi/content/images/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_14.jpg 1024w"></figure><p>At Plane, we typically wrap all our operations in transactions and manage side effects using <code>after_commit</code> blocks. In this example, I&#x2019;ve explicitly made the operation transactional to demonstrate how it works. If I wanted to create a non-transactional operation, such as one that interacts with an external API, I would simply set <code>transactional</code> to <code>false</code>.</p><figure class="kg-card kg-image-card kg-width-full"><img src="https://kamil.fyi/content/images/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_15.jpg" class="kg-image" alt="Flavors of Ruby on Rails Architectures" loading="lazy" width="1024" height="576" srcset="https://kamil.fyi/content/images/size/w600/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_15.jpg 600w, https://kamil.fyi/content/images/size/w1000/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_15.jpg 1000w, https://kamil.fyi/content/images/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_15.jpg 1024w"></figure><p>All operations can be called asynchronously by simply adding the <code>async</code> prefix to the chain. This feature is quite useful, as it helps you avoid the boilerplate code associated with background jobs that only exist to call other service objects.</p><figure class="kg-card kg-image-card kg-width-full"><img src="https://kamil.fyi/content/images/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_16.jpg" class="kg-image" alt="Flavors of Ruby on Rails Architectures" loading="lazy" width="1024" height="576" srcset="https://kamil.fyi/content/images/size/w600/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_16.jpg 600w, https://kamil.fyi/content/images/size/w1000/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_16.jpg 1000w, https://kamil.fyi/content/images/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_16.jpg 1024w"></figure><p>Another great feature is the built-in support for typed parameters. As you can see here, we use a <code>Params</code> struct to explicitly define all the arguments that the operation can take, along with their types and even default values.</p><figure class="kg-card kg-image-card kg-width-full"><img src="https://kamil.fyi/content/images/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_17.jpg" class="kg-image" alt="Flavors of Ruby on Rails Architectures" loading="lazy" width="1024" height="576" srcset="https://kamil.fyi/content/images/size/w600/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_17.jpg 600w, https://kamil.fyi/content/images/size/w1000/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_17.jpg 1000w, https://kamil.fyi/content/images/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_17.jpg 1024w"></figure><p>Similarly, responses can be typed as well.</p><figure class="kg-card kg-image-card kg-width-full"><img src="https://kamil.fyi/content/images/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_18.jpg" class="kg-image" alt="Flavors of Ruby on Rails Architectures" loading="lazy" width="1024" height="576" srcset="https://kamil.fyi/content/images/size/w600/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_18.jpg 600w, https://kamil.fyi/content/images/size/w1000/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_18.jpg 1000w, https://kamil.fyi/content/images/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_18.jpg 1024w"></figure><p>Now, let&#x2019;s talk about recording operations. This feature is particularly useful for debugging or meeting compliance requirements. Parameters and results are stored in a database table, allowing you to easily track and review the operations that have been executed.</p><figure class="kg-card kg-image-card kg-width-full"><img src="https://kamil.fyi/content/images/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_19.jpg" class="kg-image" alt="Flavors of Ruby on Rails Architectures" loading="lazy" width="1024" height="576" srcset="https://kamil.fyi/content/images/size/w600/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_19.jpg 600w, https://kamil.fyi/content/images/size/w1000/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_19.jpg 1000w, https://kamil.fyi/content/images/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_19.jpg 1024w"></figure><p>Another handy feature of our library is the ability to ensure an operation is performed only once by using a nonce key. In this example, the operation is executed just once, and any subsequent attempts with the same key will simply retrieve the previously recorded response.</p><figure class="kg-card kg-image-card kg-width-full"><img src="https://kamil.fyi/content/images/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_20.jpg" class="kg-image" alt="Flavors of Ruby on Rails Architectures" loading="lazy" width="1024" height="576" srcset="https://kamil.fyi/content/images/size/w600/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_20.jpg 600w, https://kamil.fyi/content/images/size/w1000/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_20.jpg 1000w, https://kamil.fyi/content/images/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_20.jpg 1024w"></figure><p>We also support remote operations that can communicate across multiple microservices. In the example, you can see that by adding a <code>remote</code> method at the top, the operation acts as a server, making it available as an RPC over RabbitMQ.</p><figure class="kg-card kg-image-card kg-width-full"><img src="https://kamil.fyi/content/images/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_21.jpg" class="kg-image" alt="Flavors of Ruby on Rails Architectures" loading="lazy" width="1024" height="576" srcset="https://kamil.fyi/content/images/size/w600/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_21.jpg 600w, https://kamil.fyi/content/images/size/w1000/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_21.jpg 1000w, https://kamil.fyi/content/images/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_21.jpg 1024w"></figure><p>Here&#x2019;s the client-side call, which we can make from another Rails app. By adding the <code>remote</code> prefix to the chain when initializing the operation, the library handles all the communication between services. You can simply enjoy the result without worrying about the underlying complexity.</p><figure class="kg-card kg-image-card kg-width-full"><img src="https://kamil.fyi/content/images/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_22.jpg" class="kg-image" alt="Flavors of Ruby on Rails Architectures" loading="lazy" width="1024" height="576" srcset="https://kamil.fyi/content/images/size/w600/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_22.jpg 600w, https://kamil.fyi/content/images/size/w1000/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_22.jpg 1000w, https://kamil.fyi/content/images/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_22.jpg 1024w"></figure><p>That wraps it up. While none of this is groundbreaking, it&#x2019;s still a powerful, simple, and flexible architecture that extends the vanilla Rails approach without being disruptive. The main downside we&#x2019;ve encountered is that by making operations so convenient, engineers may start relying on them for almost everything. In vanilla Rails, we had the issue of overloaded models, and here, we risk ending up with anemic models that only store basic data and overloaded operations. So, it&#x2019;s important to stay mindful of design and use this approach thoughtfully.</p><figure class="kg-card kg-image-card kg-width-full"><img src="https://kamil.fyi/content/images/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_23.jpg" class="kg-image" alt="Flavors of Ruby on Rails Architectures" loading="lazy" width="1024" height="576" srcset="https://kamil.fyi/content/images/size/w600/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_23.jpg 600w, https://kamil.fyi/content/images/size/w1000/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_23.jpg 1000w, https://kamil.fyi/content/images/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_23.jpg 1024w"></figure><p>Time for the third approach, domain-driven Rails.</p><figure class="kg-card kg-image-card kg-width-full"><img src="https://kamil.fyi/content/images/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_24.jpg" class="kg-image" alt="Flavors of Ruby on Rails Architectures" loading="lazy" width="1024" height="576" srcset="https://kamil.fyi/content/images/size/w600/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_24.jpg 600w, https://kamil.fyi/content/images/size/w1000/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_24.jpg 1000w, https://kamil.fyi/content/images/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_24.jpg 1024w"></figure><p>Alright, so we&#x2019;ve covered two patterns so far, but we haven&#x2019;t ventured too far from classic Rails architectures yet. One of the main challenges with Rails is that, over time, it tends to encourage tight coupling. If you&#x2019;re not careful, everything starts talking to everything else, and making changes becomes difficult because you end up needing to refactor half the system.</p><figure class="kg-card kg-image-card kg-width-full"><img src="https://kamil.fyi/content/images/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_25.jpg" class="kg-image" alt="Flavors of Ruby on Rails Architectures" loading="lazy" width="1024" height="576" srcset="https://kamil.fyi/content/images/size/w600/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_25.jpg 600w, https://kamil.fyi/content/images/size/w1000/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_25.jpg 1000w, https://kamil.fyi/content/images/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_25.jpg 1024w"></figure><p>That figure is from a book called &#x201C;Architecture Modernization&#x201D; by Nick Tune, where I served as the technical editor. Unfortunately, Rails tends to land at the top of the diagram, characterized by strong and sometimes intrusive coupling.</p><figure class="kg-card kg-image-card kg-width-full"><img src="https://kamil.fyi/content/images/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_26.jpg" class="kg-image" alt="Flavors of Ruby on Rails Architectures" loading="lazy" width="1024" height="576" srcset="https://kamil.fyi/content/images/size/w600/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_26.jpg 600w, https://kamil.fyi/content/images/size/w1000/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_26.jpg 1000w, https://kamil.fyi/content/images/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_26.jpg 1024w"></figure><p><a href="https://www.manning.com/books/architecture-modernization?ref=kamil.fyi" rel="noreferrer">Here&#x2019;s the book if you&apos;re interested.</a> It&#x2019;s a great read, though I might be a bit biased!</p><figure class="kg-card kg-image-card kg-width-full"><img src="https://kamil.fyi/content/images/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_27.jpg" class="kg-image" alt="Flavors of Ruby on Rails Architectures" loading="lazy" width="1024" height="576" srcset="https://kamil.fyi/content/images/size/w600/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_27.jpg 600w, https://kamil.fyi/content/images/size/w1000/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_27.jpg 1000w, https://kamil.fyi/content/images/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_27.jpg 1024w"></figure><p>So now, let&#x2019;s take this problem and its solution to the extreme by decoupling as much as possible. In the upcoming code samples, I&#x2019;ll be using a gem called rails-event-store to demonstrate how this works.</p><figure class="kg-card kg-image-card kg-width-full"><img src="https://kamil.fyi/content/images/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_28.jpg" class="kg-image" alt="Flavors of Ruby on Rails Architectures" loading="lazy" width="1024" height="576" srcset="https://kamil.fyi/content/images/size/w600/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_28.jpg 600w, https://kamil.fyi/content/images/size/w1000/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_28.jpg 1000w, https://kamil.fyi/content/images/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_28.jpg 1024w"></figure><p>We&#x2019;ll begin by introducing the command pattern into our codebase. Here, we use a command bus to execute a command.</p><figure class="kg-card kg-image-card kg-width-full"><img src="https://kamil.fyi/content/images/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_29.jpg" class="kg-image" alt="Flavors of Ruby on Rails Architectures" loading="lazy" width="1024" height="576" srcset="https://kamil.fyi/content/images/size/w600/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_29.jpg 600w, https://kamil.fyi/content/images/size/w1000/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_29.jpg 1000w, https://kamil.fyi/content/images/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_29.jpg 1024w"></figure><p>The goal here is to decouple the action from the actor. Now, multiple handlers from different subsystems can respond to our commands, and we don&#x2019;t need to worry about their responses. Our job is done once we&#x2019;ve communicated what we need.</p><figure class="kg-card kg-image-card kg-width-full"><img src="https://kamil.fyi/content/images/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_30.jpg" class="kg-image" alt="Flavors of Ruby on Rails Architectures" loading="lazy" width="1024" height="576" srcset="https://kamil.fyi/content/images/size/w600/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_30.jpg 600w, https://kamil.fyi/content/images/size/w1000/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_30.jpg 1000w, https://kamil.fyi/content/images/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_30.jpg 1024w"></figure><p>Next, we add a command handler. This handler is responsible for building what&apos;s known as an aggregate root.</p><figure class="kg-card kg-image-card kg-width-full"><img src="https://kamil.fyi/content/images/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_31.jpg" class="kg-image" alt="Flavors of Ruby on Rails Architectures" loading="lazy" width="1024" height="576" srcset="https://kamil.fyi/content/images/size/w600/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_31.jpg 600w, https://kamil.fyi/content/images/size/w1000/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_31.jpg 1000w, https://kamil.fyi/content/images/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_31.jpg 1024w"></figure><p>As you can see, an aggregate root is a pure Ruby class that represents our domain model. The key distinction here is that it&#x2019;s not an Active Record model. Another important aspect is that the state of the model is derived from events. When our command triggers the <code>add_item</code> method, this method fires an event, and the model&#x2019;s state is constructed from a sequence of events. This is all part of the decoupling process. For example, we could have a non-Ruby system sending these events, and it would still be compatible with our domain and the code.</p><figure class="kg-card kg-image-card kg-width-full"><img src="https://kamil.fyi/content/images/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_32.jpg" class="kg-image" alt="Flavors of Ruby on Rails Architectures" loading="lazy" width="1024" height="576" srcset="https://kamil.fyi/content/images/size/w600/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_32.jpg 600w, https://kamil.fyi/content/images/size/w1000/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_32.jpg 1000w, https://kamil.fyi/content/images/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_32.jpg 1024w"></figure><p>Now, you might wonder how we use this in our application layer since it&#x2019;s completely separated from the domain layer. The answer lies in building a bridge called a read model. A read model is an Active Record model that we create in response to an event. Once created, we can use it just like any other vanilla Rails model. The advantage of this approach is that the read model can be optimized specifically for whatever we need in the view. For example, in this simple case, I&#x2019;m setting the status to &#x201C;Submitted,&#x201D; which could be directly displayed in the view.</p><figure class="kg-card kg-image-card kg-width-full"><img src="https://kamil.fyi/content/images/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_33.jpg" class="kg-image" alt="Flavors of Ruby on Rails Architectures" loading="lazy" width="1024" height="576" srcset="https://kamil.fyi/content/images/size/w600/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_33.jpg 600w, https://kamil.fyi/content/images/size/w1000/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_33.jpg 1000w, https://kamil.fyi/content/images/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_33.jpg 1024w"></figure><p>Alright, let&#x2019;s weigh the pros and cons. On the plus side, this approach aligns well with event-driven programming, making it a good fit for microservices-based architectures. It&#x2019;s also quite reusable&#x2014;you could, for example, develop a decoupled billing domain once and reuse it across multiple apps. Additionally, because of the loose coupling, it&#x2019;s more resistant to changes.</p><p>However, the downside is the complexity we&#x2019;ve just introduced. I mean, did you see that code? Something as straightforward as adding an item to a basket suddenly feels as challenging as a journey to Mordor. The reality is that CRUD architectures are almost always good enough for most applications.</p><figure class="kg-card kg-image-card kg-width-full"><img src="https://kamil.fyi/content/images/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_34.jpg" class="kg-image" alt="Flavors of Ruby on Rails Architectures" loading="lazy" width="1024" height="576" srcset="https://kamil.fyi/content/images/size/w600/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_34.jpg 600w, https://kamil.fyi/content/images/size/w1000/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_34.jpg 1000w, https://kamil.fyi/content/images/2024/09/1725398740459-eb1f810c-90b0-4863-902e-5a62456e626d_34.jpg 1024w"></figure><hr><p>&#x1F4E3;&#xA0;<strong>Before Growth has grown through word of mouth.</strong> Want to help? Share it&#xA0;on Twitter&#xA0;<a href="https://twitter.com/intent/tweet?url=https%3A%2F%2Fkamil.fyi&amp;text=Love+this+newsletter+about+early-stage+projects.+Hand-picked+startup+intel+that%E2%80%99ll+put+you+ahead+of+the+curve%2C+straight+from+one+founder+to+another.+Check+it+out%21&amp;ref=kamil.fyi" rel="noreferrer">here,</a> Facebook&#xA0;<a href="https://facebook.com/sharer/sharer.php?u=https://kamil.fyi" rel="noreferrer">here,</a> or LinkedIn <a href="https://linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fkamil.fyi&amp;ref=kamil.fyi" rel="noreferrer">here</a>.</p><div class="kg-card kg-callout-card kg-callout-card-blue"><div class="kg-callout-emoji">&#x1F4EC;</div><div class="kg-callout-text">Did a friend forward this to you? <a href="https://kamil.fyi/#/portal/signup" rel="noreferrer">Subscribe</a> now to get the latest updates delivered straight to your inbox every week.</div></div>]]></content:encoded></item><item><title><![CDATA[Chaining Prompts]]></title><description><![CDATA[Chains go beyond a single LLM call and involve sequences of calls.]]></description><link>https://kamil.fyi/chaining-prompts/</link><guid isPermaLink="false">665ce7ae4ed677001d2a20f9</guid><category><![CDATA[AI]]></category><dc:creator><![CDATA[Kamil Nicieja]]></dc:creator><pubDate>Tue, 18 Jun 2024 23:20:30 GMT</pubDate><media:content url="https://kamil.fyi/content/images/2024/06/a-weathered-iron-chain-draped-casually-across-the-foreground-direction-right--rust-spots-clinging-192983794.jpeg" medium="image"/><content:encoded><![CDATA[<img src="https://kamil.fyi/content/images/2024/06/a-weathered-iron-chain-draped-casually-across-the-foreground-direction-right--rust-spots-clinging-192983794.jpeg" alt="Chaining Prompts"><p>I have written about prompting multiple times now.</p><p>For example, in <a href="https://kamil.fyi/smart-reactivity/"><em>Smart Reactivity,</em></a> we talked about a prompt that guides the AI to evaluate changes from the target audience&#x2019;s perspective to write a sumary. This method forces the model to assess the significance of these features based on customer perception. Then, we instruct it to prioritize the list according to what matters most to the customer. This strategy allows apps to become more responsive with minimal user input.</p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://kamil.fyi/smart-reactivity/"><div class="kg-bookmark-content"><div class="kg-bookmark-title">Smart Reactivity</div><div class="kg-bookmark-description">With the rise of AI, apps are set to become more reactive without much user input.</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://kamil.fyi/content/images/size/w256h256/format/png/2023/08/cropped-owl_1f989.png.webp" alt="Chaining Prompts"><span class="kg-bookmark-author">Kamil Nicieja &#xB7; Before Growth</span><span class="kg-bookmark-publisher">Kamil Nicieja</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://kamil.fyi/content/images/2023/09/a-chemist-mixing-ingredients-in-a-dark-laboratory-879644947.png" alt="Chaining Prompts"></div></a></figure><p>However, if we revisit these posts now, we&#x2019;ll see that the inputs and outputs we discussed were relatively brief. Even if the prompts were complex, they consisted of a few paragraphs, and the model&#x2019;s responses were similar. But what if we wanted the AI to write an entire book, for example? When I typed this prompt into ChatGPT, I got just nine paragraphs of something the model considers a &#x201C;book,&#x201D; which they obviously are not.</p><p>So the question is, is there any way to guide the model into writing a book, even though it can&#x2019;t do it on its own?</p><p>It turns out the answer is yes. If you, as a prompt engineer, know how to write a book, you can hand-hold the model step by step. First, you ask it to generate a few topics and choose the best one. Next, you have it write an elevator pitch for the book to determine the approach to the topic. Then, you instruct it to create an outline based on this pitch. For each chapter from the outline, you have it develop a plan. Finally, for each bullet point, it writes a few paragraphs. The model might not be able to hold everything it wrote in memory, so to reduce the length of the prompt, each time you prompt it to write a new chapter, you provide the outlines and a summary of what it previously wrote. And yes, it writes the summaries on its own, too.</p><p>As a result, at every step, it will generate a few paragraphs, then use these paragraphs to generate more paragraphs, and so on. The outcome might not be easy to digest, since LLMs are not highly creative, but you just guided the model through an extremely complex process.</p><p>The technique we just used is called chaining. It involves generating a desired output by following a series of prompts. In this process, a sequence of prompts is provided to a model, guiding it to produce the desired response. Each prompt addresses a subtask defined by the prompt engineer, and they are executed in sequence, each one feeding into the next, continuing down the chain of tasks until we arrive at the final result.</p><p>Time for a practical example.</p><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://kamil.fyi/no-work-is-ever-wasted/"><div class="kg-bookmark-content"><div class="kg-bookmark-title">No Work Is Ever Wasted</div><div class="kg-bookmark-description">What if you&#x2019;ve launched your app, poured your heart into it, and still crashed and burned?</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://kamil.fyi/content/images/size/w256h256/format/png/2023/08/cropped-owl_1f989.png.webp" alt="Chaining Prompts"><span class="kg-bookmark-author">Kamil Nicieja &#xB7; Before Growth</span><span class="kg-bookmark-publisher">Kamil Nicieja</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://kamil.fyi/content/images/2023/09/lumberjacks-forest-working-sweating-woods-trees-axe-lumber-stacks-tired-defeated-resting-121838973.png" alt="Chaining Prompts"></div></a></figure><p>In <a href="https://kamil.fyi/no-work-is-ever-wasted/"><em>No Work Is Ever Wasted,</em></a> we discussed chain-of-density, a prompt that the Salesforce AI team rolled out as a fresh approach for LLM-based text summarization. We&#x2019;ll take the result that prompt generated from one of my articles and build upon it by chaining it with a couple of other prompts.</p><blockquote>Your article talks about <a href="https://kamil.fyi/productive-fictions/">&#x201C;productive fictions&#x201D;</a> like 17th&#x2013;century philosopher Blaise Pascal&#x2019;s Wager and societal values like meritocracy, illustrating moral stances, human traits, and the impact of market demand. It underscores the pragmatic optimism and societal equilibrium emanating from these unverified but beneficial beliefs, which serve as practical guides, balancing life and societal constructs.</blockquote><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://kamil.fyi/productive-fictions/"><div class="kg-bookmark-content"><div class="kg-bookmark-title">Productive Fictions</div><div class="kg-bookmark-description">Why not categorize your beliefs into those that are productive and those that are not?</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://kamil.fyi/content/images/size/w256h256/format/png/2023/08/cropped-owl_1f989.png.webp" alt="Chaining Prompts"><span class="kg-bookmark-author">Kamil Nicieja &#xB7; Before Growth</span><span class="kg-bookmark-publisher">Kamil Nicieja</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://kamil.fyi/content/images/2023/09/an-acrobat-or-juggler-balancing-objects-labeled-with-different-productive-fictions-illustrating-the-440553302.png" alt="Chaining Prompts"></div></a></figure><p>We&apos;ll take the result of the summarization prompt from the previous section and build upon it by chaining it with a couple of other prompts.</p><blockquote><strong>Model input:</strong><br>Take the last summary you wrote and prepare a list of ideas for different social media sites based on it. Each idea should be tailored to the type of content that works best on each platform.</blockquote><blockquote><strong>Model output:</strong><br>Based on the summary of the blog post, here are tailored ideas for different social media platforms:<br><br><em>Twitter:</em>&#xA0;Create a thread explaining &quot;productive fictions&quot; with examples like Pascal&apos;s Wager and meritocracy, and how these unverified beliefs positively impact societal values and behaviors. Include engaging questions to encourage discussions.<br><br><em>Instagram:</em>&#xA0;Post a carousel of visually appealing graphics that illustrate the concepts of Pascal&apos;s Wager, meritocracy, and their benefits. Use concise text overlays and captions to explain how these ideas contribute to societal balance and pragmatic optimism.<br><br><em>TikTok:</em>&#xA0;Make a short video explaining the concept of &quot;productive fictions&quot; using simple terms and relatable examples. Use visual aids, animations, and on-screen text to make the content engaging. End with a question prompting viewers to share their own examples of beneficial beliefs.<br><br>(More ideas follow&#x2026;)</blockquote><p>You may have noticed that depending on the platform, the AI suggested different content forms. On Twitter, it&#x2019;s text; on Instagram, it&#x2019;s images; on TikTok, it&#x2019;s videos. This is another reason why chaining can be extremely useful. In this example, we can take the ideas generated by the LLM and feed them to a visual model or an audio model.</p><p>For now, let&apos;s focus on just one modality. We&#x2019;ll feed the model with its own instructions to write a Twitter thread based on the summary it wrote.</p><blockquote><strong>Model input:</strong><br>Create a thread explaining &quot;productive fictions&quot; with examples like Pascal&apos;s Wager and meritocracy, and how these unverified beliefs positively impact societal values and behaviors. Include engaging questions to encourage discussions.</blockquote><blockquote><strong>Model output:</strong><br><em>1/10</em> &#x1F31F; Ever heard of &quot;productive fictions&quot;? These are beliefs that, while unverified, bring positive impacts to our lives and society. Let&apos;s dive into some examples and see how they work!<br><br><em>2/10</em> &#x1F4DC; One classic example is Blaise Pascal&apos;s Wager. Pascal argued that it&apos;s rational to believe in God, even without proof, because the potential benefits (eternal happiness) outweigh the potential costs.<br><br>(More tweets follow&#x2026;)</blockquote><p>Great! We could use this simple chain, for example, in an app meant for content creators to help them automate processes related to self-promotion. As the app designer, you set up the process step by step by writing the prompts in a chainable way, teaching the model to act almost like you would instruct a human. The AI then takes care of the results.</p>]]></content:encoded></item><item><title><![CDATA[Side Projects]]></title><description><![CDATA[Repeat after me: I will not start another side project… Oh, shit.]]></description><link>https://kamil.fyi/side-projects/</link><guid isPermaLink="false">665310e04ed677001d2a1513</guid><category><![CDATA[Projects]]></category><dc:creator><![CDATA[Kamil Nicieja]]></dc:creator><pubDate>Tue, 28 May 2024 20:38:06 GMT</pubDate><media:content url="https://kamil.fyi/content/images/2024/05/close-up-view-of-a-gardeners-hands-quads-full-of-soil-planting-a-tiny-seedling-into-a-rich-dark--866271220.jpeg" medium="image"/><content:encoded><![CDATA[<div class="kg-card kg-callout-card kg-callout-card-blue"><div class="kg-callout-emoji">&#x1F989;</div><div class="kg-callout-text"><a href="https://kamil.fyi/" rel="noreferrer"><i><b><strong class="italic" style="white-space: pre-wrap;">Before Growth</strong></b></i></a> is a newsletter about startups before product&#x2013;market fit by 3x founder and programmer Kamil Nicieja.</div></div><img src="https://kamil.fyi/content/images/2024/05/close-up-view-of-a-gardeners-hands-quads-full-of-soil-planting-a-tiny-seedling-into-a-rich-dark--866271220.jpeg" alt="Side Projects"><p>You might have noticed I haven&#x2019;t been writing as much this year compared to last year. This is because I&#x2019;ve been busy with a few side projects that I&#x2019;m not ready to announce yet. (Soon!)</p><p>I always wanted <em>Before Growth</em> to be a place for builders and practitioners, not just filled with theoretical articles. So, I guess it was expected that occasional breaks would be necessary. Otherwise, I&#x2019;d be working full-time on the newsletter, which would keep me from actively engaging in the field.</p><p>This wasn&apos;t clear to me from the beginning. I experimented with different models, including paid subscriptions. I turned them off some time ago when I realized they no longer made sense. So now, all content on here is free! If you haven&#x2019;t read the previously paid articles, feel free to do so now. If you were one of the paid subscribers, thank you for your support. I hope to continue earning it by writing quality content.</p><p>On a related note, I <em>do</em> believe side projects are extremely important for every creative person. This blog itself started as a side project. Before that, I worked on <a href="https://github.com/changepack/changepack?ref=kamil.fyi">Changepack,</a> my open-source Rails app that uses AI to write changelogs for teams. That project led me to write more about LLMs, which inspired me to start a newsletter. This eventually led to organizing my essays into an online ebook. None of this was planned; it all happened <strong>serendipitously.</strong></p><p>But I&#x2019;ve noticed that this is what tends to happen when you&#x2019;re active and open to opportunities. Many of my friends, some of whom read this newsletter&#x2014;you know who you are!&#x2014;complain that they&#x2019;d start some side project that would be fun if they only had a good enough idea. But I think that kind of misses the point. All ideas are good enough. None of them are good enough. You&#x2019;ll only know once you start and work on them.</p><p>And sometimes, course corrections are needed, like this one! This isn&#x2019;t something to be too hard on yourself about. Personally, I think it&#x2019;s more productive to go with the flow and see what sticks. In my experience, what sticks is usually what&#x2019;s fun to do. Yes, some grind, perseverance, and determination are required, and the more serious you get, the more of it is needed. But it&#x2019;s difficult to force yourself to do something that doesn&#x2019;t seem fun over a long period.</p><p>And if you develop some marketable skills along the way? That&#x2019;s fantastic. But if not, that&#x2019;s okay too. One of the key benefits of side projects is the idea of recovery. Setting time aside to work on passion projects isn&apos;t just good for your mind; it can also make you more productive and bring you greater life satisfaction.</p><p>So, I&#x2019;ll get back to you soon with three small projects I&#x2019;ve been working on. One is a summary of last year&#x2019;s period on <em>Before Growth.</em> Another is a personal look forward into the future. The third one is almost completely unrelated to anything I&#x2019;ve written here so far, but it&#x2019;s probably been the most fun to work on.</p><p>Let&#x2019;s see how it goes.</p><hr><p>&#x1F4E3;&#xA0;<strong>Before Growth has grown through word of mouth.</strong> Want to help? Share it&#xA0;on Twitter&#xA0;<a href="https://twitter.com/intent/tweet?url=https%3A%2F%2Fkamil.fyi&amp;text=Love+this+newsletter+about+early-stage+projects.+Hand-picked+startup+intel+that%E2%80%99ll+put+you+ahead+of+the+curve%2C+straight+from+one+founder+to+another.+Check+it+out%21&amp;ref=kamil.fyi" rel="noreferrer">here,</a> Facebook&#xA0;<a href="https://facebook.com/sharer/sharer.php?u=https://kamil.fyi" rel="noreferrer">here,</a> or LinkedIn <a href="https://linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fkamil.fyi&amp;ref=kamil.fyi" rel="noreferrer">here</a>.</p><div class="kg-card kg-callout-card kg-callout-card-blue"><div class="kg-callout-emoji">&#x1F4EC;</div><div class="kg-callout-text">Did a friend forward this to you? <a href="https://kamil.fyi/#/portal/signup" rel="noreferrer">Subscribe</a> now to get the latest updates delivered straight to your inbox every week.</div></div>]]></content:encoded></item><item><title><![CDATA[When You Say It Twice, Write It Down]]></title><description><![CDATA[…and save everybody’s time.]]></description><link>https://kamil.fyi/when-you-say-it-twice-write-it-down/</link><guid isPermaLink="false">664fe6d04ed677001d2a091b</guid><category><![CDATA[Managing]]></category><category><![CDATA[Books]]></category><dc:creator><![CDATA[Kamil Nicieja]]></dc:creator><pubDate>Fri, 24 May 2024 18:22:36 GMT</pubDate><media:content url="https://kamil.fyi/content/images/2024/05/close-up-of-a-hand-gliding-over-parchment-vintage-fountain-pen-in-motion-antique-oak-desk-scatter-498662994.jpeg" medium="image"/><content:encoded><![CDATA[<div class="kg-card kg-callout-card kg-callout-card-blue"><div class="kg-callout-emoji">&#x1F989;</div><div class="kg-callout-text"><a href="https://kamil.fyi/" rel="noreferrer"><i><b><strong class="italic" style="white-space: pre-wrap;">Before Growth</strong></b></i></a> is a newsletter about startups before product&#x2013;market fit by 3x founder and programmer Kamil Nicieja.</div></div><img src="https://kamil.fyi/content/images/2024/05/close-up-of-a-hand-gliding-over-parchment-vintage-fountain-pen-in-motion-antique-oak-desk-scatter-498662994.jpeg" alt="When You Say It Twice, Write It Down"><p>I&#x2019;ve noticed that smart people don&#x2019;t like repeating themselves. Polite ones might repeat things a couple of times, but if you meet someone who&#x2019;s more direct and wants you to keep up, they&#x2019;ll get increasingly annoyed if you don&#x2019;t.</p><p>I think the reason is simple. Smart people usually absorb new information quickly and have good memories. They are proactive in finding new data points, which has contributed to their success. They naturally expect others to do the same. That&#x2019;s their first instinct is to think, &#x201C;If I know this, why don&#x2019;t they?&#x201D; and they&#x2019;ve often had to learn to suppress it to avoid coming across as jerks.</p><p>But when they start leading people and organizations, they run into a wall. As a manager, there&#x2019;s no other way: you must keep reinforcing the same message ad nauseam until everyone is on the same page.</p><p>It&#x2019;s not because people are stupid. Think of a new hire. If they were stupid, you wouldn&#x2019;t offer them a position. There&#x2019;s simply a temporary information asymmetry between them and the rest of the team. As communication gets more complex with more people involved in a project, this gap grows in unexpected ways, even among long-term employees.</p><p>If any of this sounds familiar, here&#x2019;s how you can make your job easier.</p><p>Whenever you find yourself repeating something to a second audience or in a different situation, it&#x2019;s likely you&#x2019;ll need to say it again and again in the future. To reduce the time you spend repeating information, write it down. Then, the next time you need to share that message, you can simply provide it in written form.</p><p>If it&#x2019;s something all team members should know and remember, add it to a company-wide wiki for good measure. This is a great habit to develop for yourself and the entire organization, generating lots of useful information over time.</p><p>If you adopt it and do it consistently, your team will see the benefits and be encouraged to do the same. People usually don&#x2019;t like producing documentation and see it as a chore. However, if you explain that it will save them a lot of time in the long run, they&#x2019;ll eventually recognize the benefit. Even better, show it.</p><hr><p>This advice comes from&#xA0;<a href="https://www.amazon.com/Great-CEO-Within-Tactical-Building-ebook/dp/B07ZLGQZYC?ref=kamil.fyi"><em>The Great CEO Within</em></a>&#xA0;by Matt Mochary, who coaches many of the fastest-growing technology companies&#x2019; CEOs in Silicon Valley. In his book, he shares highly effective leadership and business-operating tools with CEOs and managers everywhere. I highly recommend it.</p><hr><p>&#x1F4E3;&#xA0;<strong>Before Growth has grown through word of mouth.</strong> Want to help? Share it&#xA0;on Twitter&#xA0;<a href="https://twitter.com/intent/tweet?url=https%3A%2F%2Fkamil.fyi&amp;text=Love+this+newsletter+about+early-stage+projects.+Hand-picked+startup+intel+that%E2%80%99ll+put+you+ahead+of+the+curve%2C+straight+from+one+founder+to+another.+Check+it+out%21&amp;ref=kamil.fyi" rel="noreferrer">here,</a> Facebook&#xA0;<a href="https://facebook.com/sharer/sharer.php?u=https://kamil.fyi" rel="noreferrer">here,</a> or LinkedIn <a href="https://linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fkamil.fyi&amp;ref=kamil.fyi" rel="noreferrer">here</a>.</p><div class="kg-card kg-callout-card kg-callout-card-blue"><div class="kg-callout-emoji">&#x1F4EC;</div><div class="kg-callout-text">Did a friend forward this to you? <a href="https://kamil.fyi/#/portal/signup" rel="noreferrer">Subscribe</a> now to get the latest updates delivered straight to your inbox every week.</div></div>]]></content:encoded></item><item><title><![CDATA[Intelligence as an API]]></title><description><![CDATA[AI models are getting hard to beat when it comes to getting simple answers right at scale.]]></description><link>https://kamil.fyi/intelligence-as-an-api/</link><guid isPermaLink="false">65f5aae05718db001d90dac9</guid><category><![CDATA[AI]]></category><dc:creator><![CDATA[Kamil Nicieja]]></dc:creator><pubDate>Sun, 05 May 2024 20:07:05 GMT</pubDate><media:content url="https://kamil.fyi/content/images/2024/05/a-conceptual-representation-of-intelligence-as-a-glowing-entity-existing-in-an-infinite-virtual-lib-971794079.jpeg" medium="image"/><content:encoded><![CDATA[<div class="kg-card kg-callout-card kg-callout-card-blue"><div class="kg-callout-emoji">&#x1F989;</div><div class="kg-callout-text"><a href="https://kamil.fyi/" rel="noreferrer"><i><b><strong class="italic" style="white-space: pre-wrap;">Before Growth</strong></b></i></a> is a newsletter about startups before product&#x2013;market fit by 3x founder and programmer Kamil Nicieja.</div></div><img src="https://kamil.fyi/content/images/2024/05/a-conceptual-representation-of-intelligence-as-a-glowing-entity-existing-in-an-infinite-virtual-lib-971794079.jpeg" alt="Intelligence as an API"><p>A year and a half later, after the hype subsided just a bit, I think of large language models as <em>on-demand intelligence accessible through APIs.</em> Whenever my software needs to use fuzzy logic or analyze unstructured data, I can just send an HTTP request and get the insights I need.</p><p>Let&#x2019;s consider a real-world scenario. Imagine an applicant tracking system that filters candidates using specific keywords. Each resume must be reviewed by a recruiter to see if it matches their criteria. For example, they might be searching for a candidate with seven years of experience in a particular technology.</p><p>The top companies often get hundreds&#x2014;if not thousands&#x2014;of applications, resulting in a lot of repetitive manual work. Moreover, recruiters are usually not experts in technology. To compensate, they come up with their own heuristics, which might lead false positives or false negatives.</p><p>With large language models, rather than depending on these filters, we can tap into AI&#x2019;s intelligence by making an API call. (Shoutout to&#xA0;<a href="https://twitter.com/patio11/status/1768645785162289616?ref=kamil.fyi">Patrick McKenzie on Twitter</a>&#xA0;for the inspiration behind this prompt.)</p><blockquote>Suppose you&#x2019;re looking for someone with at least seven years of Python experience. A developer&#x2019;s resume indicates they&#x2019;ve been using Django since version 1.8. Explain why you&#x2019;d decide to include or exclude this candidate.</blockquote><p>&#x2026;and get a response:</p><blockquote>Include them. Django 1.8&#x2019;s release in 2015 implies over 7 years of Python experience.</blockquote><p>I wasn&#x2019;t sure myself since I&#x2019;m a Ruby developer. But after looking into it, I confirmed this is the right decision. Great!</p><p>Building an applicant tracking system like that without AI would require engineers to either integrate a complex expert system directly into their product, or allow recruiters to set up a rigid job application workflow on their own. But LLMs can easily read the job listing and the resume by using their extensive knowledge&#x2014;on demand.</p><p>So here&#x2019;s the best way to understand how these models are useful today, despite not yet being smarter than humans: if you assign them specific, concrete tasks, they can help you achieve good results efficiently. Turns out, my perspective on AI systems hasn&#x2019;t changed much over the past decade: they can deliver what a thousand interns would, but much faster and at a lower cost.</p><p>The major difference this time is that the tech stack has become much simpler to use due to commoditization. What used to be accessible only to Big Tech only has now become available to everyone. </p><hr><p>&#x1F4E3;&#xA0;<strong>Before Growth has grown through word of mouth.</strong> Want to help? Share it&#xA0;on Twitter&#xA0;<a href="https://twitter.com/intent/tweet?url=https%3A%2F%2Fkamil.fyi&amp;text=Love+this+newsletter+about+early-stage+projects.+Hand-picked+startup+intel+that%E2%80%99ll+put+you+ahead+of+the+curve%2C+straight+from+one+founder+to+another.+Check+it+out%21&amp;ref=kamil.fyi" rel="noreferrer">here,</a> Facebook&#xA0;<a href="https://facebook.com/sharer/sharer.php?u=https://kamil.fyi" rel="noreferrer">here,</a> or LinkedIn <a href="https://linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fkamil.fyi&amp;ref=kamil.fyi" rel="noreferrer">here</a>.</p><div class="kg-card kg-callout-card kg-callout-card-blue"><div class="kg-callout-emoji">&#x1F4EC;</div><div class="kg-callout-text">Did a friend forward this to you? <a href="https://kamil.fyi/#/portal/signup" rel="noreferrer">Subscribe</a> now to get the latest updates delivered straight to your inbox every week.</div></div>]]></content:encoded></item><item><title><![CDATA[Pairing with AI]]></title><description><![CDATA[Raise your floor with large language models.]]></description><link>https://kamil.fyi/pairing-with-llms/</link><guid isPermaLink="false">65f4b70a5718db001d90cd39</guid><category><![CDATA[AI]]></category><dc:creator><![CDATA[Kamil Nicieja]]></dc:creator><pubDate>Fri, 15 Mar 2024 21:36:10 GMT</pubDate><media:content url="https://kamil.fyi/content/images/2024/03/a-vibrant-and-welcoming-school-building-under-a-clear-blue-sky-in-front-of-the-school-a-diverse-gr-279877784.jpeg" medium="image"/><content:encoded><![CDATA[<div class="kg-card kg-callout-card kg-callout-card-blue"><div class="kg-callout-emoji">&#x1F989;</div><div class="kg-callout-text"><a href="https://kamil.fyi/" rel="noreferrer"><i><b><strong class="italic" style="white-space: pre-wrap;">Before Growth</strong></b></i></a> is a newsletter about startups before product&#x2013;market fit by 3x founder and programmer Kamil Nicieja.</div></div><img src="https://kamil.fyi/content/images/2024/03/a-vibrant-and-welcoming-school-building-under-a-clear-blue-sky-in-front-of-the-school-a-diverse-gr-279877784.jpeg" alt="Pairing with AI"><p>A friend of mine, who isn&apos;t into programming, recently asked me if I could suggest any articles or books that could help them understand a technical concept better.</p><p>I suggested a book&#x2014;and also recommended using ChatGPT as a tutor, which I&#x2019;ve been doing more often myself.</p><p>The app is essentially a talking encyclopedia. (A Borgesian nightmare.) It easily breaks down barriers previously caused by a lack of skill, talent, or knowledge.</p><p>Not sure how to do something? Pair up with ChatGPT, Claude, or Gemini. Tell it about your current skill level and ask for guidance. It will adapt to your needs, allow you to ask follow-up questions, and even provide practical examples when possible.</p><p>I don&#x2019;t often use it this way for tasks within my expertise, but it&#x2019;s great for everything else. Just this week, I teamed up with it to brush up on some basic legal concepts related to my business. I later verified the information with a lawyer friend, but thanks to that previous chat, I already had a good understanding of the topic, which saved my friend some time getting me up to speed.</p><p>It&apos;s a simple concept, true, but we&#x2019;re still&#xA0;<strong><em>early.</em></strong>&#xA0;Most people don&#x2019;t use any large language models daily yet. And these apps are&#x2026; broad, to put it mildly. The interface is essentially just a text box, leaving it up to you to figure out how to make it useful for your needs or to learn from how others are using it.</p><p>It&#x2019;s also a sign of how education will evolve in the coming years. Everyone will have access to a personal tutor knowledgeable in any subject, available 24/7 right from their pocket.</p><p>I personally see large language models as &#x201C;floor raisers.&#x201D; They elevate everyone&#x2019;s basic abilities almost immediately when used&#x2014;as opposed to &#x201C;ceiling raisers,&#x201D; which would push you into the top 1% of a skill, something no LLM can currently achieve.</p><p>Using these tools, everyone becomes just a bit more skilled&#x2014;which is amazing.</p><hr><p><strong>&#x1F64F; My work is </strong><a href="https://kamil.fyi/#/portal/signup" rel="noreferrer"><strong>reader&#x2013;supported</strong></a><strong>.</strong> You can <a href="https://kamil.fyi/#/portal/signup" rel="noreferrer">get a membership here!</a></p><p>&#x1F4E3;&#xA0;<strong>Before Growth has grown through word of mouth.</strong> Want to help? Share it&#xA0;on Twitter&#xA0;<a href="https://twitter.com/intent/tweet?url=https%3A%2F%2Fkamil.fyi&amp;text=Love+this+newsletter+about+early-stage+projects.+Hand-picked+startup+intel+that%E2%80%99ll+put+you+ahead+of+the+curve%2C+straight+from+one+founder+to+another.+Check+it+out%21&amp;ref=kamil.fyi" rel="noreferrer">here,</a> Facebook&#xA0;<a href="https://facebook.com/sharer/sharer.php?u=https://kamil.fyi" rel="noreferrer">here,</a> or LinkedIn <a href="https://linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fkamil.fyi&amp;ref=kamil.fyi" rel="noreferrer">here</a>.</p><p>&#x1F4DA; My new ebook <strong><em>Generative AI in Product Design</em></strong> offers case studies on AI and just enough theory for you to build your next app with gen AI. <a href="https://kamil.fyi/generative-ai-in-product-design/"><strong>Get your copy here!</strong></a></p><div class="kg-card kg-callout-card kg-callout-card-blue"><div class="kg-callout-emoji">&#x1F4EC;</div><div class="kg-callout-text">Did a friend forward this to you? <a href="https://kamil.fyi/#/portal/signup" rel="noreferrer">Subscribe</a> now to get the latest updates delivered straight to your inbox every week.</div></div>]]></content:encoded></item><item><title><![CDATA[The Economics of LLMs]]></title><description><![CDATA[How to avoid bankruptcy scaling up large language models?]]></description><link>https://kamil.fyi/the-economics-of-llms/</link><guid isPermaLink="false">65e3cb347b6401001d2c28c1</guid><category><![CDATA[Engineering]]></category><category><![CDATA[AI]]></category><category><![CDATA[Premium]]></category><dc:creator><![CDATA[Kamil Nicieja]]></dc:creator><pubDate>Sun, 03 Mar 2024 15:02:29 GMT</pubDate><media:content url="https://kamil.fyi/content/images/2024/03/conceptual-illustration-person-adjusting-control-panel-dials-labeled-cost-efficiency-data-manag-843906326.jpeg" medium="image"/><content:encoded><![CDATA[<div class="kg-card kg-callout-card kg-callout-card-blue"><div class="kg-callout-emoji">&#x1F989;</div><div class="kg-callout-text"><a href="https://kamil.fyi/" rel="noreferrer"><i><b><strong class="italic" style="white-space: pre-wrap;">Before Growth</strong></b></i></a> is a weekly newsletter about startups and their builders before product&#x2013;market fit, by 3x founder and programmer Kamil Nicieja.</div></div><img src="https://kamil.fyi/content/images/2024/03/conceptual-illustration-person-adjusting-control-panel-dials-labeled-cost-efficiency-data-manag-843906326.jpeg" alt="The Economics of LLMs"><p><strong>&#x1F64F; My work is </strong><a href="https://kamil.fyi/#/portal/signup" rel="noreferrer"><strong>reader&#x2013;supported</strong></a><strong>.</strong> You can <a href="https://kamil.fyi/#/portal/signup" rel="noreferrer">get a membership here!</a></p><p>&#x1F4E3;&#xA0;<strong>Before Growth has grown through word of mouth.</strong> Want to help? Share it&#xA0;on Twitter&#xA0;<a href="https://twitter.com/intent/tweet?url=https%3A%2F%2Fkamil.fyi&amp;text=Love+this+newsletter+about+early-stage+projects.+Hand-picked+startup+intel+that%E2%80%99ll+put+you+ahead+of+the+curve%2C+straight+from+one+founder+to+another.+Check+it+out%21&amp;ref=kamil.fyi" rel="noreferrer">here,</a> Facebook&#xA0;<a href="https://facebook.com/sharer/sharer.php?u=https://kamil.fyi" rel="noreferrer">here,</a> or LinkedIn <a href="https://linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fkamil.fyi&amp;ref=kamil.fyi" rel="noreferrer">here</a>.</p><p>&#x1F4DA; My new ebook <strong><em>Generative AI in Product Design</em></strong> offers case studies on AI and just enough theory for you to build your next app with gen AI. <a href="https://kamil.fyi/generative-ai-in-product-design/"><strong>Get your copy here!</strong></a></p><hr><p>As AI startups grow, there&#x2019;s a trend of sharing memes on&#xA0;<a href="https://twitter.com/yasser_elsaid_/status/1755652143216750811?ref=kamil.fyi">Twitter</a>&#xA0;about massive bills from OpenAI. Some companies are posting about receiving bills of $8,000 or even $25,000, which can amount to about 10% of a startup&#x2019;s monthly recurring revenue.</p><p>In the past decade, we&#x2019;ve seen similar situations with cloud service bills. Back then, teams didn&#x2019;t worry too much because if their services gained popularity, they had access to almost unlimited venture capital. However, in today&#x2019;s climate, with the end of the zero interest rate policy era, companies need to be much more mindful of costs right from the start.</p><p>So, the big question is, how can we reduce costs? Naturally, the main solutions include developing more efficient models and improving hardware. However, we can also apply software engineering or prompt engineering techniques to cut expenses. This article explores the following strategies:</p><ul><li>Trimming prompts and responses to minimize token usage</li><li>Implementing caching, including both exact matches and semantic caching for approximate matches</li><li>Optimizing models through fine-tuning and deploying smaller models trough the AI router design pattern</li></ul><p>This post leans more towards the technical side. I&#x2019;m deeply interested in practical implementation techniques. I want to ensure&#xA0;<em>Before Growth</em>&#xA0;doesn&#x2019;t turn into a purely theoretical business blog disconnected from real-world practices.</p><p>Let&#x2019;s dive in.</p><h2 id="condensing-prompts-and-responses">Condensing prompts and responses</h2><p>We&#x2019;ll begin with the basics. Since the primary cost from LLM cloud providers comes from the tokens used, reducing the number of tokens in each request can lower expenses. Because we can&#x2019;t always manage user input, it makes sense to look for efficiencies in the system&#x2019;s prompts and ChatGPT&apos;s responses.</p><ul><li>System prompts can be manually shortened or we can use a tool like ChatGPT to do it for us. As I explained in&#xA0;<a href="https://kamil.fyi/corrections/"><em>Corrections,</em></a>&#xA0;the LLM itself often has the ability to rephrase its own prompts in a way that makes them more compliant, and this technique is effective in reducing their length as well.</li><li>We can also use summaries. For example, we can summarize a document once, incurring the full cost, and then use the summary for further processing. This approach reduces the number of tokens used while preserving the most important information.</li><li>For the model&#x2019;s responses, we can request it to be less verbose or to follow instructions such as replying in just a single sentence.</li></ul><figure class="kg-card kg-bookmark-card"><a class="kg-bookmark-container" href="https://kamil.fyi/corrections/"><div class="kg-bookmark-content"><div class="kg-bookmark-title">Corrections</div><div class="kg-bookmark-description">Uncovering the quirks and capabilities of ChatGPT using Ruby on Rails.</div><div class="kg-bookmark-metadata"><img class="kg-bookmark-icon" src="https://kamil.fyi/content/images/size/w256h256/format/png/2023/08/cropped-owl_1f989.png.webp" alt="The Economics of LLMs"><span class="kg-bookmark-author">Kamil Nicieja &#xB7; Before Growth</span><span class="kg-bookmark-publisher">Kamil Nicieja</span></div></div><div class="kg-bookmark-thumbnail"><img src="https://kamil.fyi/content/images/2023/08/robot-cat-machine-licking-cleaning-itself-fur-metal-part-753515160.png" alt="The Economics of LLMs"></div></a></figure><p>While these strategies might seem simple, they&#x2019;re not trivial. If you look into the leaked system prompt for ChatGPT, you&#x2019;ll discover that its developers have explicitly instructed it to conserve computing resources. This includes directives to avoid verbosity, such as the guideline to &#x201C;never write a summary with more than 80 words&#x201D; in the prompt. If OpenAI sees savings opportunities in commands like this, you can benefit from them as well.</p><p>If you&#x2019;re <em>really</em> looking for something more advanced, there&#x2019;s <a href="https://github.com/microsoft/LLMLingua?ref=kamil.fyi">LLMLingua</a> by Microsoft. This tool uses a compact, thoroughly trained language model like GPT2-small or LLaMA-7B to pinpoint and eliminate unnecessary tokens in prompts. This allows for efficient processing, achieving up to 20 times compression while keeping performance loss to a minimum.</p><p>To me, investing in such frameworks really pays off when you&#x2019;re handling highly complex prompts or when doing stuff like <a href="https://research.ibm.com/blog/retrieval-augmented-generation-RAG?ref=kamil.fyi">retrieval-augmented generation.</a> However, as the tech evolves, we&#x2019;re seeing new features, like <a href="https://blog.google/technology/ai/long-context-window-ai-models/?ref=kamil.fyi">Google Gemini&#x2019;s 1 million token context window,</a> enabling users to literally put entire books into these models. If history from the past decade has shown us anything, it&#x2019;s that people will continue to push the boundaries in unexpected ways with these technologies. So, approaches like these could become increasingly valuable as well.</p><h2 id="exact-caching">Exact caching</h2><p>Caching is a technique familiar to programmers across many fields, not just those working with AI. If you&#x2019;re using a framework like <a href="https://www.langchain.com/?ref=kamil.fyi">LangChain,</a> which is optimized for developing applications powered by language models, you might find caching features already built in. This means you can easily incorporate it into your app without much hassle.</p><p>Here&#x2019;s an example.</p><pre><code class="language-python">from langchain.globals import set_llm_cache
from langchain_openai import OpenAI

# To make the caching really obvious, lets use a slower model
llm = OpenAI(model_name=&quot;gpt-3.5-turbo-instruct&quot;, n=2, best_of=2)
</code></pre><pre><code class="language-python">%%time
from langchain.cache import InMemoryCache

set_llm_cache(InMemoryCache())

# The first time, the input is not yet in cache, so request should take longer
llm.predict(&quot;What&apos;s GitHub?&quot;)
</code></pre><pre><code class="language-python">CPU times: user 13.7 ms, sys: 6.54 ms, total: 20.2 ms
Wall time: 330 ms
</code></pre><pre><code class="language-python">%%time
# The second time it is, so we go faster
llm.predict(&quot;What&apos;s GitHub?&quot;)
</code></pre><pre><code class="language-python">CPU times: user 436 &#xB5;s, sys: 921 &#xB5;s, total: 1.36 ms
Wall time: 1.36 ms
</code></pre><p>When the framework accesses the cache for the second time, it skips connecting to your provider&#x2019;s API and fetches the same answer from the data store. This not only reduces costs but also offers a speed benefit of almost 15 times. </p><p>However, there are downsides, such as increased complexity but I won&apos;t go into more detail on that&#x2014;every engineer knows how caching can generate problems. And to be fair, you don&#x2019;t necessarily need LangChain to set up exact caching. It&#x2019;s easy to implement in any programming language or framework. For example, the effort would be similar even in Ruby on Rails, which is my usual coding environment.</p><p>But there are some unique downsides to caching with LLMs that many might find new. One major issue is that the response from the model will remain unchanged until the cache expires. This might work well for certain AI products, but it&#x2019;s less than ideal for others&#x2014;particularly those focused on content generation. For example, if you ask an LLM to write a blog post and it produces the same one every time, it clearly is not very good at its job. However, in the case of a customer support chatbot, this might not be a concern at all.</p><h2 id="semantic-caching">Semantic&#xA0;caching</h2><p>The second issue becomes visible soon after implementing exact caching. One user might say &#x201C;Tell me a joke,&#x201D; while another asks &#x201C;Do you know any jokes?&#x201D; Because these sentences don&#x2019;t match exactly, the cache will be bypassed.</p><p>This is where semantic caching and tools like&#xA0;<a href="https://github.com/zilliztech/GPTCache?ref=kamil.fyi">GPTCache</a>&#xA0;become valuable. GPTCache uses embedding algorithms to transform queries into embeddings, employing a vector store for similarity searches on these embeddings. Through this method, GPTCache can recognize and fetch similar or related queries from the cache, enhancing efficiency.</p><p>We can integrate GPTCache with LangChain to enhance our previous example.</p><pre><code class="language-python">import hashlib

from gptcache import Cache
from gptcache.adapter.api import init_similar_cache
from langchain.cache import GPTCache

def get_hashed_name(name):
    return hashlib.sha256(name.encode()).hexdigest()

def init_gptcache(cache_obj: Cache, llm: str):
    hashed_llm = get_hashed_name(llm)
    init_similar_cache(cache_obj=cache_obj, data_dir=f&quot;similar_cache_{hashed_llm}&quot;)

set_llm_cache(GPTCache(init_gptcache))
</code></pre><pre><code class="language-python">%%time
# This is an exact match, so it finds it in the cache
llm(&quot;What&apos;s GitHub?&quot;)
</code></pre><pre><code class="language-python">&quot;GitHub is a developer platform that allows developers to create, store, manage and share their code.&quot;
</code></pre><pre><code class="language-python">%%time
# This is not an exact match, but semantically within distance so it hits!
llm(&quot;Explain what GitHub is.&quot;)
</code></pre><pre><code class="language-python">&quot;GitHub is a developer platform that allows developers to create, store, manage and share their code.&quot;
</code></pre><p>This time, even though our second query wasn&#x2019;t identical to the first, we still managed to hit the cache successfully.</p><p>This solution has its drawbacks, too. With a semantic cache, you might face false positives during cache hits and false negatives during cache misses. So, not only have we added a caching system that increases complexity, but we&#x2019;ve also introduced a particularly complex type of cache. Hopefully, when we weigh these challenges against potential savings, they will justify the effort involved.</p><div class="kg-card kg-callout-card kg-callout-card-grey"><div class="kg-callout-emoji">&#x1F914;</div><div class="kg-callout-text">Now, you can see why opting for a dedicated framework like LangChain might be more optimal than just querying external APIs. Both GPTCache and LLMLingua, which we discussed earlier, are available as integrations within LangChain&apos;s framework, allowing for seamless chaining. The more complex your required chains are, the more it makes sense to invest in a solid foundation to support them.</div></div><h2 id="fine-tuning-and-model-swapping">Fine-tuning and model-swapping</h2><p>If you prefer not to use caching, there&#x2019;s another strategy to consider. We&#x2019;re in the middle of the AI boom; with the tech improving quickly, everyone wants to use the latest, state-of-the-art models. However, it can sometimes be more practical to opt for a less advanced LLM and tailor it to your specific needs through fine-tuning.</p><p>Fine-tuning is a method where a pre-trained model undergoes additional training on a smaller, specialized dataset. This process adjusts the model&#x2019;s parameters to improve its performance on tasks related to this new data. It&#x2019;s like an experienced chef refining a new recipe by tweaking their methods. This approach enables the model to become more specialized, boosting its effectiveness on specific tasks without having to be developed from the ground up.</p><p>For example, if we assign a task to GPT-4, it might perform well 80% of the time, while GPT-3.5 might only succeed in 60% of cases for the same task. However, by fine-tuning GPT-3.5 with sufficient specific examples demonstrating how to complete that task, it can eventually match the performance of its newer counterpart.</p><p>Research shows that fewer than 1000 data points can be enough for effective fine-tuning. Just 100 data points led to a 96% improvement in GPT-3.5&#x2019;s ability to answer questions in JSON format, and 1000 data points were enough to surpass GPT-4 in generating raw responses. While GPT-4&#x2019;s pricing is $0.03 per 1000 tokens for inputs and $0.06 per 1000 tokens for outputs, GPT-3.5&#x2019;s costs are much lower, at only $0.0005 per 1000 tokens for inputs and $0.0015 per 1000 tokens for outputs. This represents a 60x cost improvement!</p><div class="kg-card kg-callout-card kg-callout-card-yellow"><div class="kg-callout-emoji">&#x1F914;</div><div class="kg-callout-text">Got any questions about this week&#x2019;s article? Feel free to respond to this email or post a comment once <a href="https://kamil.fyi/#/portal/signup" rel="noreferrer">you&#x2019;ve upgraded your subscription.</a></div></div><p>If you&apos;re interested, here&#x2019;s a 4-step playbook you can follow.</p><p><strong>Step 1.</strong> Begin with the most advanced model required for your application&#x2019;s needs. For 95% of companies, this would be GPT-4, but probably not Turbo, as you&#x2019;re aiming for the highest quality outputs. These will serve as the basis for fine-tuning a smaller model.</p><p><strong>Step 2.</strong> Keep a record of your requests and responses in a format that allows for easy export.</p>]]></content:encoded></item><item><title><![CDATA[The Facts Are Friendly]]></title><description><![CDATA[People and startups grow by facing reality.]]></description><link>https://kamil.fyi/the-facts-are-friendly/</link><guid isPermaLink="false">65d204177b6401001d2bf710</guid><category><![CDATA[Startups]]></category><dc:creator><![CDATA[Kamil Nicieja]]></dc:creator><pubDate>Sun, 18 Feb 2024 13:49:49 GMT</pubDate><media:content url="https://kamil.fyi/content/images/2024/02/historical-footage-of-california-during-the-gold-rush-351070729.jpeg" medium="image"/><content:encoded><![CDATA[<div class="kg-card kg-callout-card kg-callout-card-blue"><div class="kg-callout-emoji">&#x1F989;</div><div class="kg-callout-text"><a href="https://kamil.fyi/" rel="noreferrer"><i><b><strong class="italic" style="white-space: pre-wrap;">Before Growth</strong></b></i></a> is a weekly newsletter about startups and their builders before product&#x2013;market fit, by 3x founder and programmer Kamil Nicieja.</div></div><ul><li>The facts are always friendly, every bit of evidence one can acquire, in any area, leads one that much closer to what is true.</li><li>Why does Sam Altman need $7 trillion?</li><li>Should a semiconductor company be worth more than the energy sector?</li><li>We discuss Sora, a new text-to-video AI model from OpenAI.</li></ul><hr><img src="https://kamil.fyi/content/images/2024/02/historical-footage-of-california-during-the-gold-rush-351070729.jpeg" alt="The Facts Are Friendly"><p><strong>&#x1F64F; My work is </strong><a href="https://kamil.fyi/#/portal/signup" rel="noreferrer"><strong>reader&#x2013;supported</strong></a><strong>.</strong> You can <a href="https://kamil.fyi/#/portal/signup" rel="noreferrer">get a membership here!</a></p><p>&#x1F4E3;&#xA0;<strong>Before Growth has grown through word of mouth.</strong> Want to help? Share it&#xA0;on Twitter&#xA0;<a href="https://twitter.com/intent/tweet?url=https%3A%2F%2Fkamil.fyi&amp;text=Love+this+newsletter+about+early-stage+projects.+Hand-picked+startup+intel+that%E2%80%99ll+put+you+ahead+of+the+curve%2C+straight+from+one+founder+to+another.+Check+it+out%21&amp;ref=kamil.fyi" rel="noreferrer">here,</a> Facebook&#xA0;<a href="https://facebook.com/sharer/sharer.php?u=https://kamil.fyi" rel="noreferrer">here,</a> or LinkedIn <a href="https://linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fkamil.fyi&amp;ref=kamil.fyi" rel="noreferrer">here</a>.</p><p>&#x1F4DA; My new ebook <strong><em>Generative AI in Product Design</em></strong> offers case studies on AI and just enough theory for you to build your next app with gen AI. <a href="https://kamil.fyi/generative-ai-in-product-design/"><strong>Get your copy here!</strong></a></p><div class="kg-card kg-callout-card kg-callout-card-green"><div class="kg-callout-emoji">&#x1F5D3;&#xFE0F;</div><div class="kg-callout-text">Let&#x2019;s dive into this week&#x2019;s recap.</div></div><h3 id="funding%E2%80%A6-funding-finds-a-way">Funding&#x2026; funding finds a way</h3><p>Carta&#x2019;s new&#xA0;<a href="https://media.superhuman.com/images/_/https%3A%2F%2Fwww.emailimagecdnu8yd.com%2Fc3g6im84wx%2Fen_us%2Fimages%2F65cd53735ef91-1707955059.389.png?ref=kamil.fyi">research</a>&#xA0;points out that overall investment has dipped in nearly every stage of venture funding when you look at 2023 compared to 2021. Yet, when you dive deeper into the numbers, something interesting pops up. Money flowing into pre-seed companies&#x2014;which means those raising under $1 million through SAFEs or convertible notes&#x2014;has actually jumped over 50% from 2021.</p><p>However, it&#x2019;s worse for companies in the mid-to-late stages where the downturn continues with little improvement. To get back on track and push through the financial gloom in 2024, there&#x2019;s a real need for a boost in late-stage venture investments.</p><h3 id="why-does-sam-altman-need-7-trillion">Why does Sam Altman need $7 trillion?</h3><p>Scott Alexander recently&#xA0;<a href="https://www.astralcodexten.com/p/sam-altman-wants-7-trillion?ref=kamil.fyi">shared</a>&#xA0;some intriguing thoughts on the scaling up of GPTs, explaining why Sam Altman of OpenAI is looking for ways to dramatically increase the world&#x2019;s computing capacity. According to Alexander, GPT-6 might need about 10% of the world&#x2019;s computers, enough energy to rival a large power plant, and more training data than we currently have access to. This could mean setting up a data center as big as a small town, powered by an extensive setup of solar panels or maybe a nuclear reactor. Alexander also mentioned that, as things stand, creating GPT-8 seems impossible. Even if we make leaps in synthetic data, harness fusion power, and take over the entire semiconductor industry, it still wouldn&#x2019;t be enough to make it a reality&#x2014;not without a breakthrough.</p><p>This insight also seems to suggest that OpenAI&#x2019;s current strategy revolves &#x201C;just&#x201D; around linear scaling. There are no hidden projects in the pipeline. The focus remains on developing larger models and making incremental improvements&#x2014;until we devise a more efficient architecture. And there&#x2019;s definitely room for improvement; after all, human brains achieve similar or better results without needing as much data or training.</p><h3 id="should-a-semiconductor-company-be-worth-more-than-the-energy-sector">Should a semiconductor company be worth more than the energy sector?</h3><p>Still on the subject of chips, Nvidia&#x2019;s share price is hovering around $700 as of this writing,&#xA0;<a href="https://twitter.com/Barchart/status/1758471331493154934?ref=kamil.fyi">making</a>&#xA0;it more valuable than the entire S&amp;P 500 Energy Sector with a market cap close to $1.8 trillion. I recently chose to invest in it, along with a few other companies, and then found out that a good portion of financial Twitter seems to think the stock is in a bubble. Lucky me. As always. But is it really? (Knowing my luck, probably yes.)</p><p>To be honest, I&#x2019;ve got no idea. I&#x2019;m not a professional investor, so take my words on stocks with a grain of salt and do your own research. I&#x2019;m just sharing my observations from the last couple of months. Some folks are drawing parallels between Nvidia&#x2019;s rapid growth and Cisco&#x2019;s during the dot-com bubble, which isn&#x2019;t a far-fetched comparison. Both companies provided the infrastructure for new trends like the internet or AI. Early in the growth curve of a trend, it makes sense to back infrastructure providers since the eventual winners aren&#x2019;t yet clear, and in many cases, haven&#x2019;t even emerged. But there&#x2019;s always money to be made by selling shovels during a gold rush.</p><p>Other analysts&#xA0;<a href="https://twitter.com/fromvalue/status/1757956217958232520?ref=kamil.fyi">argue</a>&#xA0;that chart comparisons can be manipulated to prove anything, depending on your starting point. They note that Nvidia&#x2019;s stock would need to triple in the next 433 days to reach the levels seen during the dot-com bubble. Some even&#xA0;<a href="https://twitter.com/stockmktnewz/status/1758248702169464971?ref=kamil.fyi">set</a>&#xA0;a price target of $1,200 for it. However, if Nvidia&apos;s price were $1,200 today, its valuation would surpass Apple&#x2019;s&#x2026; You can see why I&#x2019;m feeling anxious, right?</p><p>No matter your thoughts on Nvidia, it&#x2019;s clear the market is showing some bubble-like behavior right now. Supermicro, under the ticker $SMCI, just experienced a 20% drop in a single day from its peak, now trading at around $800 a share. To put that in perspective, it was trading at about $100 per share in early 2023, marking an 800% increase in just over a year. Yeah, reasonable, nothing to see here. What does Supermicro do? To be honest, I wasn&#x2019;t familiar with the company until I started digging into this. They sell servers, apparently. And in 2024, is that really worth so much? Probably not&#x2014;but in June 2023, there was a spike in demand for Supermicro&#x2019;s AI systems optimized for large language models, thanks to NVIDIA chips. So, that &#x201C;explains&#x201D; the surge&#x2026;</p><p>If that doesn&#x2019;t scream bubble, then I&#x2019;m not sure what does.</p><p>There are other telling economic signs too. Cash has&#xA0;<a href="https://twitter.com/gameoftrades_/status/1758151681274216955?ref=kamil.fyi">become</a>&#xA0;a more appealing option than stocks, which means there&#x2019;s less reward for taking risks and more for just holding onto cash. This scenario last played out just before the dot-com crash. Currently, we&#x2019;re witnessing an extraordinary wave of insider selling. Jeff Bezos just offloaded shares of Amazon valued at $6 billion, while Mark Zuckerberg sold $840 million worth of Meta shares, Netflix&#x2019;s CEO sold $40 million, and Palantir insiders sold another $35 million. The last time we saw this level of selling activity was in 2022, right before the Nasdaq took a 30% hit. Meanwhile, Japan and the UK are facing recessions, Germany narrowly&#xA0;<a href="https://www.reuters.com/markets/europe/german-economy-contracted-03-2023-stats-office-2024-01-15/?ref=kamil.fyi">avoided</a>&#xA0;one despite its economy shrinking by 0.3% in 2023, and the European Union&apos;s economy technically grew by 0.1% last year&#x2014;but yeah, it&#x2019;s not really that optimistic&#x2026;</p><p>Though it&#x2019;s a bit off-topic for this newsletter, I know a lot of us are into tech investments, so I thought I&#x2019;d share how my thinking on the matter is shaping up.</p><div class="kg-card kg-callout-card kg-callout-card-green"><div class="kg-callout-emoji">&#x1F4A1;</div><div class="kg-callout-text">Bits are a curated collection of interesting links worth a quick share.</div></div><h3 id="bits">Bits</h3><ul><li><a href="https://openai.com/sora?ref=kamil.fyi">Sora</a>&#xA0;is an AI model developed by OpenAI that&#x2019;s capable of generating realistic video from text prompts. It&#x2019;s pretty mind-blowing. Definitely give it a look if you haven&#x2019;t yet, though I&#x2019;d be surprised if you haven&#x2019;t come across it already. It&#x2019;s blowing up on Twitter. There&#x2019;s not much more I can say right now since it&#x2019;s still not widely available to the public.</li><li>Zuckerberg&#xA0;<a href="https://twitter.com/pitdesi/status/1758537534072906159?ref=kamil.fyi">believes</a>&#xA0;that glasses will become the mobile devices of the future, while headsets are set to be the laptops of the future. Yeah, I can see that happening.</li><li>OpenAI is currently&#xA0;<a href="https://openai.com/blog/memory-and-new-controls-for-chatgpt?ref=kamil.fyi">testing</a>&#xA0;a feature that allows ChatGPT to recall things from your chats, aiming to make future conversations more useful. This is actually something I suggested in my blog post about&#xA0;<a href="https://kamil.fyi/context-windows/">context windows.</a>&#xA0;So, if anyone from OpenAI is reading this, I&#x2019;m open to sharing more insights and ideas!</li><li>A mob recently&#xA0;<a href="https://www.notion.so/The-Facts-Are-Friendly-e157ca1e1b6641b68f080a0584619516?pvs=21&amp;ref=kamil.fyi">wrecked</a>&#xA0;a driverless Waymo car in San Francisco. For more than ten years, I&#x2019;ve toyed with a story idea about riots breaking out in the city, sparked by massive job losses among two key groups: drivers, due to autonomous vehicles, and retail employees, because of self-checkout grocery stores. This incident would serve as a gripping start to the tale. To make the story even more relevant today, I&#x2019;d include the angle of office workers being laid off because of advancements like ChatGPT. But it&#x2019;s all just a story&#x2026; isn&#x2019;t it?</li><li><a href="https://github.com/joaomdmoura/crewAI?ref=kamil.fyi">CrewAI</a>&#xA0;is a framework designed to manage role-playing, autonomous AI agents. It encourages collaborative intelligence, enabling these agents to work together smoothly to handle complicated tasks.</li><li>Air Canada has&#xA0;<a href="https://arstechnica.com/tech-policy/2024/02/air-canada-must-honor-refund-policy-invented-by-airlines-chatbot/?ref=kamil.fyi">found</a>&#xA0;itself in a position where it needs to stick to a refund policy that was unintentionally invented by its chatbot. It&apos;s a good reminder that ChatGPT started off as a research demo, largely because the technology it&#x2019;s built on can still be a bit unreliable and not always prepared for widespread deployment.</li><li>A&#xA0;<a href="https://thepointmag.com/criticism/very-ordinary-men/?ref=kamil.fyi">review</a>&#xA0;of Walter Isaacson&#x2019;s &#x201C;Elon Musk&#x201D;. There&#x2019;s a lot in there that didn&#x2019;t vibe with me, but I do echo the sentiment that Isaacson seems to ignore the truly fascinating aspects of leaders like Musk or Steve Jobs, who also had a biography he wrote. For example, the part where Musk&#x2019;s first son passes away is quickly covered and then it&#x2019;s straight back to rocket science, human emotions be damned. That&#x2019;s actually where I started to lose interest in the book. &#x201C;Steve Jobs&#x201D; felt similar in that respect. If you&#x2019;re looking for a deeper dive when it comes to Apple&#x2019;s founder, I&#x2019;d point you towards Brent Schlender&#x2019;s <a href="https://www.amazon.com/Becoming-Steve-Jobs-Evolution-Visionary/dp/0385347421?nodl=1&amp;dplnkId=6ff35a70-860b-4bfc-9543-96280c637472&amp;ref=kamil.fyi" rel="noreferrer">&#x201C;Becoming Steve Jobs,&#x201D;</a> which is much better. It genuinely attempts to paint a full picture of who Jobs was, capturing both his flaws and his brilliance, instead of reading like a boring history book.</li></ul><hr><h2 id="today%E2%80%99s-topic">Today&#x2019;s topic</h2><p>Imagine two founders.</p><p>The first entrepreneur is new to this and hasn&#x2019;t launched a startup before. They&#x2019;ve managed to secure their first investment meeting, but the fact that they don&#x2019;t even have a hundred users is making them feel insecure. In an attempt to make things look better, they tweak the numbers in their pitch deck, making it seem like all their users are actively engaging every month. Or they stretch the truth in a different slide&#x2014;maybe not exactly a lie, but more like they leave out a tiny detail or phrase something in a way that&#x2019;s a bit more positive than it really is. They&#x2019;re hoping that by the time anyone double-checks these figures, the startup will have grown to match these numbers anyway. No harm done.</p><p>The second founder comes with experience, feeling confident from a successful exit in their past venture. Just like the first, they&#x2019;re at the beginning stages, but their numbers are even less impressive, with only tem daily active users. A few days after the first founder, they present the raw numbers to the same venture capital firm.</p><p>Who do you think is more likely to get funded?</p><p>The second founder has the edge. At this early phase, investing in people is the smart move. So, if someone with a proven track record approaches you, it&#x2019;s likely you&#x2019;ll invest. They&#x2019;ve succeeded before, suggesting they can do it again. However, given the abundance of capital in these funds, and considering that early-stage VCs and startup accelerators often discover relatively unknown talents and fund their ideas, the less experienced founder isn&#x2019;t necessarily at a disadvantage.</p><p>However, following the next investment committee meeting, it turns out that the less experienced founder does, in fact, end up losing. Why?</p><!--members-only--><p>VCs and other people in power tend to get really good at spotting when someone&#x2019;s not being completely honest with them, especially if it&#x2019;s to get something they want. If they take a closer look, they&#x2019;ll realize the foundations aren&#x2019;t that strong. Having a small group of users who are really into what you&#x2019;re doing is way better than &#x201C;having&#x201D; lots of users who look like they hardly pay attention. The second founder can easily share stories about how their project made a real difference for each of their users, and even provide references. The first founder, on the other hand, might not have those kinds of stories to tell and could end up bending the truth too far by inventing them, too, crossing further into outright dishonesty. Like a death spiral.</p><p>Fame, money, and ambition can lead people to make some questionable choices. It&#x2019;s not by chance that shows like &#x201C;Silicon Valley&#x201D; on HBO highlight manipulating investors, employees, and the press as a common issue in startup culture. I don&#x2019;t think it&#x2019;s a deep-rooted part of our culture, but we do see it pop up now and then, with cases like FTX grabbing headlines. When there&#x2019;s a ton of money at stake, it&#x2019;s easier to drift away from your original values. And just to be clear, I&#x2019;m not saying that all first-time founders are out there juicing the numbers; it&#x2019;s just a story that a friend shared with me, told anonymously.</p><p>Personally, I strongly believe that the truth always surfaces eventually. The situation with FTX and other similar cases proves that point. In our story, treating the truth as something to be avoided actually backfires, because the founder ends up not getting the investment anyway. As Dostoyevsky wrote, &#x201C;Your worst sin is that you have destroyed and betrayed yourself for nothing.&#x201D;</p><p>I get where the first founder is coming from. Even in situations at work that aren&#x2019;t worth billions of dollars, if I feel like I messed up, there&#x2019;s sometimes this little voice in my head whispering, &#x201C;Maybe we can just... hide it?&#x201D; Nobody wants to look bad or get the blame when things go bad. So if I keep quiet, maybe no one will notice. Maybe I can tweak the truth just a bit so it doesn&#x2019;t look like my fault. I think everybody hears this voice from time to time. But it&apos;s never worth listening to it. Being open and simply dealing with the issue is always the better route. If you end up losing your job over being honest, the worst case scenario, then maybe that&#x2019;s for the best. In my experience, working for someone who can&#x2019;t handle the truth comes back to bite you eventually. They will use that against you sooner or later.</p><div class="kg-card kg-callout-card kg-callout-card-yellow"><div class="kg-callout-emoji">&#x1F914;</div><div class="kg-callout-text">If you&#x2019;ve got any questions about this week&#x2019;s essay, feel free to respond to this email or post a comment once <a href="https://kamil.fyi/#/portal/signup" rel="noreferrer">you&#x2019;ve upgraded your subscription.</a></div></div><p>Carl Rogers, the famous psychotherapist, once said, &#x201C;The facts are always friendly, every bit of evidence one can acquire, in any area, leads one that much closer to what is true.&#x201D; He believed that facing reality is how people grow. Often, people might cherry-pick information that aligns with their preferred viewpoint. While this might feel comforting, it can lead to a denial of reality or attempts to twist it&#x2014;as we&#x2019;ve seen in our story. Rogers argued that we should embrace new information, even if it proves our previous beliefs wrong or makes us uncomfortable, because truth has a healing power that helps us move forward.</p><p>I agree. Don&#x2019;t be afraid.</p><div class="kg-card kg-callout-card kg-callout-card-blue"><div class="kg-callout-emoji">&#x1F4EC;</div><div class="kg-callout-text">Did a friend forward this to you? <a href="https://kamil.fyi/#/portal/signup" rel="noreferrer">Subscribe</a> now to get the latest updates delivered straight to your inbox every week.</div></div>]]></content:encoded></item><item><title><![CDATA[On a Scale From One to Ten, With No Sevens]]></title><description><![CDATA[Eliminate the safe option.]]></description><link>https://kamil.fyi/on-a-scale-from-one-to-ten-with-no-sevens/</link><guid isPermaLink="false">65c3f06c7b6401001d2bdd89</guid><category><![CDATA[Managing]]></category><dc:creator><![CDATA[Kamil Nicieja]]></dc:creator><pubDate>Wed, 07 Feb 2024 21:41:47 GMT</pubDate><media:content url="https://kamil.fyi/content/images/2024/02/a-dramatic-powerful-storm-over-the-ocean-with-dark-swirling-clouds-lightning-strikes-illuminatin-724698872.jpeg" medium="image"/><content:encoded><![CDATA[<div class="kg-card kg-callout-card kg-callout-card-blue"><div class="kg-callout-emoji">&#x1F989;</div><div class="kg-callout-text"><a href="https://kamil.fyi/" rel="noreferrer"><i><b><strong class="italic" style="white-space: pre-wrap;">Before Growth</strong></b></i></a> is a weekly newsletter about startups and their builders before product&#x2013;market fit, by 3x founder and programmer Kamil Nicieja.</div></div><img src="https://kamil.fyi/content/images/2024/02/a-dramatic-powerful-storm-over-the-ocean-with-dark-swirling-clouds-lightning-strikes-illuminatin-724698872.jpeg" alt="On a Scale From One to Ten, With No Sevens"><p>Scoring a 7 out of 10 in, well, pretty much <em>anything</em> is quite good, you know? Not super amazing, but definitely better than just okay. What a nice, comfortable spot to be in. Fuck 7s.</p><p>We&#x2019;ll also explore nine exciting new startups to understand where some markets might be going in the next few years, thanks to the current boom in AI technology.</p><h3 id="quick-hits">Quick hits</h3><ul><li><a href="https://www.sling-shot.ai/?ref=kamil.fyi">Slingshot</a>&#xA0;is working on the next wave of video games, where characters and gameplay are driven by generative AI. This concept sounds really cool! I expect that future waves of indie games will use mechanics like these, much like how they currently do with randomly generated maps.</li><li><a href="https://smobi.com/?ref=kamil.fyi" rel="noreferrer">Smobi</a>&#xA0;is a marketplace designed to simplify the process of purchasing businesses valued at $5 million or less by overseeing the entire transaction directly through their platform. If&#xA0;<a href="https://www.opendoor.com/?ref=kamil.fyi">Opendoor</a>&#xA0;can revolutionize real estate sales and&#xA0;<a href="https://open.store/?ref=kamil.fyi">OpenStore</a>&#xA0;can manage Shopify shops, then why not provide a similar service for small and medium-sized businesses?</li><li><a href="https://checkfragment.com/?ref=kamil.fyi">Fragment</a>&#xA0;integrates human supervision into automated processes, an approach known as human-in-the-loop. While the current wave of generative AI is getting smarter by the day, it&#x2019;s getting clear that it isn&#x2019;t capable of replacing most human jobs. However, what AI excels at is quickly and automatically evaluating large data sets. Fragment enables human agents to step in to handle fallback or review tasks when the AI encounters errors.</li><li><a href="https://www.flintk12.com/?ref=kamil.fyi">Flint</a>&#xA0;lets teachers leverage AI for personalized learning experiences by creating chatbots to tutor or assess students through one-on-one conversations. With Flint, teachers can establish rules for the AI, specify reading levels, and set grading criteria. The AI then adapts to each student&#x2019;s level and provides assistance when they encounter difficulties. When UX research&#xA0;<a href="https://kamil.fyi/the-articulation-barrier/">shows</a>&#xA0;that Bing Chat&apos;s responses are calibrated at a 13th-grade reading level, similar to what a university freshman might encounter, while ChatGPT responds at an impressive 16th-grade reading level, there&#x2019;s a clear need for a tool that kids can use.</li><li><a href="https://www.casehopper.com/?ref=kamil.fyi">Casehopper</a>&#xA0;is streamlining the immigration process using AI. It&#x2019;s clear that the legal industry is ripe for&#xA0;<em>some </em>disruption due to LLMs, even though changing how lawyers operate will undoubtedly be challenging&#x2014;as it always is. It&#x2019;s reasonable to expect that certain legal workflows, such as visa processing, will become more efficient with the latest technology.</li><li>Patents can be another similar example.&#xA0;<a href="https://www.solveintelligence.com/?ref=kamil.fyi">Solve Intelligence</a>&#xA0;uses AI to help attorney write patents.</li><li><a href="https://corgea.com/?ref=kamil.fyi">Corgea</a>&#xA0;helps businesses fix vulnerable code, reducing engineering costs and time by 80%. Through AI-driven code fix generation, it streamlines the process, allowing engineers to approve fixes efficiently. Security is often not a top priority for startups until they grow bigger. But with AI helping out, that might change.</li><li>And&#xA0;<a href="https://trycontour.com/?ref=kamil.fyi">Contour</a>&#xA0;does the same for QA and end-to-end UI tests. The main trend in the coming years might be using big models like this one for specific needs. People who know a lot about certain problems will tweak these models to work better in different industries and situations.</li><li><a href="https://www.sideko.dev/?ref=kamil.fyi">Sideko</a>&#xA0;uses OpenAPI to make SDKs for your API that really work. This is a great idea because making libraries can be a hassle for developers. If it&#x2019;s automated, it&#x2019;s a big win for engineering teams eveywhere.</li></ul><hr><p><strong>&#x1F64F; My work is </strong><a href="https://kamil.fyi/#/portal/signup" rel="noreferrer"><strong>reader&#x2013;supported</strong></a><strong>.</strong> You can <a href="https://kamil.fyi/#/portal/signup" rel="noreferrer">get a membership here!</a></p><p>&#x1F4E3;&#xA0;<strong>Before Growth has grown through word of mouth.</strong> Want to help? Share it&#xA0;on Twitter&#xA0;<a href="https://twitter.com/intent/tweet?url=https%3A%2F%2Fkamil.fyi&amp;text=Love+this+newsletter+about+early-stage+projects.+Hand-picked+startup+intel+that%E2%80%99ll+put+you+ahead+of+the+curve%2C+straight+from+one+founder+to+another.+Check+it+out%21&amp;ref=kamil.fyi" rel="noreferrer">here,</a> Facebook&#xA0;<a href="https://facebook.com/sharer/sharer.php?u=https://kamil.fyi" rel="noreferrer">here,</a> or LinkedIn <a href="https://linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fkamil.fyi&amp;ref=kamil.fyi" rel="noreferrer">here</a>.</p><p>&#x1F4DA; My new ebook <strong><em>Generative AI in Product Design</em></strong> offers case studies on AI and just enough theory for you to build your next app with gen AI. <a href="https://kamil.fyi/generative-ai-in-product-design/"><strong>Get your copy here!</strong></a></p><hr><h3 id="today%E2%80%99s-topic">Today&#x2019;s topic</h3><p>Imagine this: Your HR department wants to run a pulse survey to gauge your team&#x2019;s feedback on a regular basis. Now it&#x2019;s your turn to contribute. They ask a question like, &#x201C;How likely are you to recommend your company as a place to work to people you know?&#x201D; Your experience at work has been generally positive&#x2014;not great, not terrible&#x2014;but there have been a few bumps along the way. Though maybe it&#x2019;s just you&#x2026;? In the end, you opt for a respectable 7 on the ten-point scale.</p><p>On another day, your manager asks you to rate them in a performance review. Despite having reservations about how they handle feedback when under pressure but, after all, who doesn&#x2019;t get defensive when cornered? Wanting to avoid unnecessary drama, you settle on another solid 7.</p><p>It&apos;s a few days after the new year. As you try to pick up the habit of journaling with a shiny new app, it gives you a writing prompt that asks you to rate your day and explain your reasons. Deep down, you sense that things have been a bit off for a while now&#x2026; but perhaps it&#x2019;s just the winter blues? The cold and darkness could easily be to blame. Besides, you pride yourself on being a positive person with a strong sense of agency. You convince yourself that things haven&#x2019;t been too bad after all. In the end, your rating lands on a 7 once again&#x2014;there&#x2019;s still hope for improvement, right?</p><p>Do you see where I&#x2019;m going with this?</p><p>A seven often is as a non-answer, crafted to avoid causing offense to anyone&#x2014;including yourself. This is perfectly normal. We humans are social creatures. We want to maintain harmony and avoid upsetting others without a reason. Even when there is cause for criticism, we may still go to great lengths to sidestep confrontation if we don&#x2019;t deem it absolutely necessary. This approach is not a bad day-to-day strategy; it often fosters cohesion in groups.</p><p>However, there are times when prioritizing truth-seeking is more important than maintaining cohesion. In each of the three scenarios outlined earlier, it would better if individuals were compelled to choose the confrontational option. The workplace cannot progress if feedback on issues is withheld. A manager cannot address and improve their behavior if they remain unaware of its impact. And if you convince yourself you&#x2019;re fine when you&#x2019;re not, you may delay the acknowledgment of the need for change.</p><!--members-only--><p>So next time you design a system meant to uncover issues, have people rate stuff on a scale from one to ten&#x2014;but with no sevens.</p><p>Eliminating the &#x201C;safe&#x201D; option will prompt them to consider which extreme they lean toward&#x2014;are things good or bad? This encourages everyone to recognize that it&#x2019;s&#xA0;<em>fine</em>&#xA0;to feel dissatisfied and that raising concerns is expected. Hopefully, it also creates an environment where problems are addressed in a peaceful and productive manner when brought to light. However, that&#x2019;s a separate matter altogether, and it&#x2019;s important for you not to panic when people&#xA0;<em>finally</em>&#xA0;start telling you the truth.</p><div class="kg-card kg-callout-card kg-callout-card-blue"><div class="kg-callout-emoji">&#x1F4EC;</div><div class="kg-callout-text">Did a friend forward this to you? <a href="https://kamil.fyi/#/portal/signup" rel="noreferrer">Subscribe</a> now to get the latest updates delivered straight to your inbox every week.</div></div>]]></content:encoded></item><item><title><![CDATA[Is ChatGPT the New Alexa?]]></title><description><![CDATA[Did any custom GPTs get traction or is that playing out like Alexa skills?]]></description><link>https://kamil.fyi/is-chatgpt-the-new-alexa/</link><guid isPermaLink="false">65bad3f63f3e93001dfa0f75</guid><category><![CDATA[AI]]></category><dc:creator><![CDATA[Kamil Nicieja]]></dc:creator><pubDate>Wed, 31 Jan 2024 23:13:43 GMT</pubDate><media:content url="https://kamil.fyi/content/images/2024/01/a-detailed-view-of-an-amazon-alexa-smart-speaker-on-a-table-with-the-focus-on-the-device-the-speak-642329295.jpeg" medium="image"/><content:encoded><![CDATA[<div class="kg-card kg-callout-card kg-callout-card-blue"><div class="kg-callout-emoji">&#x1F989;</div><div class="kg-callout-text"><a href="https://kamil.fyi/" rel="noreferrer"><i><b><strong class="italic" style="white-space: pre-wrap;">Before Growth</strong></b></i></a> is a weekly newsletter about startups and their builders before product&#x2013;market fit, by 3x founder and programmer Kamil Nicieja.</div></div><ul><li>OpenAI suggests that AGI is close, but then they launch something like the GPT Store. You&#x2019;d think if they were really close to making AGI, they&#x2019;d do something bigger or more important with it, right?</li><li>Staying on the topic, another new platform: Apple Vision Pro and its use cases.</li></ul><hr><img src="https://kamil.fyi/content/images/2024/01/a-detailed-view-of-an-amazon-alexa-smart-speaker-on-a-table-with-the-focus-on-the-device-the-speak-642329295.jpeg" alt="Is ChatGPT the New Alexa?"><p><strong>&#x1F64F; My work is </strong><a href="https://kamil.fyi/#/portal/signup" rel="noreferrer"><strong>reader&#x2013;supported</strong></a><strong>.</strong> You can <a href="https://kamil.fyi/#/portal/signup" rel="noreferrer">get a membership here!</a></p><p>&#x1F4E3;&#xA0;<strong>Before Growth has grown through word of mouth.</strong> Want to help? Share it&#xA0;on Twitter&#xA0;<a href="https://twitter.com/intent/tweet?url=https%3A%2F%2Fkamil.fyi&amp;text=Love+this+newsletter+about+early-stage+projects.+Hand-picked+startup+intel+that%E2%80%99ll+put+you+ahead+of+the+curve%2C+straight+from+one+founder+to+another.+Check+it+out%21&amp;ref=kamil.fyi" rel="noreferrer">here,</a> Facebook&#xA0;<a href="https://facebook.com/sharer/sharer.php?u=https://kamil.fyi" rel="noreferrer">here,</a> or LinkedIn <a href="https://linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fkamil.fyi&amp;ref=kamil.fyi" rel="noreferrer">here</a>.</p><p>&#x1F4DA; My new ebook <strong><em>Generative AI in Product Design</em></strong> offers case studies on AI and just enough theory for you to build your next app with gen AI. <a href="https://kamil.fyi/generative-ai-in-product-design/"><strong>Get your copy here!</strong></a></p><hr><p>Do you use custom GPTs?</p><p>A few months back, OpenAI&#xA0;<a href="https://openai.com/blog/introducing-gpts?ref=kamil.fyi">introduced</a>&#xA0;the ability to customize ChatGPT with specific instructions, additional knowledge, and various skills. These custom GPTs can assist in learning board game rules, teaching math to children, or designing stickers. Following this, OpenAI&#xA0;<a href="https://openai.com/blog/introducing-the-gpt-store?ref=kamil.fyi">launched</a>&#xA0;the GPT Store, making it accessible to ChatGPT Plus, Team, and Enterprise users. This store offers a selection of popular and helpful GPTs.</p><p>I haven&apos;t talked much about the store yet, but I did have some&#xA0;<a href="https://kamil.fyi/there-are-no-experts-there-is-only-us/">thoughts</a>&#xA0;on GPTs themselves at their launch:</p><ul><li>Creators were attracting even up to 8,000 users with some successful bots on ChatGPT&#x2019;s platform. They benefited from SEO as OpenAI&#x2019;s public catalog ranks high on Google, too.</li><li>Some users felt the new features weren&#x2019;t very useful, believing they can create similar prompts themselves. This mirrored early views on Dropbox, where tech-savvy users felt they could replicate its services. In my opinion, the challenge lied in making GPTs&apos; advanced features more accessible to those with less technical expertise.</li><li>I wasn&#x2019;t certain about whether GPTs are apps, chatbots, or autonomous agents. The evolution of the concept of GPTs itself might have been based on the plugin concept&#x2014;but the original plugins weren&#x2019;t highly successful.</li><li>Some started using custom GPTs to integrate company documents, showing potential as knowledge bases.</li><li>GPTs might be evolving into Character AI, focusing on artificial personas, though their potential to become platforms for autonomous agents is uncertain, with Actions allowing GPTs to interact with the real world through APIs, potentially evolving into platforms performing tasks independently.</li></ul><p>Did any of this happen?</p><p>OpenAI reports that users have created more than 3 million custom versions of ChatGPT. However, I haven&#x2019;t come across any that have went viral, say, taking over Twitter in a single night. It seems that these customizations are primarily used for internal workflows&#x2014;which is exactly how I use this feature myself. Let me show you.</p><p>I&apos;ve developed three GPTs for my personal use: Summarize, Rewrite, and Density.</p><ul><li>The first two aren&apos;t overly complicated. <em>Summarize</em> does just that&#x2014;it summarizes articles into bullet points for busy, intelligent readers. I use it to assist in drafting Bits for this newsletter.</li><li><em>Rewrite</em> was also straightforward to create: it rewrites text to sound as if it were written by a native English speaker. I draft all my articles by hand, but editing takes up a significant amount of time because English is not my first language. It&#x2019;s not that my English skills are lacking, but for some reason, when I edit on my own, I spend hours tweaking and adjusting, never quite satisfied with the outcome. Rewrite solves this.</li><li><em>Density</em> is the most intricate of the three.&#xA0;<a href="https://kamil.fyi/no-work-is-ever-wasted/">It&#x2019;s a technique developed by the Salesforce AI team,</a>&#xA0;offering a new method for summarizing text using LLMs. Given that many people use LLMs for summarization, the chain-of-density method stands out due to its strong performance in human preference studies, highlighting its value. Remarkably, this approach integrates smoothly with the standard GPT-4 without any need for fine-tuning, underscoring the potential for discovering effective prompting strategies. I turn to it when the basic Summarize doesn&#x2019;t work very well.</li></ul><p>But they&#x2019;re not apps, chatbots, or autonomous agents as I anticipated. They are&#xA0;<em>shortcuts.</em>&#xA0;That&#x2019;s precisely how I created them for my use&#x2014;I integrated them into my&#xA0;<a href="https://openai.com/blog/custom-instructions-for-chatgpt?ref=kamil.fyi">custom instructions:</a></p><blockquote>Treat &#x201C;/rewrite&#x201D; as a shortcut for &#x201C;Rewrite as a native speaker would:&#x201D;<br><br>Treat &#x201C;/summarize&#x201D; as a shortcut for &quot;Summarize the following article using bullet points. Keep in mind I have limited time and need a concise, intelligent overview.&#x201D;</blockquote><p>Now, I don&#x2019;t even have to type the command; I can simply select a custom GPT from the sidebar or, if I&apos;m already in a conversation with ChatGPT, summon any specific GPT using @, similar to mentioning someone in a group chat. This feature is cool and useful since custom instructions are capped at 1500 characters&#x2014;yet this approach isn&#x2019;t exactly revolutionary. A similar point&#xA0;<a href="https://kamil.fyi/seeing-with-your-own-eyes/">came up in my article about AI-powered hardware</a>&#xA0;when I compared it to the previous generation of devices such as smart speakers:</p><blockquote>I brought up Alexa for a reason. Although I&#x2019;m keen to try them, I haven&#x2019;t yet experienced Meta&#x2019;s smart glasses firsthand, so my thoughts are speculative. I suspect that even with the integration of a multi&#x2013;modal large language model, this product may face challenges similar to those encountered by Amazon.<br><br>I own an Echo smart speaker and mainly use it for basic tasks like setting alarms, reminders, playing music, and checking the weather&#x2014;nothing transformative. This limited scope of use is one reason why Alexa hasn&#x2019;t established a sustainable business model, incurring an annual loss of about $10 billion. It was only with the advent of ChatGPT that a mass&#x2013;market product of this genre truly took off, rapidly becoming the fastest-growing consumer app ever.<br><br>This raises an intriguing question: Will smart glasses follow the trajectory of Alexa or that of ChatGPT?</blockquote><p>It appears that even ChatGPT struggles to match the success of its base version. Though the product remains highly useful, the platform doesn&#x2019;t seem as appealing&#x2014;not just to me, but likely to the broader audience as well.</p><p>I&apos;ve discussed ChatGPT with my friends who use it for various purposes&#x2014;some for coding as technical users, and others for more casual tasks. None of them use custom GPTs, likely because they don&#x2019;t deal with highly repetitive tasks often enough to feel the need&#x2014;and see the benefit. For instance, if you&#x2019;re a programmer, you don&#x2019;t really need a specialized GPT; chatting with the base model or using your text editor&#x2019;s Copilot does the job well enough. (And if you&#x2019;re a casual, you&#x2019;ll use ChatGPT to help you draft emails or do homework for you, which the base model does great, too.)</p><p>This leads me to believe that custom GPTs may carve out a niche in the enterprise market. Picture a typical company where every team has highly repetitive workflows or tasks they&#x2019;re looking to automate. These could be shared internally, making them accessible to all employees. Some of these GPTs might also function as knowledge bases. For example, the HR department could upload frequently asked questions about company policies to the platform. This seems like a practical application. While not groundbreaking, it&#x2019;s a solid product that OpenAI could successfully offer to many companies.</p><p>However, regarding consumer-oriented apps, I&#x2019;m not as convinced.</p><ul><li>Low customer awareness remains a challenge. ChatGPT, being a general tool, and GPT-4, currently the top model globally, are so effective&#x2014;even GPT-3.5 handles simple tasks well&#x2014;that many individuals don&#x2019;t see a need for a custom GPT. This presents a conflict of interest for OpenAI: maintaining the quality of the base model is crucial to keep users engaged.</li><li>The ability to market effectively is constrained. Text does not serve as an effective user interface for sales, impacting various e-commerce sectors that are unlikely to see significant benefits from adopting the GPT Store. From my experience&#x2014;I&#x2019;ve given it a shot. Not with ChatGPT, but I attempted to sell real estate using the Messenger platform. It was unsuccessful because chat platforms don&#x2019;t offer a better UI for browsing inventory.</li><li>The limited ability to deep-link presents a significant hurdle. Everything that is written using ChatGPT stays in ChatGPT. However, developers aim to leverage platforms for user acquisition, trying to then guide users towards their own apps. This introduces another conflict of interest&#x2014;as OpenAI will prefer to retain user engagement within its own ecosystem. And unlike Apple which doesn&#x2019;t make all the apps for iOS, OpenAI&#x2019;s main product already can do most of the things that GPTs made by others can do!</li><li>The absence of analytics is another notable limitation. For example, a significant area poised for development is the attribution of media, specifically crediting the underlying content that fuels AI queries. This involves determining how revenue should be allocated among publishers. However, we have yet to reach this level. In fact, GPT Store apps feature hardly any analytics!</li></ul><div class="kg-card kg-callout-card kg-callout-card-yellow"><div class="kg-callout-emoji">&#x1F914;</div><div class="kg-callout-text">If you&#x2019;ve got any questions about this week&#x2019;s essay, feel free to respond to this email or post a comment once <a href="https://kamil.fyi/#/portal/signup" rel="noreferrer">you&#x2019;ve upgraded your subscription.</a></div></div><h2 id="another-new-platform-apple-vision-pro">Another new platform: Apple Vision Pro</h2><p>While the majority of reviews are positive, people are still exploring and trying to understand the most effective applications of spatial computing.</p><p>I think Apple isn&#x2019;t viewing this as a new platform or a step towards the metaverse, but rather as an incredibly advanced type of monitor. I get it, because so many industries obsess over monitors&#x2014;graphic designers, programmers with 3-4 monitors at work, and I myself spent a lot on my gaming monitor&#x2026; yeah, yeah, I know. If Vision Pro is comfortable and has good battery life, instead of buying 4 monitors, I&#x2019;d just sit down, put it on my head, and have a whole wall as a monitor for my MacBook. That&#x2019;s why I believe Apple invested in top-class lenses that eliminate the pixelated view like in cheaper VR devices, which also explains the high price.</p><p>For me, this makes sense&#x2014;when I work remotely, I have my entire setup at home. But when I travel, say to London, I&#x2019;m stuck working on a small laptop. With this device, it&apos;s like carrying an infinite number of monitors with me. Maybe the high price isn&#x2019;t a huge barrier at the moment, considering the market and applications they&#x2019;re targeting?</p>]]></content:encoded></item><item><title><![CDATA[High Tolerance for Imbalance]]></title><description><![CDATA[Adapt or die.]]></description><link>https://kamil.fyi/high-tolerance-for-imbalance/</link><guid isPermaLink="false">65b2e5fb3f3e93001df9f557</guid><category><![CDATA[Startups]]></category><dc:creator><![CDATA[Kamil Nicieja]]></dc:creator><pubDate>Thu, 25 Jan 2024 23:06:24 GMT</pubDate><media:content url="https://kamil.fyi/content/images/2024/01/a-performer-skillfully-executing-a-balancing-act-on-a-tightrope-the-scene-is-set-outdoors-with-a-cl-564832009.jpeg" medium="image"/><content:encoded><![CDATA[<div class="kg-card kg-callout-card kg-callout-card-blue"><div class="kg-callout-emoji">&#x1F989;</div><div class="kg-callout-text"><a href="https://kamil.fyi/" rel="noreferrer"><i><b><strong class="italic" style="white-space: pre-wrap;">Before Growth</strong></b></i></a> is a weekly newsletter about startups and their builders before product&#x2013;market fit, by 3x founder and programmer Kamil Nicieja.</div></div><img src="https://kamil.fyi/content/images/2024/01/a-performer-skillfully-executing-a-balancing-act-on-a-tightrope-the-scene-is-set-outdoors-with-a-cl-564832009.jpeg" alt="High Tolerance for Imbalance"><p>Everyone has their methods for looking smart in meetings. Drawing Venn diagrams. Suggesting to take a step back. Some always ask, &#x201C;Will this scale?&#x201D; regardless of the actual context. Over my career, I&#x2019;ve observed another common tactic: saying &#x201C;We need a balanced approach.&#x201D; Everybody loves balance! You just can&#x2019;t go wrong with it.</p><p>Except this approach falls short in startups, as they inherently demand a high tolerance for greatly unbalanced environments. Let me explain.</p><p>In the early stages of a startup, the focus should be intensely on achieving product-market fit, which means skewing&#xA0;<em>everything</em>&#xA0;towards product development and growth. This includes hiring, setting priorities, allocating resources, and discussions in meetings. Things like policies, perks, consensus-building across departments, structured order, and stability are not priorities&#x2014;those are concerns for larger companies. Ignore them; if you don&#x2019;t, you&#x2019;ll die.</p><p>If you&#x2019;re a gamer, this concept is similar to what&#x2019;s known as min-maxing. Min-maxing is a strategy where a player maximizes a specific desirable trait, skill, or power in a character while minimizing everything else as less important. The result is a character extremely powerful in one aspect but significantly weaker in others. This is a deliberate choice for gamers; for startups, it&#x2019;s often the only way to survive. It&#x2019;s natural selection&#x2014;they simply don&#x2019;t have enough people, resources, funds, or time. The stakes are high. If you can&#x2019;t min-max your way to the next important milestone, you&#x2019;ll die.</p><!--members-only--><p>The milestones change at each stage of a startup&#x2019;s journey. Once the product-market fit is achieved, the next objective is scaling. After scaling, the priority shifts to making unit economics viable, followed by preparing for an IPO. Throughout these stages, one constant remains: compared to an average mature corporation, a startup at any given point in their lifecycle will seem unbalanced. Every startup, even the generational ones, appear almost dysfunctional at some point. Take major success stories from the past, like Uber, for example&#x2014;there were skeptics who doubted its profitability even long after its IPO.</p><p>To thrive in a startup, whether as a founder or an employee, you need to grasp this reality. Employees, while having less at stake compared to founders, often face a tougher reality than their peers in larger companies. Consider a scenario where your CFO announces that the company is less than 100 days from shutting down unless it becomes profitable, as securing another bridge round is no longer feasible. This is a challenge many startups are currently confronting, especially with the shift in funding conditions following the end of the ZIRP era.</p><p>Or imagine being an employee at Figma, a startup that has achieved remarkable success by any standard. The excitement when news of Adobe&#x2019;s $20 billion acquisition offer came in. As an employee with equity, you might have started imagining ways to spend your share&#x2014;a reward for your hard work. The situation took an unexpected turn when Adobe called off the deal in December, citing uncertainties in obtaining antitrust approvals in Europe and Britain. What was once a real valuation turned into paper value once again; your profits, illiquid again. Despite no fault of your own, the next day requires you to return to work and refocus on another big exit opportunity&#x2014;possibly an IPO. This path could take years and is not without risk. (WeWork, anyone? Not that it can be directly compared to Figma, of course. But the risk is always there.)</p><p>This isn&#x2019;t a balanced situation.</p><p>It&#x2019;s simply a min-maxed outcome of min-maxed work.</p><div class="kg-card kg-callout-card kg-callout-card-yellow"><div class="kg-callout-emoji">&#x1F914;</div><div class="kg-callout-text">If you&#x2019;ve got any questions about this week&#x2019;s essay, feel free to respond to this email or post a comment once <a href="https://kamil.fyi/#/portal/signup" rel="noreferrer">you&#x2019;ve upgraded your subscription.</a></div></div><p><strong>&#x1F64F; My work is </strong><a href="https://kamil.fyi/#/portal/signup" rel="noreferrer"><strong>reader&#x2013;supported</strong></a><strong>.</strong> You can <a href="https://kamil.fyi/#/portal/signup" rel="noreferrer">get a membership here!</a></p><p>&#x1F4E3;&#xA0;<strong>Before Growth has grown through word of mouth.</strong> Want to help? Share it&#xA0;on Twitter&#xA0;<a href="https://twitter.com/intent/tweet?url=https%3A%2F%2Fkamil.fyi&amp;text=Love+this+newsletter+about+early-stage+projects.+Hand-picked+startup+intel+that%E2%80%99ll+put+you+ahead+of+the+curve%2C+straight+from+one+founder+to+another.+Check+it+out%21&amp;ref=kamil.fyi" rel="noreferrer">here,</a> Facebook&#xA0;<a href="https://facebook.com/sharer/sharer.php?u=https://kamil.fyi" rel="noreferrer">here,</a> or LinkedIn <a href="https://linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fkamil.fyi&amp;ref=kamil.fyi" rel="noreferrer">here</a>.</p><p>&#x1F4DA; My new ebook <strong><em>Generative AI in Product Design</em></strong> offers case studies on AI and just enough theory for you to build your next app with gen AI. <a href="https://kamil.fyi/generative-ai-in-product-design/"><strong>Get your copy here!</strong></a></p><p>Did a friend forward this to you? <a href="https://kamil.fyi/#/portal/signup" rel="noreferrer">Subscribe</a> now to get the latest updates delivered straight to your inbox every week.</p>]]></content:encoded></item><item><title><![CDATA[Scope is What Kills Founders]]></title><description><![CDATA[Particularly those who are inexperienced.]]></description><link>https://kamil.fyi/scope-is-what-kills-founders/</link><guid isPermaLink="false">65aee8283f3e93001df9d3b7</guid><category><![CDATA[Managing]]></category><dc:creator><![CDATA[Kamil Nicieja]]></dc:creator><pubDate>Tue, 23 Jan 2024 17:28:51 GMT</pubDate><media:content url="https://kamil.fyi/content/images/2024/01/a-dramatic-scene-depicting-a-climber-experiencing-a-fall-from-a-high-place-while-climbing-a-mountain-404196533.png" medium="image"/><content:encoded><![CDATA[<div class="kg-card kg-callout-card kg-callout-card-blue"><div class="kg-callout-emoji">&#x1F989;</div><div class="kg-callout-text"><a href="https://kamil.fyi/" rel="noreferrer"><i><b><strong class="italic" style="white-space: pre-wrap;">Before Growth</strong></b></i></a> is a weekly newsletter about startups and their builders before product&#x2013;market fit, by 3x founder and programmer Kamil Nicieja.</div></div><img src="https://kamil.fyi/content/images/2024/01/a-dramatic-scene-depicting-a-climber-experiencing-a-fall-from-a-high-place-while-climbing-a-mountain-404196533.png" alt="Scope is What Kills Founders"><p>If you&#x2019;re working with just two engineers to develop a video streaming app, you&#x2019;re likely setting yourself up for failure. A photo app might be more feasible, but even then&#x2014;it&#x2019;s likely to be flawed. </p><p>Some ideas require more resources to be successful.</p><p>I made this mistake with my previous startup. We tackled real estate using AI in a few promising but distinct areas. We divided our product into modules, each  based on some traction we&#x2019;ve seen&#x2014;but attempting to execute all of them at once led to a product that was perfectly mediocre in every aspect that mattered.</p><p>Now, years later, I understand that our approach was similar to that of other startups like <a href="https://www.rippling.com/?ref=kamil.fyi" rel="noreferrer">Rippling.</a> Rippling innovates in HR, IT, and finance. On their website, they showcase 9 products in their HR Cloud, 2 in their IT Cloud, and 5 in their Finance Cloud, totaling 16 products&#x2014;so the strategy isn&#x2019;t inherently flawed.</p><p>However, Rippling&apos;s situation is different; they&#x2019;ve raised $1.2 billion over seven rounds and have, according to some public sources, around 2,500 employees. We had a million in seed funding and a team of about 10 people. And that was probably too high a number&#x2014;as we had to compromise on experience to fill so many roles with the money we raised. </p><p>Rippling&#x2019;s founder, Parker Conrad, had previously co-founded Zenefits, another successful startup valued at $4.5 billion, whereas we had limited entrepreneurial experience. While it&#x2019;s not impossible for first-timers to achieve success, we didn&#x2019;t. Even if we had found more success, we would likely have needed to raise much more funding to realize our vision in the first place, creating a sort of catch-22 situation, as we wouldn&#x2019;t get it without more credentials.</p><p>If I had the chance to start over, I would still keep the long-term vision in mind but concentrate on the most promising single product, dedicating years to refine it. I believe this focus is crucial, as even with more resources, our lack of experience would have been a hurdle. We struggled with making swift decisions, managing technical debt, and made some poor hiring choices. With more experience&#x2014;or perhaps a bit of luck&#x2014;we might have managed to stick the landing based on our original plan. However, under our actual circumstances, perfecting one product first and learning from our mistakes would have likely been a better strategy. This would have taken more time&#x2014;but it would also have reduced our overall expenses, allowing us to invest more as time went on and we achieved new milestones.</p><p>I sometimes wonder why we didn&#x2019;t do it that way. Part of the reason might have been our observation of other companies, similar to Rippling, achieving success with similarly broad strategies. We believed we could replicate their success&#x2014;but lacked the insight to recognize that these startups were at a different stage compared to us. A more realistic comparison would have been with their earlier, less impressive versions when they were just starting out.</p><p>Another factor was our impatience. We lacked the confidence that a single product, initially underperforming with just a few customers, could improve and attract thousands. We observed that introducing a new product brought in 20 new customers, and another addition brought 10 more. This immediate growth encouraged us to continue expanding our product suite. But this approach had its limits. It became inefficient as our expanded offering wasn&#x2019;t compelling enough for a broader audience beyond early adopters. The size of our product suite also made it difficult to move swiftly or make significant changes, as we were reluctant to sacrifice any part of it.</p><!--members-only--><p>A slow death, possibly preventable, that we unwittingly brought upon ourselves.</p><div class="kg-card kg-callout-card kg-callout-card-yellow"><div class="kg-callout-emoji">&#x1F914;</div><div class="kg-callout-text">If you&#x2019;ve got any questions about this week&#x2019;s essay, feel free to respond to this email or post a comment once <a href="https://kamil.fyi/#/portal/signup" rel="noreferrer">you&#x2019;ve upgraded your subscription.</a></div></div><p><strong>&#x1F64F; My work is </strong><a href="https://kamil.fyi/#/portal/signup" rel="noreferrer"><strong>reader&#x2013;supported</strong></a><strong>.</strong> You can <a href="https://kamil.fyi/#/portal/signup" rel="noreferrer">get a membership here!</a></p><p>&#x1F4E3;&#xA0;<strong>Before Growth has grown through word of mouth.</strong> Want to help? Share it&#xA0;on Twitter&#xA0;<a href="https://twitter.com/intent/tweet?url=https%3A%2F%2Fkamil.fyi&amp;text=Love+this+newsletter+about+early-stage+projects.+Hand-picked+startup+intel+that%E2%80%99ll+put+you+ahead+of+the+curve%2C+straight+from+one+founder+to+another.+Check+it+out%21&amp;ref=kamil.fyi" rel="noreferrer">here,</a> Facebook&#xA0;<a href="https://facebook.com/sharer/sharer.php?u=https://kamil.fyi" rel="noreferrer">here,</a> or LinkedIn <a href="https://linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fkamil.fyi&amp;ref=kamil.fyi" rel="noreferrer">here</a>.</p><p>&#x1F4DA; My new ebook <strong><em>Generative AI in Product Design</em></strong> offers case studies on AI and just enough theory for you to build your next app with gen AI. <a href="https://kamil.fyi/generative-ai-in-product-design/"><strong>Get your copy here!</strong></a></p><p>Did a friend forward this to you? <a href="https://kamil.fyi/#/portal/signup" rel="noreferrer">Subscribe</a> now to get the latest updates delivered straight to your inbox every week.</p>]]></content:encoded></item><item><title><![CDATA[Why a Newsletter]]></title><description><![CDATA[I saw the best minds of my generation destroyed by… Substack?]]></description><link>https://kamil.fyi/why-a-newsletter/</link><guid isPermaLink="false">65a6c840b7acff0022d456c5</guid><category><![CDATA[Projects]]></category><dc:creator><![CDATA[Kamil Nicieja]]></dc:creator><pubDate>Tue, 16 Jan 2024 18:39:03 GMT</pubDate><media:content url="https://kamil.fyi/content/images/2024/01/an-illustration-of-a-health-check-by-a-doctor-the-scene-takes-place-in-a-medical-clinic-with-a-prof-928750247.jpeg" medium="image"/><content:encoded><![CDATA[<div class="kg-card kg-callout-card kg-callout-card-blue"><div class="kg-callout-emoji">&#x1F989;</div><div class="kg-callout-text"><a href="https://kamil.fyi/" rel="noreferrer"><i><b><strong class="italic" style="white-space: pre-wrap;">Before Growth</strong></b></i></a> is a weekly newsletter about startups and their builders before product&#x2013;market fit, by 3x founder and programmer Kamil Nicieja.</div></div><ul><li>The number of people in startups focusing on peripheral activities like podcasts, newsletters, and investing appears to be growing rapidly. Why?</li><li>Tech&#x2019;s health check</li><li>Is Rabbit R1 the future, and why not? (It looks cool nonetheless.)</li><li>OpenAI launches GPT Store.</li></ul><hr><img src="https://kamil.fyi/content/images/2024/01/an-illustration-of-a-health-check-by-a-doctor-the-scene-takes-place-in-a-medical-clinic-with-a-prof-928750247.jpeg" alt="Why a Newsletter"><p>I started this newsletter for several reasons.</p><p>Firstly, following my last AI startup, I wanted a less tech-heavy project. As a programmer, I&#x2019;m aware of the common pitfalls in our field, like the tendency to become fixated on development, hoping someone will discover and use our app. This time, though, I chose to prioritize distribution. The scripts behind a newsletter are quite simple&#x2014;and aside from creating content and engaging with readers, distribution is the most fascinating aspect of running it.</p><p>In other terms, launching a newsletter is easy, but attracting a large readership is challenging. And I wanted to improve my skills in the latter aspect.</p><p>Secondly, I&#x2019;ve seen the benefits of having an audience among my peers who started at the same level as me. Unlike me then, they focused on regular writing. If I were to I launch something, it would go unnoticed, but their launches would attract many users. This is a big edge for anyone starting a new business. While I&#x2019;m not great at platforms like Twitter, Instagram, TikTok, or YouTube, I do a good job at writing. It makes sense to connect with people who might appreciate my work through it.</p><p>Thirdly, a realization that came only after I began&#x2014;and it wasn&#x2019;t my original thought, but I like it a lot&#x2014; is that this project represents a shift from&#xA0;<a href="https://www.workingtheorys.com/p/small-tam-startups?ref=kamil.fyi">a big TAM founder to a smaller TAM startup.</a>&#xA0;(TAM as in Total Addressable Market.) My previous approach as a founder was typical of a zero-interest-rate policy environment: target the largest market, address the biggest problem, and easily secure more funding from investors after enough progress. This approach taught me a lot, but these days are now gone. What if I applied the skills I developed in pursuing large markets to a smaller-scale project like a newsletter?</p><blockquote>Here&apos;s an example of this very idea in action: newsletters. You&#x2019;ve seen the jokes about the smartest people in the Valley starting a Substack instead of an ambitious VC-backed startup.<br><br>Who are they?&#xA0;Big TAM founders.&#xA0;People who have the experience and skills to tackle something with huge potential. What are they doing? Working on a&#xA0;<em>small TAM startup</em>&#xA0;(at least a noticeably small-er TAM than they&#x2019;re believed to be capable of tackling). And why? Because they see a higher chance of success, even if the potential outcome is smaller.<br><br>&#x2014;<a href="https://www.workingtheorys.com/p/small-tam-startups?ref=kamil.fyi"><em>Big TAM Founders, Small TAM Startups</em></a></blockquote><p>Writing newsletters, much like starting podcasts, often gets a bit of a bad rap because of how easy it is and how easily people delude themselves into thinking what they have to say is interesting&#x2014;even though, in reality, it&#x2019;s pretty basic. And even those with valuable insights are often asked: why write about building stuff instead of, you know, actually building it? This is a great question, and I thought about it deeply before launching&#xA0;<em>Before Growth.</em>&#xA0;That&#x2019;s also a key reason I wanted to share my thoughts with you.</p><p>I agree that actively building things is crucial, which is why I don&#x2019;t plan to replace my daily startup job with this newsletter even if I could. Instead, I view it as a strategic hobby. If I were to try a new, significant project, I&#x2019;d likely scale back my writing here. My goal is for this newsletter to be a practical resource, grounded in information based on real-world experience. Should an opportunity arise to gain more of that experience to share later, I would seize it and return to writing afterwards. This approach feels intuitively right to me.</p><p>So let&#x2019;s see how this goes.</p><div class="kg-card kg-callout-card kg-callout-card-yellow"><div class="kg-callout-emoji">&#x1F914;</div><div class="kg-callout-text">If you&#x2019;ve got any questions about this week&#x2019;s essay, feel free to respond to this email or post a comment once <a href="https://kamil.fyi/#/portal/signup" rel="noreferrer">you&#x2019;ve upgraded your subscription.</a></div></div><h2 id="your-questions-answered%E2%80%A6">Your questions, answered&#x2026;</h2><blockquote>As an employee, how does&#xA0;<a href="https://kamil.fyi/negative-capability/">negative capability</a>&#xA0;affect the culture and decision-making processes in an early-stage startup?</blockquote><p>This is a question that was sent to me by a reader after the last article in December&#x2014;and it&#x2019;s a good one. I think lots of frustration that I noticed early-stage employees have about their founders can be derived from tolerance to negative capability: both their own and the founders&#x2019;.</p><p>Let&#x2019;s consider a simple example. Here are two contrasting thoughts: as a startup, you need to have incredible patience, because it may take years for your work to really impact the world at large, and meanwhile pretty much everybody except some nerds will ignore you, but at the same time you need to move with incredible urgency on a weekly basis, because otherwise your project will most likely die.</p><p>We can now translate this to a more practical situation, one you probably encountered if you have every worked at a startup: let&#x2019;s say you work at an early-stage company where sales are in a slump and the CEO is urging patience for the vision, while at the same time rousing the rest of the team for more urgency. To me, this makes sense: the best way out is often through. But I&#x2019;ve seen people react with some resentment, because, after giving their all, they found it difficult to understand why they&#x2019;re asked to give even more while the main problem, from their perspective, lies in another department. It&#x2019;s very human.</p><p>In times like these, it&#x2019;s important to foster a culture of togetherness&#x2014;founders should maintain balance while also making sure everybody feels like they&#x2019;re rowing the same boat.</p><div class="kg-card kg-callout-card kg-callout-card-green"><div class="kg-callout-emoji">&#x1F5D3;&#xFE0F;</div><div class="kg-callout-text">Let&#x2019;s dive into this week&#x2019;s recap.</div></div><h2 id="tech%E2%80%99s-health-check">Tech&#x2019;s health check</h2><p>Last year marked&#xA0;<em>the</em>&#xA0;downturn in the tech sector.</p><p>2023 was&#xA0;<a href="https://twitter.com/ttunguz/status/1744400397815677232?ref=kamil.fyi">the toughest year for startup liquidity</a>&#xA0;since the global financial crisis 14 years ago. There was&#xA0;<a href="https://twitter.com/Trace_Cohen/status/1738675537172738144?ref=kamil.fyi">a 38% decline in venture capital firms actively making deals,</a>&#xA0;equating to 2,725 fewer firms engaged in dealmaking.&#xA0;<a href="https://twitter.com/bryce/status/1744748351411925081?ref=kamil.fyi">The industry saw only 474 funds raised,</a>&#xA0;the lowest since the venture capital boom started in 2013. Total funds raised dropped to around $70 billion, a significant decrease from $173 billion in 2022. The data indicates that funding is now more concentrated in a smaller number of elite funds.</p><p>Concurrently, tech companies are downsizing and&#xA0;<a href="https://twitter.com/VicVijayakumar/status/1745623831153127861?ref=kamil.fyi">laying off staff.</a>&#xA0;Already in mid-January, companies like Discord, Google, Amazon, Twitter, Twitch, Humane, Unity, and Cloudflare have announced layoffs. They&#x2019;ve also cut back on spending with vendors, leading to the most significant churn in years for non-essential SaaS services.</p><p>The current situation has huge downstream effects.&#xA0;<a href="https://twitter.com/bryce/status/1745928719712375191?ref=kamil.fyi">Firstly, there&#x2019;s been a sharp decline in startup formation, with more than a 40% drop.</a>&#xA0;The funding landscape has essentially divided into two segments. The first segment is the seed round, which is high-risk. Think young AI startups&#x2014;especially ones build on top of huge platforms like OpenAI. Despite the risks, these startups often find it relatively easy to secure a few million dollars due to the huge potential upside and the industry&#x2019;s enthusiasm, allowing them to test a few initial hypotheses.</p>]]></content:encoded></item></channel></rss>