Author: ananth

  • Things I’ve used AI for

    AI (LLMs) are good at some things and not good at others and nobody seems to be able to agree on what those things are. This is my attempt at describing my personal experience with these tools, for better or worse. I don’t stick to any particular model, most of the time I’m actually using at least 2 to cross check answers. I also haven’t paid for any AI use (yet). I know that means I’m not using the best out there, but until I run into something I’m not satisfied with I don’t see a reason to always use the frontier model.

    Scripting:

    I am not a software engineer. I do not write code all day. I don’t even like writing code all that much. Anyone that does enjoy writing code for the sake of it or does this for a living probably has a very different view on how useful each model is, if at all.

    What I do like is answering questions and solving problems and sometimes that means I have to make my own tools and write scripts to get things done. LLMs have been useful to me in this way because whatever I make doesn’t have to be something that is ready to go into a production level codebase that anyone else depends on, it just needs to work.

    Things they’ve helped with:

    • Talking through a project idea and creating design docs
    • Generating scripts
    • Reviewing my own code
    • Explaining code that I hadn’t written

    Something I do make sure to do is go through any generated or changed code to make sure I can explain why something is the way it is.

    App Generation

    This is similar, but I don’t care about knowing anything about the code. My example for this is that I needed a way to annotate code with comments that appeared similar to Google docs, but not on their platform. annotate.dev came close, but it didn’t have the privacy settings I needed to share things without paying to add more members to my group. I used Gemini to make a tool that let me drop in code, make any comments I wanted to on the side with color coding, and then export the results as an html file I could give people.

    I think a lot of the time people talk about enshittification they really mean they just didn’t like a product design decision, but something like this can solve that problem for them. If the app you’re using makes a change you don’t like, you can just build something that works exactly how you want it to.

    Writing and Reviewing:

    I don’t want an LLM writing anything that really matters for me. The words may make sense, but the tone never seems natural. At most I will ask it to extend something that needs to be longer for the sake of being longer and even then I usually go back and rewrite most of it.

    I do ask for it to review the first few drafts of some things I write. I don’t think they have a perfect understanding of how people might read something, so I will always ask a real person to look at it at least once afterwards, but it does save someone else the time of reading my completely unpolished first draft.

    You have to be explicit about what it should look for though. Emphasize that the wording and tone should stay mostly the same to keep the original voice. Ask for it to focus on things like finding factual errors, looking for areas that might not make sense to readers, or other connecting ideas that you might have overlooked.

    OCR, image search, and Live Camera:

    If I take a screenshot of text on my phone I can hold down a button and have Gemini help grab the text from it to use as alt text. Not the biggest deal in the world, but I think making accessibility easy to implement helps. I’m curious if I could get descriptions of images that are good enough to use but I haven’t tried setting something like that up yet.

    If I see something on my phone that I want to look for, I hold down the button and use Gemini as a google image search.

    If I point my phone camera at something, I can ask Gemini questions about it. This worked a lot better than I was expecting. I think the think I was most impressed with was correctly estimating how much liquid was in a container.

  • DeFi with oranges: Yield Trading

    It’s January 1st and you’re a farmer that is trying to plan your business for the rest of the year. With current estimates, you think your orange trees will produce 50 bushels, worth $5000. However, there was a late freeze last year which destroyed half of your crops. You’re concerned that this could happen again so you want to find a way to hedge your risk. You draw up a contract that represents rights to all of the oranges that your trees have grown by June 30th and look for a buyer. Someone might buy your contract for several reasons. First is that you might be willing to sell the contract for less than $5000 but more than $2500. This would protect you from the kind of downside you faced the year before, while if everything goes as predicted the buyer will make the difference between $5000 and the price of the contract. A second possibility is that the buyer of the contract believes the price of oranges will increase by the time of harvest, making the 50 bushels worth $6000 instead. Similarly, they could also expect the price to remain the same but the trees to produce more than 50 bushels. In all three situations, you hedge your risk by collecting your money up front, while the buyer takes on some risk over a longer time horizon for more benefit. The buyer of the contract can freely trade it afterwards as well, and many trading opportunities can occur as people have different opinions on how many oranges will be harvested and/or what the price of oranges will be in 6 months. 

    A month later, you decide that you want to get out of orange farming all together. You’ve already promised the oranges that will be grown are owed to the holder of the first contract, so you can’t sell your trees immediately. Instead, you draw up another contract, which entitles someone to all the trees in your orchard on July 1st. To make up for the time that they won’t be able to take possession of the trees, you sell the trees for less than they would be worth at current market value. In this situation, you free up capital early to reinvest into something else, while the buyer gets a discount on the trees they want, as long as they’re willing to be a little patient. In this situation too, the buyer can trade their contract as they see fit, and the final holder will be the one that takes possession of the trees on the date of expiration.

    When generalized, you can call the orange trees the principal, and the oranges themselves the yield. Any asset that passively accrues some value can have this framework applied to it, as people use their own assumptions and modeling to determine how much income an asset will generate and how to value both that income and the asset itself.

  • DeFi with apples: Automated Market Makers

    You’re at the market and want to buy some apples. In the middle of the market, there’s a big book that people can record things in. People that want to buy apples write down how many they want and at what price they’re willing to buy, and people that want to sell apples do the same in reverse. A trade happens when a buyer and seller agree on a price and quantity.

    This is the standard central limit order book (CLOB) system that most stock brokerages use. In big markets dealing with popular assets like apples, there are usually also businesses built around constantly filling both sides of the book to keep the market liquid. These businesses require significant capital, and generally only focus on the largest markets.

    So what happens if you actually want to buy oranges, and there isn’t a company willing to be a market maker that fills both sides of an order book? The issue isn’t a lack of buyers or sellers, or that the price isn’t determinable, it’s that trading gets tricky when there aren’t many offers on either side. An orange might truly be worth $2, but if the buy side only has an order for $1 and the sell side only has an order for $3, anyone that wants to buy or sell an orange is going to have to be out a dollar.

    One way to solve this is by creating a marketplace that doesn’t need an order book, and instead lets trade happen at any time by setting pricing according to an algorithm.

    Imagine in this same market, the book in the middle gets replaced with a magic scale. The scale has a spell on it such that the two sides must always be balanced, and that the number of objects must always multiply to a fixed number set when the scale was calibrated. Taking the same example of oranges, let’s say the scale gets set up when oranges are $2. Someone puts 5 oranges on one side, and 10 dollar bills on the other. People can buy and sell oranges at any time, as long as the number of oranges times the number of dollar bills is equal to 50, the scale stays balanced. When you generalize the concept, you can use a formula like x * y = k, where x and y are the units of each asset and k is a constant value. 

    Going back to our oranges, if I want to buy 3 oranges, I take 3 from that side, leaving 2. To know how much those oranges are going to cost, we can do the math of 50 (the constant target) divided by 2 (the number of oranges left). This means that there would need to be 25 dollar bills on the other side to keep things equal. There are already 10 dollars there, so I would need to pay 15 to rebalance the scale. You might notice that the price of the oranges here isn’t 2 dollars, but rather 5. This difference is called price impact. It happens when you try to make a large trade compared to the amount of liquidity available. Since there are only 5 oranges, buying 3 is taking up more than half the supply, which naturally moves the price much higher.

    On the flip side of that, let’s say I want to sell 5 oranges instead. We start with the 5 on the scale, add 5 more to get 10, and then divide 50 by that to get 5. Since there are 10 dollars on the other side of the scale, I need to take 5 to get back to a balance. The same principle of price impact applies here, just in the other direction.

    The effect of price impact is reduced when there are more people willing to add both oranges and dollars to each side of the scale. If the scale had 5000 oranges on it, removing 3 wouldn’t require much change on the other side. The people who add both oranges and dollars to the scale are called liquidity providers, and the assets they provide are collectively called a liquidity pool. When you make a trade through this pool, you pay a small fee, just like you would on a brokerage platform. In this case, the fee is split proportionally between the liquidity providers. This fee gives liquidity providers a way to earn money for keeping the system running smoothly.

    In both of these directions, people can continue to buy and sell oranges to an infinite amount. So, while traditional markets need buyers and sellers to line up their prices, an AMM system lets anyone trade anytime.