<?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:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Faraz Shaikh on Medium]]></title>
        <description><![CDATA[Stories by Faraz Shaikh on Medium]]></description>
        <link>https://medium.com/@farazshaikh?source=rss-52b773d84dd8------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*Kstl9mst2JrIRfPj</url>
            <title>Stories by Faraz Shaikh on Medium</title>
            <link>https://medium.com/@farazshaikh?source=rss-52b773d84dd8------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 16:33:25 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@farazshaikh/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Logical Grouping of the Rust Iterator methods — Part 2]]></title>
            <link>https://medium.com/@farazshaikh/logical-grouping-of-the-rust-iterator-methods-part-2-e36e104c35f2?source=rss-52b773d84dd8------2</link>
            <guid isPermaLink="false">https://medium.com/p/e36e104c35f2</guid>
            <dc:creator><![CDATA[Faraz Shaikh]]></dc:creator>
            <pubDate>Thu, 16 Oct 2025 23:55:17 GMT</pubDate>
            <atom:updated>2025-10-17T00:01:25.145Z</atom:updated>
            <content:encoded><![CDATA[<h3>Logical Grouping of the Rust Iterator methods — Part 2</h3><p>Recently did a <a href="https://medium.com/@farazshaikh/logical-grouping-of-the-rust-iterator-method-6e3291170c24"><em>post</em></a> on grouping or iterator operations, in this part we organize them as CRUD operation.</p><p>Creation: Includes first order and second order creation of iterators.<br>Read: Various ways to traverse and read contents<br>Update: Update the contents of the iterator with operation like map<br>Delete: Consume or delete iterator</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TYJDn-BZJEH0wfiZEyszuA.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e36e104c35f2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Logical Grouping of the Rust Iterator method.]]></title>
            <link>https://medium.com/@farazshaikh/logical-grouping-of-the-rust-iterator-method-6e3291170c24?source=rss-52b773d84dd8------2</link>
            <guid isPermaLink="false">https://medium.com/p/6e3291170c24</guid>
            <dc:creator><![CDATA[Faraz Shaikh]]></dc:creator>
            <pubDate>Thu, 16 Oct 2025 23:32:54 GMT</pubDate>
            <atom:updated>2025-10-16T23:32:54.537Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OsKPFj9v9dDkAU9hWwkZYw.jpeg" /></figure><h3>Logical Grouping of the Rust Iterator methods.</h3><h4>Core Iterator Protocol</h4><p>next — The fundamental method that advances the iterator and returns the next item<br>size_hint — Provides bounds on remaining items (lower, optional upper)</p><h4>Consumers (Terminal Operations)</h4><p>These consume the iterator and produce a final value:</p><p>Collection &amp; Aggregation:</p><p>collect — Gathers all items into a collection<br>collect_into — Collects into an existing collection<br>unzip — Splits pairs into two collections<br>partition — Splits items into two collections based on predicate<br>partition_in_place — In-place version of partition</p><p>Reduction:<br>fold — Accumulates values with a function and initial value<br>reduce — Like fold but uses first element as initial value<br>sum, product — Specific reductions for numeric types<br>count — Counts the number of elements<br>Search &amp; Selection:<br>find — First element matching predicate<br>find_map — First successful map result<br>position, rposition — Index of first/last matching element<br>last — Final element<br>nth — Element at specific index<br>max, min — Maximum/minimum element<br>max_by, min_by — With custom comparator<br>max_by_key, min_by_key — With key extraction function</p><p>Boolean Checks:<br>all — Tests if all elements satisfy predicate<br>any — Tests if any element satisfies predicate<br>is_sorted, is_sorted_by, is_sorted_by_key — Check sorting<br>is_partitioned — Checks partition condition</p><p>Comparison:<br>eq, ne — Equality/inequality with another iterator<br>cmp — Ordering comparison<br>partial_cmp, partial_cmp_by — Partial ordering<br>lt, le, gt, ge — Specific comparisons</p><h3>Adapters (Lazy Transformations)<br>These return new iterators:</h3><p>Mapping:</p><p>map — Transform each element<br>map_while — Map until predicate fails<br>map_windows — Map over sliding windows<br>enumerate — Add indices to elements<br>cloned, copied — Clone/copy elements</p><p>Filtering:<br>filter — Keep only matching elements<br>filter_map — Combined filter and map<br>take — First N elements<br>take_while — Elements while predicate holds<br>skip — Skip first N elements<br>skip_while — Skip while predicate holds</p><p>Flattening:<br>flatten — Flatten nested iterators<br>flat_map — Map then flatten</p><p>Combining:<br>chain — Append another iterator<br>zip — Pair with another iterator<br>intersperse, intersperse_with — Insert separator between elements</p><p>Utility:<br>step_by — Take every Nth element<br>rev — Reverse direction<br>cycle — Repeat infinitely<br>fuse — Ensure next() returns None forever after first None<br>peekable — Allow peeking at next element without consuming<br>scan — Stateful map with accumulator<br>inspect — Peek at each element (for debugging)</p><p>Fallible Operations (Try Variants)<br>For use with Result or Option:<br>try_fold, try_reduce — Early exit on error<br>try_find, try_for_each — With fallible predicates/operations<br>try_collect — Collect with short-circuit on error<br>Side Effects<br>for_each — Execute function on each element (consuming)</p><h3>Special</h3><p>next_chunk — Get next N items as array<br>This organization reflects the functional programming paradigm where you chain adapters (lazy) and finish with a consumer (eager) to process data streams efficiently.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6e3291170c24" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Industrial-Grade Vibe Coding at Scale]]></title>
            <link>https://medium.com/@farazshaikh/industrial-grade-vibe-coding-at-scale-7b55cf9875f7?source=rss-52b773d84dd8------2</link>
            <guid isPermaLink="false">https://medium.com/p/7b55cf9875f7</guid>
            <dc:creator><![CDATA[Faraz Shaikh]]></dc:creator>
            <pubDate>Fri, 29 Aug 2025 22:16:10 GMT</pubDate>
            <atom:updated>2025-08-30T08:54:54.798Z</atom:updated>
            <content:encoded><![CDATA[<p>Over the last year, I’ve been experimenting with AI-assisted coding at different extremes — from treating it like a fast typist to outsourcing entire code bases. Many developers worry about “<a href="https://www.reddit.com/r/programming/comments/1m1kvug/how_ai_vibe_coding_is_destroying_junior/">brain rot</a>” and the inability to build <em>great</em> software with GenAI, but my experience has been the opposite: you <strong>can</strong> build serious, production-grade systems with it. The trick is <em>method and workflow</em>. If you let the AI lead, your project is doomed. If you structure it right, it becomes a force multiplier.</p><p>Here’s a blueprint for <strong>Industrial-Grade Vibe Coding at Scale</strong>.</p><h3>Ground Truths About AI in Software Engineering</h3><ol><li><strong>AI use is a spectrum.</strong></li></ol><ul><li>On the lower end: AI as a fast typist.</li><li>On the higher: AI as an autonomous builder.</li></ul><p>The sweet spot: <em>structured requests like</em> “Write this function with these inputs,” <em>not</em> “Tell me how to solve this problem ?” The more you stay clear of AI as autonomous builder — the better your results are going to be.</p><p><strong>The core skill: knowing when to dial up AI use along the spectrum.</strong></p><ul><li>Early stage (design, architecture, type flow): <em>your job</em>.</li><li>Later stage (implementing code/tests/docs): AI can take on more autonomy.</li></ul><p>If you hand over creativity too early, you’ll get instant gratification but long-term chaos.</p><h3>Vibe Flow — Blue print for vibe coding</h3><h3>The 4:2:1 Rule</h3><p>From experience: great software has <strong>4x documentation, 2x tests, 1x code</strong>.</p><p>AI actually makes this balance achievable. It’s great at scaffolding docs and tests, while you focus on architecture. A well-structured project should always have:</p><p>prj</p><p>— src/</p><p>— test/</p><p>— docs/</p><p>— local_deploy/</p><p>If any folder is missing, you’re skipping basic software engineering discipline. Forget AI — no amount of excuse it going to redeem you.</p><h3>How to Start: Types — its all types — all the way down.</h3><p>Remember Roger S. Pressman’s “<a href="https://mlsu.ac.in/econtents/16_EBOOK-7th_ed_software_engineering_a_practitioners_approach_by_roger_s._pressman_.pdf">Software Engineering</a>” textbook? Time to dust it off. AI gives you an army of junior devs, but you’re the architect, YOU LITERALLY HAVE TO DO ENGINEERING NOW because AI is going to do the software part.</p><ol><li><strong>Write an MRD (Market Requirements Doc)</strong> → put it in docs/.</li></ol><p><strong>High-Level Design Doc</strong> → describe services, no code details. IDE models will end to include code low level details here.</p><p><strong>Tip:</strong> use ChatGPT or non-code LLMs for this stage. In general mix match models as long as you are using a progressively smarter model. The thing to avoid is asking a not so smart model to interpret results of smarter model.</p><p><strong>2. Low-Level Design</strong> →<strong> Types are the most important part:</strong></p><p>Coming for C, I would always start by writing functions for scaffolding a project. That changed with Rust — I realized you can literally build a detailed blue print with types TYPES the unlock was type state programming.<strong> Types create types</strong> and then logic and state in encode in the type creation process (looks obvious now, but i didn’t look at it that way as the focus was on “layers of functionality” which build on top each other)</p><ul><li>Define <strong>data types</strong> and <strong>data type flow</strong>.</li></ul><p>Use <a href="https://www.cs.cmu.edu/~aldrich/papers/onward2009-state.pdf"><strong>type-state programming</strong></a> to encode flow and state logic in types.<br>Example: If Lunch type exists, Ingredients type is guaranteed to have been created and destroyed.</p><p><strong>Tip:</strong> Read the above paper and invest some intro time to Python, Rust and Haskell type systems in that order. If you are more ambitious pick these books up.<br><a href="https://www.google.com/url?sa=t&amp;source=web&amp;rct=j&amp;opi=89978449&amp;url=https://www.amazon.com/Types-Programming-Languages-MIT-Press/dp/0262162091&amp;ved=2ahUKEwiP88el-7CPAxXRDjQIHQiuERMQFnoECBsQAQ&amp;usg=AOvVaw02h3LSjaj6VBLwejUr0bX9">Types and Programming Languages </a>— Benjamin Pierce<br><a href="https://homotopytypetheory.org/book/">HoTT</a> — I haven’t attempt a read.</p><p><strong>Tip:</strong> mermaid diagrams — AI can generate great UML diagram with mermaid. Remember that <a href="https://en.wikipedia.org/wiki/IBM_Rational_Rose">Rational Rose</a> — you can do that on steroids now.</p><p><strong>Tip:</strong> For user facing types first spec out OpenApi.json file — rest of the code and types can be generated using AI and <a href="https://openapi.tools/">tools</a>.</p><p>Partition types into modules/components. Carefully review types crossing component boundaries (this is nothing new, but a great checkpoint for YOU to introspect in the AI generated code).</p><p>Finally, <strong>define tests across modules</strong> before implementation begins.</p><p>At this stage, you’re reviewing <em>everything</em>. AI is a helper, not the designer.</p><p><strong>Tip:</strong> AI is great with single threaded programs when flow of types is linear. It struggles with asynchronous programming and multi threading, try and avoid complex synchronization primitives. Stick to s<a href="https://en.wikipedia.org/wiki/Session_type">ession types </a>viz channels — they embody encoding structure into types. Don’t shat with semaphores and locks when using AI use.</p><h3>Structured Vibe Coding</h3><p>Now with all of the above ground work setup now you’re ready to actually VIBE code !!!!</p><p><strong>By now you have:</strong> MRD, type flow docs, module design, tests. Feed these docs into your <a href="https://docs.cursor.com/en/context/rules">IDE’s AI rules</a>. Don’t dump everything — curate the relevant context. Err on the side of including more context than less — remember AI IDE’s like cursor charge you per-prompt irrespective of the input token complexity and length.</p><ul><li>With context injected, the AI is less about chatting and more about <em>fast, structured execution</em>.</li></ul><p><strong>Top + Bottom Iteration</strong>: short, iterative loops, check-pointed across 2 histories.</p><p>Unlike traditional bottom-up coding (build components first, integrate later), AI thrives on <em>short, iterative top down loops</em>: The reason is simple — context size is increasing but best quality outputs are gated in short succinct input prompts. Prompt should be elaborate but not more than needed.</p><p>AUTOMATE EACH prompt</p><ul><li>Start with top-level design expectations. (referring to docs)</li><li>Dip down briefly to implement/test low-level details.</li><li>Steps to test that smallest of features (without this the prompt is not fully automated)</li><li>Ship small, fully functional slices (UI + Code + Test + Docs).</li><li>Append to prompt: Iterate until test passes.</li></ul><p>This keeps momentum high while preventing slop from accumulating.</p><p><strong>TIP: </strong>You have N not 1 staging areas for collecting good results. First is the git stash that I use for checkpoint good outcomes before the commit. EACH PROMPT also has check pointing history. If you are good a META git foo — you can do pretty neat things with combining the 2 history lines. Remember cursor AI IDE will never touch the git stash.</p><h3>Scale Up (100x) OR risk brain rot.</h3><p>If you are idle looping when AI is slogging off,you so then YOU HAVE LOST THE PLOT and you will Brain Rot supafast !!</p><p>I often run <strong>5+ tasks in parallel</strong>, each with <strong>3–4 </strong>chat session. This works because of all the ground work done for making tasks are granular and structured.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MBvHjqG9UfUHQW6JNyy2-A.png" /><figcaption>Parallel Chat sessions.</figcaption></figure><p>The whole point about parallelism to pipeline the shared work between you and the AI. While the AI is running inference you should be ..</p><ul><li>Writing prompts for the next task.</li><li>Reviewing outputs from other threads.</li><li>Cleaning/simplifying AI slop.</li><li>Testing</li></ul><p>This keeps <em>you</em> in the creative, high-leverage loop while AI executes.</p><h3>The Real Shift</h3><p>Don’t fall into the trap of letting AI write while you doom-scroll. That’s how “brain rot” happens.</p><p>Instead:</p><ul><li>Build <strong>bigger, much bigger, insanely ambitious projects</strong>.</li><li>Think in terms of software that would normally take 100 devs a year.</li><li>Direct AI as if it’s an army of junior engineers.</li></ul><p>Accept that <strong>developers are already replaced</strong> — your role is to scale <em>intelligence and direction</em>.</p><p>The only limit now is creativity and energy.</p><h3>Final Word</h3><p>Vibe coding isn’t “just vibing.” It’s not free-form chaos. Done right, it’s structured, high-velocity engineering — backed by AI.</p><p>If you build the docs, types, and tests first, you can let AI handle the grind while you orchestrate. With discipline, you’ll ship systems orders of magnitude larger than before.</p><p>This is <strong>industrial-grade vibe coding at scale</strong>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7b55cf9875f7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hitting a Vibe coding Dead End with LLMs? Here’s How to Get Unstuck]]></title>
            <link>https://medium.com/@farazshaikh/hitting-a-vibe-coding-dead-end-with-llms-heres-how-to-get-unstuck-0a09e1389907?source=rss-52b773d84dd8------2</link>
            <guid isPermaLink="false">https://medium.com/p/0a09e1389907</guid>
            <dc:creator><![CDATA[Faraz Shaikh]]></dc:creator>
            <pubDate>Thu, 24 Jul 2025 05:46:41 GMT</pubDate>
            <atom:updated>2025-07-24T05:46:41.730Z</atom:updated>
            <content:encoded><![CDATA[<p>Large Language Models (LLMs) have revolutionized coding, churning out reams of code with a few well-crafted prompts. They’re fast, powerful, and often feel like a superpower. But every good run eventually hits a wall. When your LLM stops delivering and you’re stuck in a loop of ineffective prompts, it’s time to recognize the dead end and take action. Here’s a guide to identifying when you’re stuck, why it’s happening, and how to break free to get your coding journey back on track.</p><h3>Recognizing the Dead End</h3><p>It’s easy to fall into the trap of firing off prompt after prompt, hoping the next one will magically fix everything. But endlessly tweaking prompts without progress is a recipe for frustration. To avoid wasting time, establish a framework to declare when your LLM has hit a dead end. Here’s a practical approach:</p><p>1	Set a Prompt Limit:</p><p>◦	Functional Code: Aim to implement new functionality in 5 prompts or fewer. If you’re still iterating after five attempts, something’s off.</p><p>◦	Bug Fixes: Allow up to 10 prompts to resolve an issue. Beyond that, you’re likely on a bad LLM trip.</p><p>2	Watch for Red Flags:</p><p>◦	LOC Expectation Mismatch: If the LLM generates far more or less code than you’d reasonably expect for the task, it’s a sign it’s misaligned with your goal.</p><p>◦	Bug Loops: The LLM fixes one bug, only to introduce another, then another, in a never-ending cycle.</p><p>◦	Zero Progress: After 3 consecutive prompts with no meaningful progress toward your goal, it’s time to reassess.</p><p>When these indicators appear, it’s time to admit defeat in this round and shift to evasive maneuvers. Declaring a dead end early saves time and mental energy for a more effective approach.</p><h3>Evasive Maneuvers: How to Get Unstuck</h3><p>Once you’ve identified the dead end, don’t double down on more prompts. Instead, take decisive action to reset and refocus. Here are strategies to break free:</p><h4>Make a Deep Cut</h4><p>LLMs generate code quickly, so don’t be afraid to slash large portions of problematic code and revert to a known working state. Use tools like Git stash or Cursor’s history (a per-prompt mini revision control system) to roll back to a stable point. Starting fresh from a working snapshot often clears the fog and sets you up for success.</p><h4>Switch Your LLM Wisely</h4><p>If you’re using a tool like Cursor, you might be paired with a less capable LLM by default. Not all LLMs are equal, and there’s no one-size-fits-all model. Experiment with different models based on the task:</p><p>Use lighter, faster models for simple tasks to save time and resources.</p><p>Scale up to more powerful models only when needed, as heavier models like Grok 3 can be overkill for straightforward tasks.</p><p><strong>Tip:</strong> Avoid switching models mid-session, as it often disrupts context and leads to inconsistent results. Stick with one model per session and evaluate its suitability upfront.</p><h4>Diagnose the LLM Failure</h4><p>Understanding why the LLM is failing is critical to moving forward. While not always obvious Common culprits include:</p><ul><li>Ambiguous or Incomplete Prompts:</li></ul><p>If your instructions are unclear or lack context, refine them. Be specific about the desired outcome, constraints, and environment.</p><ul><li>Inadvertently Seeding a local minimum</li></ul><p>When debugging, you might inadvertently steer the LLM toward incorrect assumptions by providing flawed hints. Trust the LLM to analyze the problem from scratch rather than feeding it potentially wrong guidance.</p><ul><li>Lack of Context</li></ul><p>LLMs thrive on context. If you’re not providing enough, ask the LLM what additional information it needs — logs, UX snapshots, or even piped screen output (an advanced use case with tools like PipeWire).</p><h4>Revert, Rewrite and transfer the learning</h4><p>If the LLM introduced bugs, they likely originated in a recent change. Revert to a working commit, fix / rewrite the issue manually or with fresh prompts, and transfer the learnings to the top of your codebase. This approach minimizes collateral damage while preserving progress. For example:</p><p>Revert the problematic commit set.</p><p>Rewrite the affected code with clearer prompts.</p><p>Port any successful learning or improvements back to the main branch. You do this by transferring the learning by reusing the same chat session but switch the code branch underneath it</p><h4>Isolate the Problematic Context</h4><p>Maximize the LLM’s context window by isolating working code into separate files. This keeps the focus on the problematic code, allowing the LLM to dedicate its attention to the issue at hand. Tools like Cursor make it easy to manage context by file, so use this to your advantage.</p><h3>What Not to Do</h3><p>Avoid these common pitfalls when you’re stuck:</p><p>Keep Prompting Endlessly: Chasing “one more prompt” to Valhalla rarely works. Stick to your prompt limits.</p><p>Change Models Mid-Session: Switching LLMs in the middle of a task disrupts context and often leads to worse outcomes.</p><p>Ask Vague Questions: Questions like “What do you think?” are pointless. LLMs don’t think — they predict based on patterns and context. Be precise in your instructions.</p><p>Fear Large Code Changes: Don’t shy away from rewriting thousands of lines of code if needed. As long as you have robust test cases, the LLM can explore multiple paths to the same solution. Use acceptance tests to ensure correctness without restricting the LLM’s flexibility. A strong rule in Cursor can prevent the LLM from altering tests, which could otherwise lead to issues like memorizing error cases to fake correct outputs.</p><h3>Final Thoughts</h3><p>LLMs are powerful tools, but they’re not infallible. Recognizing when you’ve hit a dead end and taking decisive action to pivot can save hours. By setting clear prompt limits, watching for red flags, and using strategies like deep cuts, model switching, and context isolation, you can unblock your LLM journey and keep your coding on track. Remember: LLMs are fast typewriters, not thinking machines. You’re the one steering the ship — use your judgment to guide the LLM to success.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0a09e1389907" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Software Quality: Two New Metrics for the Age of LLMs]]></title>
            <link>https://medium.com/@farazshaikh/software-quality-two-new-metrics-for-the-age-of-llms-b6fdea183c9d?source=rss-52b773d84dd8------2</link>
            <guid isPermaLink="false">https://medium.com/p/b6fdea183c9d</guid>
            <dc:creator><![CDATA[Faraz Shaikh]]></dc:creator>
            <pubDate>Wed, 23 Jul 2025 00:27:56 GMT</pubDate>
            <atom:updated>2025-07-23T00:27:56.313Z</atom:updated>
            <content:encoded><![CDATA[<p>As large language models (LLMs) become integral to software development, traditional software quality metrics like human readability and maintainability may no longer suffice. To evaluate how well codebases support LLM-driven workflows, we propose two new metrics:<br> <strong><em>Machine Readability</em></strong> and <strong><em>Machine Autonomy</em></strong>.</p><h3>Machine Readability</h3><p>This measures how easily an LLM can understand and navigate a codebase to perform precise, surgical edits or fixes. A highly machine-readable codebase has clear structure, consistent conventions, and minimal ambiguity, allowing LLMs to parse and modify code with minimal errors. For example, a codebase with well-defined interfaces and explicit type annotations might score high, as LLMs can leverage these cues to make targeted changes.</p><h3>Machine Autonomy</h3><p>Machine Autonomy evaluates how independently an LLM can operate on a codebase, from interpreting a prompt to executing tasks, all the way to deployment. A codebase that scores high on autonomy enables LLMs to handle complex workflows — like generating code, running tests, and deploying to production — with little to no human intervention. Think of a codebase integrated with a robust CI/CD pipeline that an LLM can trigger autonomously.</p><h4>Open Questions:</h4><p>Are these new metrics simply derivatives of existing ones, like human readability and maintainability? Or do they capture unique aspects of LLM-codebase interactions?</p><p>For instance, type systems play a critical role. Strongly typed languages (e.g., Rust, TypeScript) may boost Machine Autonomy by providing a formal framework for LLMs to validate and test updates automatically. However, overly complex type systems, with intricate subtype-supertype hierarchies or nested generics, might hamper Machine Readability (and definitely human readability) by introducing ambiguity or cognitive overhead. In contrast, simpler constructs like disjoint sum types (e.g., enums in Rust) could enhance readability for both humans and machines due to their explicit, mutually exclusive nature. How do these type systems balance the trade-offs between autonomy and readability?</p><h4><em>Closing Thoughts</em></h4><p>Will humans still read code in the future, or will AI dominate software development? It’s clear humans won’t write code in a few years — LLMs generate thousands of lines in seconds, outpacing us effortlessly. As codebases optimize for Machine Readability and Machine Autonomy, humans may shift from coding or reviewing to defining high-level goals and verifying outcomes. But how far will this go? Will we remain active partners in development, or will AI achieve full autonomy, sidelining human input? I’m betting on the latter — AI will take over, not because it’s inherently better, but because humans have often half-heartedly tackled software engineering challenges.</p><p><em>What do you think?</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b6fdea183c9d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hyperlinks the original sin and why LLMs are a side quest ?]]></title>
            <link>https://medium.com/@farazshaikh/hyperlinks-the-original-sin-and-why-llms-are-a-side-quest-eb895680bde9?source=rss-52b773d84dd8------2</link>
            <guid isPermaLink="false">https://medium.com/p/eb895680bde9</guid>
            <dc:creator><![CDATA[Faraz Shaikh]]></dc:creator>
            <pubDate>Fri, 11 Apr 2025 03:41:18 GMT</pubDate>
            <atom:updated>2025-04-11T03:46:06.394Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lmZHQPJtrXD39LLI6TNLhQ.png" /></figure><h3>Hyperlinks the original sin and why LLMs are a side quest ?</h3><p>Ted Nelson is as difficult to appreciate as Lamport himself.</p><p>I think I finally understand what he’s trying to say: “We got it all wrong — right up until LLMs courtesy undirectional hyperlinks”</p><p>Ted argues that unidirectional hyperlinks are the original sin of the web. But what he really means is that the one-way nature of hyperlinks made the web inherently prone to duplication. This led to the sprawling mass of duplicated text we now call the internet — and LLMs simply compressed that mess into a higher-dimensional blob.</p><p>If hyperlinks were bidirectional and commutative, the internet itself might have evolved into a living, self-compressing language model. In other words, the internet wouldn’t just contain knowledge — it would be a knowledge engine.</p><p>Which brings us back to LLMs. The whole dance of attention context and sequential inference might just be another side quest — a temporary hack to deduplicate text. Inference isn’t the endgame. The real goal is a recursive step forward: not to generate more text, but to emit a minimal, lossless representation of the entire information structure.</p><p>So the real question is: What do we want from all this?</p><p>A cursor IDE that spits out more code? Copy-pasta on steroids? That’s not the future. That’s just moar clutter.</p><p>What we should aim for is the total deduplication and unification of the universe’s codebase — total JAYAKARTA !</p><blockquote>The frontier is understanding whats inside the LLM not what it spits out.</blockquote><p><a href="https://youtu.be/hMKy52Intac?si=4DVcsnRK0B9dOEaM">https://youtu.be/hMKy52Intac?si=4DVcsnRK0B9dOEaM</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eb895680bde9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Multiplicative and independent additive shifts in Schnorr signatures]]></title>
            <link>https://medium.com/@farazshaikh/multiplicative-and-independent-additive-shifts-in-schnorr-signatures-9bdf4458fa64?source=rss-52b773d84dd8------2</link>
            <guid isPermaLink="false">https://medium.com/p/9bdf4458fa64</guid>
            <dc:creator><![CDATA[Faraz Shaikh]]></dc:creator>
            <pubDate>Tue, 11 Feb 2025 05:13:30 GMT</pubDate>
            <atom:updated>2025-02-11T05:14:52.541Z</atom:updated>
            <content:encoded><![CDATA[<h3>s = h+ rp</h3><h3>Introduction</h3><p>Schnorr’s Proof of Possession (PoP) is a cryptographic protocol that allows a prover to demonstrate knowledge of a secret key without revealing it. Many tutorials focus only on the additive shift, but the interplay between <strong>additive and multiplicative shifts</strong> is crucial. This blog explores:</p><ol><li><strong>Why the multiplicative shift is used</strong> in the proof structure?</li><li><strong>Why the multiplicative shift alone is not enough</strong>, as it must be disclosed for verification. ?</li><li><strong>How independence of the additive shift allows it to be hidden</strong>, ensuring privacy without breaking verification?</li><li><strong>An interactive setup</strong> where the prover provides the additive shift and the verifier provides the multiplicative shift?</li><li><strong>Why reversing roles isn’t possible?</strong></li></ol><h3>Setup</h3><ul><li><strong>G</strong> = generator of a prime order group</li><li><strong>p</strong> = private key</li><li><strong>P = G^p</strong> (<em>public key</em>)</li><li><strong>r</strong> = randomly chosen <em>nonce</em> (additive shift, chosen by prover)</li><li><strong>R = G^r</strong> (<em>commitment</em>)</li><li>h = <em>challenge (in signatures, this would be the hash of the message)</em></li></ul><p>in a nutshell, prover shares blinded secret <em>s = r + h</em>p, where r and h are terms that mix/hide the private key p. The verifier is then presented (R,s) and he checks equality for</p><pre>g^s = R.P<br>Why this works ?<br>g^s  = g^(r+hp)<br>     = g^r  .  g^ph  <br>     = R . P</pre><p><strong><em>The intuition</em> behind s = r + hp, </strong>is <em>r &amp; h</em> hide p and still maintain enough structure to verify possession of the private key <em>p</em>. Let&#39;s dissect each element of this equation</p><h4>‘h’: the multiplicative shift for p.</h4><blockquote>s = h p</blockquote><p>We cannot disclose <em>p </em>so instead we mix/blind it with a multiplicate shift <em>h. </em>This gives us <strong>s = <em>h</em>p. </strong>This successfully hides p, but is not very useful for verification, i.e. just looking at <em>s the verifier cannot ascertain that the prover knows of a particular p. </em>At this point, s looks like a random number to the verifier.</p><p>Note: to make s = hp useful for verification, we will have to disclose h to the verifier. But, if we disclose <em>s &amp; h we are transitively disclosing p itself.</em></p><p>Conclusion: the multiplicate shift is not very useful by itself, and if used has to be disclosed to the verifier.</p><h4><strong>‘r’ : the independent additive shift for p.</strong></h4><blockquote>s = <em>r</em> + hp</blockquote><p>The multiplicate shift helped hide the private key <em>p</em> but lacked verification. The additive shift, <em>r</em>, tries to augment the solution by making verification possible. Most readers focus on the <em>additive nature of r, which is not that important. It is important to note that r is </em><strong><em>independent</em></strong><em> of p. i.e it doesn’t include p in the term. </em>This independence allows us to hide r, which was not possible with h, because its visibility (hide/reveal) was tied to p.</p><p>Conclusion: s = r + hp completely hide p, and also open up a possibility to reveal r in the exponent.</p><h4>Hiding r.</h4><p>For verification, we need to provide access to r in some form, so the prover hides r in the exponent.</p><blockquote>R = g^r</blockquote><p>The proof of possession is (s, R)</p><h4>A complete <strong>interactive</strong> proof.</h4><h4>Proof generation</h4><p>1. Prover selects private key <em>p</em> and public key<em> P=G^p</em><br> Prover wants to provide proof of possession (POP) for <em>p</em>.</p><p>2. The verifier presents a random <em>challenge h</em> to the prover (remember, h has to be public for verification to work). The additive shift</p><p>3. Prover generates a random nonce r, the multiplicate shift.</p><p>4. Prover computes <em>s = r + hp</em></p><p>5. The proof is (s, R) where R is the hides the nonce. R=Gr</p><blockquote>PoP = (s, R)</blockquote><h4>Proof Verification.</h4><p>The proof is true if it satisfies</p><blockquote>G^s = R.P^h</blockquote><p>This works because</p><blockquote>G^s = G^(r+hp)</blockquote><p>Gs=Gr x G^ph</p><p>Gs=R.P^h</p><p>This hopefully adds more context to the<em> s = r + ph</em> formulation used in Schnorr signatures. Note, this article explains a proof of possession, this is not the Schnorr signature algorithm. To covert POP to a signing algorithm, h becomes the hash of the message, this also make the signature protocol non-interactive by virtue of the Fiat-Samir transformation.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9bdf4458fa64" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SUP: State update prompts. Effective Use of LLM Scratch Memory for Long Reasoning Tasks]]></title>
            <link>https://medium.com/@farazshaikh/sup-state-update-prompts-effective-use-of-llm-scratch-memory-for-long-reasoning-tasks-f171bcf0da5d?source=rss-52b773d84dd8------2</link>
            <guid isPermaLink="false">https://medium.com/p/f171bcf0da5d</guid>
            <dc:creator><![CDATA[Faraz Shaikh]]></dc:creator>
            <pubDate>Mon, 27 Jan 2025 08:19:17 GMT</pubDate>
            <atom:updated>2025-01-27T08:41:17.954Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3ekl-95rCgDMU5BjGeakxw.png" /></figure><p>ChatGPT comes with a small personalization memory designed to support cross-session personalization. However, I’ve discovered an additional, powerful use for this memory: treating it as a scratchpad to store intermediate checkpoints during long reasoning sessions. Unlike single-shot sessions, where solutions are delivered in one go, long reasoning sessions involve collaboratively building a solution step by step. This approach ensures the LLM stays grounded, minimizing the risk of hallucination by maintaining a clear and consistent context throughout the process.</p><p>The goal is to save the most distilled and refined representation of the problem at each stage, much like peeling an onion — removing unnecessary details step by step until only the essence remains. The state update prompts are of the form.</p><pre>&gt; Don&#39;t update memory unless instructed.<br><br>&gt; Ask clarification questions if anything about the task is ambiguous<br>Update your memory and get ready for next set of instructions. <br><br>&gt; Update memory. I will be answering more questions next, nothing <br>more is expected from you. </pre><p>You start by instructing the LLM not to update memory unless asked to. Then you abstract the problem into 3 checkpoints.</p><h4>Checkpoint 1. (POR)</h4><ol><li>Explain the task and explicitly ask for all follow-up questions from the LLM.</li><li>Answer all questions and create a plan for the Record (POR) checkpoint for the task.</li><li>Ask the LLM to create a condensed understanding of steps 1 and 2 and save a checkpoint in memory.</li></ol><h4>Checkpoint 2. (Solution and refinement)</h4><ol><li>You should have a semi-formal representation of the problem in memory after checkpoint 1.</li><li>Ask the LLM to propose a solution.</li><li>Refine the solution, to fix any obvious issues. LLM most likely misses out on expectations if there are many. Remind it to look at the plan of record in checkpoint 1.</li></ol><h4>Checkpoint 3 (Dump the memory and the Solution).</h4><p>1. As the LLM for a memory dump, this saves the memory in the session chat logs <br>2. This allows you to clear the memory for the next task while retaining the ability to load memory if needed in case you decide to come back to this session for refinement.</p><h3>What do you get by this approach?</h3><p>The LLM output is grounded in axioms collected in the memory and there are fewer hallucinations. Without this approach, the LLM starts hallucinating after a few back-and-forth.</p><p>You get a second-level abstraction above the immediate prompt, which captures context and progress, much like having a git index, before creating a commit.</p><p>Better control of Context, the LLM is too eager to answer and it pollutes the context by prematurely blurting/repeating trivial details</p><h3>Example: A fairly complex PLSQL insert trigger for a blockchain schema. The blockchain saves data in a database and we want to create an “uber summary aka state root” at particular intervals.</h3><p>This is fairly complex as you have to explain the problem, describe the database scheme, and clarify rules for generating deterministic data ordering. The result is that the LLM generated the solution in a single shot after the final prompt.</p><p><a href="https://chatgpt.com/share/6795777e-39d0-8004-b511-a67a94fc5c82">https://chatgpt.com/share/6795777e-39d0-8004-b511-a67a94fc5c82</a></p><p>You can inspect the memory context in ChatGPT &gt; Settings &gt; Personalization &gt; Manage memory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R442eaZlG_oQ4NmPiFDRsw.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f171bcf0da5d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[100 years of consensus, a brief history ! ]]></title>
            <link>https://medium.com/@farazshaikh/100-years-of-consensus-a-brief-history-e99d70bd723c?source=rss-52b773d84dd8------2</link>
            <guid isPermaLink="false">https://medium.com/p/e99d70bd723c</guid>
            <dc:creator><![CDATA[Faraz Shaikh]]></dc:creator>
            <pubDate>Mon, 24 Jun 2024 00:03:06 GMT</pubDate>
            <atom:updated>2024-06-24T00:03:06.460Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ip-Xos5p7ywOfKdboe86pA.jpeg" /></figure><h3>100 years of consensus, a brief history ! 🎉</h3><p>Year 2024: Asynchronous Consensus without Trusted Setup<br>or Public-Key Cryptography. <br><a href="https://eprint.iacr.org/2024/677.pdf">https://eprint.iacr.org/2024/677.pdf</a></p><p>“To achieve fault-tolerance, the system must introduce redundancy in time and space. Redundancy in time is to combat the unreliability of the network. Messages can be dropped, reordered or arbitrarily delayed, therefore protocol must account for it and allow requests to be replayed if necessary without causing duplication in the system. Redundancy in space is generally achieved via adding redundant copies in different machines with different fault-domain isolation. Redundancy introduces the need for consensus, which is fundamentally affected by the underlying physics of the fault tolerance problem. To appreciate consensus, you must understand the nature of our consensus on passage of time” — — ???</p><p>Major results, infliction points.</p><p>1. 1915: General relativity (Einstein: led to Lamport’s understanding of logical time)</p><p>2. 1968: The Geometry of Space and Time (Lamport. Lost lecture)</p><p>3. 1975: Maintaining duplicate databases (paul johnson, bob thomas)</p><p>4. 1978: Time, Clocks, event ordering (Lamport, works on 3 using 2 &amp; 1)</p><p>5. 1982: BZT Generals problem (Lamport, Shostak, Pease). Introduces authenticated messages into consensus.</p><p>6. 1985: FLP impossibility result wrtx. async consensus (Fisher, Lynch, Patterson). You can still build practical systems.</p><p>7. 1988: View stamp Replication (Liskov, leader election &amp; leader failover). Isolates async behavior into leader election.</p><p>8. 1989: PAXOS practical consensus (Lamport). Confuses everyone, introduces minor modification to the leader election phase of VSR.</p><p>9. 1999: PBFT (Castro, Liskov et al. consensus in Byzantine setting)</p><p>10. 2008: Nakamoto consensus longest chain (Bitcoin, permissionless, async, bzt, isolates async behavior to network partition and healing phase)</p><p>12. 2012: Proof of stake (Peercoin network, King, Nadal)</p><p>13. 2012: Google spanner (reified the propagation delay in async network as a programmable abstraction)</p><p>14. 2014: Consensus without mining: (same as PBFT) (Tendermint network, J Kwon Cosmos network)</p><p>15. 2016: LMD-GHOST Ethereum composite consensus (POS fast consensus + possibility to fallback — Vitalik)</p><p>15. 2018 Round optimal consensus (leader equivocation resolved by trusted cryptography, SBFT, Hotstuff, VABA, <a href="https://www.linkedin.com/in/dahlia-malkhi-8b836a5/">Dahlia Malkhi</a> Ittai et al. <a href="https://www.linkedin.com/company/vmware/">VMware</a> blockchain, <a href="https://www.linkedin.com/company/facebook/">Facebook</a> Libra network)</p><p>16. 2018: Probabilistic Slot consensus merged consensus and DKG crypto, using <a href="https://www.linkedin.com/in/dan-boneh-8b599020/">Dan Boneh</a>, <a href="https://www.linkedin.com/in/benjamin-lynn-51832a8/">Benjamin Lynn</a> <a href="https://www.linkedin.com/in/thedwilliams/">Dominic Williams ∞</a> <a href="http://et.al/">et.al</a>, Internet computer protocol)</p><p>17. 2021: DKG still needed trusted setup, Groth resolved dkg in async setup using NiZK to eliminate complaint phase <a href="https://www.linkedin.com/in/jens-groth-a95672/">Jens Groth</a> et al. Snarks in NiZK still need trusted setup.</p><p>18. 2024: Victor Shoup et al. this work removes the trusted setup using stark equivalent setup to remove trusted setup. (sponsored by <a href="https://www.linkedin.com/company/chainlink-labs/">Chainlink Labs</a>)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e99d70bd723c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Net-New: Product Performance and Correctness in a Startup context]]></title>
            <link>https://medium.com/@farazshaikh/net-new-product-performance-and-correctness-in-a-startup-context-275471d101b4?source=rss-52b773d84dd8------2</link>
            <guid isPermaLink="false">https://medium.com/p/275471d101b4</guid>
            <dc:creator><![CDATA[Faraz Shaikh]]></dc:creator>
            <pubDate>Fri, 17 May 2024 18:45:22 GMT</pubDate>
            <atom:updated>2024-05-17T18:45:22.539Z</atom:updated>
            <content:encoded><![CDATA[<p>Startups often strive to bring “net-new” technology to market. This means their technology must be complex enough to create a competitive moat. If a startup’s technology isn’t complex, it might be a red flag. However, it’s important to note that a startup’s competitive advantage might not always stem from technology alone — it could be from go-to-market (GTM) strategies or unique marketing insights. Nevertheless, in most cases, especially in the enterprise sector, startups are focused on developing complex, net-new technology.</p><p>For a startup, it’s not enough for the technology to be new; it must also be both performant and correct. While initial proofs of concept can focus on correctness, building a sustainable product requires balancing performance and correctness. Here’s a guide to developing a startup product that is both performant and correct:</p><blockquote><strong>“Have performance in mind while engineering correctness, and have correctness in mind while chasing performance. Never chase both performance and correctness in a single step.” — FS</strong></blockquote><p>Understanding that startups deal with net-new challenges, the above principle becomes intuitive. Startups are not like leetcode coding exercises where you can produce both performant and correct code within a short timeframe. If the task is that straightforward, it likely isn’t net-new and the complexities are already well-understood. In startups, it’s rare to know everything upfront.</p><h3>Phases of Startup Product Engineering</h3><ol><li><strong>Phase I</strong>: Focus on developing minimal, correct, and reasonably performant code.</li><li><strong>Phase II</strong>: Conduct testing and write regression tests to ensure correctness.</li><li><strong>Phase III</strong>: Deploy the product and identify performance gaps.</li><li><strong>Phase IV</strong>: Prioritize performance improvements without breaking the regression tests from Phase II, using insights from Phase III.</li></ol><h3>Common Pitfalls to Avoid</h3><ol><li><strong>Mixing Performance and Correctness Phases</strong>: Combining the performance optimization phase (Phase IV) with the initial correctness phase (Phase I) can lead to significant problems:</li></ol><ul><li>Performance improvements can interfere with correctness, causing a recursive loop of issues.</li><li>Misprioritization of performance gaps can lead to optimizing the wrong parts of the stack.</li><li>Abstractions may become leaky as they are broken for misguided performance optimizations, exacerbating the recursion problem.</li></ul><p><strong>2. Not Embracing Rewrites in Phase IV</strong>: If Phases I-III are done correctly, substantial rewrites in Phase IV should be manageable without breaking correctness or key abstractions. Avoiding major changes during this phase can render all previous efforts useless.</p><h3>Implications on Hiring</h3><p>In terms of hiring, consider the following:</p><ul><li><strong>Senior Engineers with Phase Experience</strong>: Hiring senior engineers who have successfully navigated Phases I-IV in their past roles can be beneficial. They can compress the phases and alleviate the uncertianty of “time” to a large extent. However, these engineers often come from large companies like FANG or previous startup exits and might try to replicate processes that are not suited for early startups. They may join later in the startup’s life cycle, which can lead to mismatched expectations and criticisms about the initial development phases. To mitigate this, hire such experienced engineers as early as possible and focus them on net-new tasks to help them appreciate the startup’s unique challenges.</li><li><strong>New Grads</strong>: New graduates can be hired at any phase of the startup.</li><li><strong>Planning Skills</strong>: Avoid hiring individuals who are poor planners or wanting to learn to plan on the job (startups is a olympic skill, better to learn in a DOJO setting first). Effective planning is crucial for execution. During interviews, focus on candidates’ planning abilities — how they devise, de-risk, and use their past experiences to create abstractions to approach problems. The exact interview questions and the 45mins perfromance hardly matters.</li></ul><p>By adhering to these guidelines, startups can better navigate the complexities of developing net-new technology, balancing performance and correctness, and building a successful product.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=275471d101b4" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>