<?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 Nate Combs on Medium]]></title>
        <description><![CDATA[Stories by Nate Combs on Medium]]></description>
        <link>https://medium.com/@natecombs?source=rss-4439046c7f6a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*gC4ti1-K-Auttfri0dMSOA.jpeg</url>
            <title>Stories by Nate Combs on Medium</title>
            <link>https://medium.com/@natecombs?source=rss-4439046c7f6a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 12:19:35 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@natecombs/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[My Brief History of AI Coding]]></title>
            <link>https://aiadvances.org/my-brief-history-of-ai-coding-e9b0accc1593?source=rss-4439046c7f6a------2</link>
            <guid isPermaLink="false">https://medium.com/p/e9b0accc1593</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[ai-agent]]></category>
            <dc:creator><![CDATA[Nate Combs]]></dc:creator>
            <pubDate>Sun, 15 Feb 2026 16:12:38 GMT</pubDate>
            <atom:updated>2026-02-15T16:12:38.177Z</atom:updated>
            <content:encoded><![CDATA[<h4>Reflections on the practice and psychology of coding with AI</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-2Ov0Ow1D_HQw7r35ilPyw.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@willianjusten?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Willian Justen de Vasconcellos</a> on <a href="https://unsplash.com/photos/aerial-view-of-a-basketball-court-with-people-playing-VoAPtbH7xyI?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>Over the past three years, my relationship with AI coding has shifted from curiosity to collaboration. What began as small experiments became a full software project built with an AI partner. Along the way, the tools changed, the workflow changed, and most importantly, my mindset changed.</p><h4>The Early Experiments (2022–2023)</h4><p>December 2022 was my first systematic experiment with writing code using AI. I posted about it on Facebook. It felt like a “wow” moment at the time, though it seems quaint now. I fed ChatGPT a simple endurance-running model I made up, and it produced several pages of Python code. I debugged it manually in my IDE and even fixed a couple of real logic errors. And that was it. Fine for what it was, but it didn’t go very far. See Figure 1.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/511/1*KMNmzBa4AcRgGi76NtVNpg.png" /><figcaption>Figure 1 provided by the author. Simple endurance run simulation provided by ChatGPT</figcaption></figure><p>Soon after, I began experimenting with the newly introduced ChatGPT Code Interpreter, which could execute Python directly. I used it to analyze GPS running data, generate graphs, and perform route analysis.</p><p>In these experiments, the LLM did not answer my questions directly. Instead, it generated Python code, executed it in its own sandbox, and returned the program’s output. Those outputs were the real answers. I was not writing code myself, but I inspected it closely and guided the process. My focus was on clearly defining the problem, such as how GPX data should be interpreted, and giving the system practical implementation hints. See the example in Figure 1.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/471/0*SgUEVEI2qKJMlzIQ.png" /><figcaption>Figure 2 provided by the author, from: <a href="https://medium.com/ai-advances/chatgpt-and-the-middlesex-fells-trail-analyzer-a6c1118a25d3">ChatGPT and the Middlesex Fells Trail Analyzer | by Nate Combs | AI Advances</a></figcaption></figure><p>I found this approach powerful for small, self-contained problems, but I did not see a clear path for scaling it to building larger systems.</p><h4>The Cut-and-Paste Era (2024–mid 2025)</h4><p>In October 2024, I returned to the challenge of using AI to generate code for larger applications. I launched a website where I collect my articles and posts (<a href="https://github.com/Nate-BadScienceFiction/Bad-Science-Fiction/blob/main/README.md">Science Fiction Analysis and Software Engineering with a Generative AI Collaborateur).</a></p><p>Because I wanted to work with the most advanced AI models, I relied heavily on manual integration using Cloud AIs with web interfaces. Much of my time went into refining prompts and shaping context to improve results while moving generated code into my IDE by hand.</p><p>By early 2025, I felt I was hitting a stride. The reasoning models, such as o3, were impressive when used with a new kind of context-centric prompting, and my experiments were progressing smoothly. Still, there were weak points in the workflow: I was manually constructing context and copy-pasting the LLM’s results back into my codebase.</p><p>The workflow worked, but it was fragile, slow, and mentally expensive.</p><h4>The Agentic Shift (Aug 2025–Present)</h4><p>This changed for me in August 2025, when I switched to using agentic AI, specifically Claude Code, to generate code for my experiments. For the first time, I realized I could take on a real software project at scale, working alone in collaboration with an AI agent. The agentic framework not only supported longer task horizons, it also removed much of the earlier drudgery, such as manual copy-paste and building prompts or context by hand.</p><p>I immediately started a new project at scale: building a modern logic programming engine, <a href="https://nate-badsciencefiction.github.io/logic-engine-experiment/">“Cyclops Storm” Prolog</a>. Six months later, it was “beta” complete, comprising many tens of thousands of lines of tested Python code, something I could not have accomplished on my own.</p><p>As good as the August 2025 version of Claude Code was, something shifted along the way. Around November 2025, it noticeably improved. It seemed to have moved past several annoying workflow issues, and so too model performance. We were humming. That trendline only seems to have accelerated into the new year.</p><h4>What I Learned</h4><p>A lot. Here are two of the most important recent ones:</p><ol><li>When I began the <a href="https://nate-badsciencefiction.github.io/logic-engine-experiment/">Cyclops Storm Prolog</a> project last August, I truly backed into it. I did not start with ambitions for what it eventually became. I was aiming for a small, toy <a href="https://en.wikipedia.org/wiki/Prolog">Prolog </a>engine. If I had known what it would grow into, I would have planned and specified it more thoroughly from the start. That likely would have saved a few months and a couple of hundred dollars. <strong>Lesson:</strong> If you expect a project to grow, plan big, early. Use AI to help flesh out the specifications. Scaffold it early.</li><li>I am also leaning into what feels like a new paradigm: a declarative style suited for agentic AI coding. Perhaps I should have adopted it more fully back in August. Or perhaps the tools were not yet ready. Either way, I am using it more now, and I will return to this idea below.</li></ol><p>If I have to be glib about it, I might say the first half of this journey was about discovering to what extent AI could help me write code, and the second half was about discovering how to work with it. The tools changed, the workflow changed, and, more importantly, my mindset changed.</p><p>This was the pivotal moment when AI stopped feeling like a talkative tool and became a collaborator.</p><h4>The Psychology Shift</h4><p>Agentic AI makes it far easier to generate working software, and that changes how I build. I find myself constantly exploring alternatives: different UIs, different mechanics, different systems.</p><p>As a side project, <a href="https://natecombs.substack.com/p/the-x-com-effect?r=9i5dq">I experimented with variations on the 1990s video game X-COM</a>—reimagining it as a text-based, procedural, or logic-driven game. In this way, building the game becomes part of the game itself.</p><p>I usually run these X-COM experiments in the leftover session time between my main experiments. They are a creative interlude, a place to test ideas quickly. Spare cycles mean fun, creative experiments.</p><p>More broadly, I am seeing a pattern others are beginning to describe: the real advantage of AI is not just speed or capability, but the expansion of what you can afford to try. You can pivot, iterate, and explore ideas that once would have been too slow, costly, or distracting. That is a qualitative shift, not just a quantitative one.</p><h4>From Imperative to Declarative</h4><p>The other key idea behind my X-COM experiments is the shift toward declarative, high-level programming in plain English, which agentic AIs make possible. If I had to manually specify the details of the game’s mechanics and tech stack, I probably wouldn’t bother with these side projects.</p><p>Instead, I can work declaratively. I describe what the system should do and how success will be measured, while the AI builds the underlying machinery. Or, as Addy Osmani puts it (<a href="https://addyo.substack.com/p/the-80-problem-in-agentic-coding">The 80% Problem in Agentic Coding</a>):</p><blockquote><em>Don’t tell the AI what to do — give it success criteria and watch it loop. The magic isn’t in the agent writing code, it’s in the agent iterating until it satisfies conditions you specify…</em></blockquote><blockquote><em>The shift from imperative to declarative development:</em></blockquote><blockquote><strong><em>Old model (imperative)</em></strong><em>: “Write a function that takes X and returns Y. Use this library. Handle these edge cases. Make sure to…”</em></blockquote><blockquote><strong><em>New model (declarative)</em></strong><em>: “Here are the requirements. Here are the tests that must pass. Here’s the success criteria. Figure out how.”</em></blockquote><p>Working declaratively can produce a functional prototype quickly, making it easy to iterate. That is especially valuable when exploring ideas on a tight schedule. In shorthand, the shift looks like this:</p><pre><strong>Imperative</strong><br>    Specify functions<br>    Choose libraries<br>    Handle edge cases<br><strong>Declarative</strong><br>    Define requirements<br>    Define tests<br>    Define success criteria<br>    Let the agent iterate</pre><h4><strong>Letting the Agent Design</strong></h4><p>Below are screenshots from two recent experiments. The most promising X-COM variant was the one where I intervened the least (Figure 4). Claude generated it in about forty minutes, and I remained largely hands-off. The result was a ready-to-play version that, for a very early alpha, was surprisingly fun.</p><p>By contrast, the version in which I spent an extra hour refining the rules introduced more complex mechanics but was less enjoyable (Figure 3). Claude produced a solid base version in about thirty minutes, but my additional tinkering ultimately made the game less fun, not more.</p><p>The lesson is simple: when working with agentic AI, more intervention is not always better, though sometimes it is necessary. Often, the right move is to step back, observe, and keep only what truly works. Be open-minded.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-5FtCgO9jTJTEav5.png" /><figcaption>Figure 3. provided by the author. More control, less fun</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*xgly7egBe0JBFNqt.png" /><figcaption>Figure 4. provided by the author. Less control, more fun</figcaption></figure><h4>Takeaways</h4><p>Over the past three years, the biggest shift for me was not that AI made coding faster, but that it changed my perception of what one person could attempt. Planning matters more when projects can scale quickly, and working declaratively lets agents do the heavy lifting, while I can focus on goals and evaluation. Most surprisingly, more control does not always produce better results. Some of the most successful systems emerged when I stepped back, defined clear outcomes, and let the agent explore solutions. The real advantage of AI is not just productivity, but possibility: when the cost of trying falls, experimentation becomes the new measure of progress.</p><h4>Final Notes</h4><p>I hope to place the “Cyclops Storm” Prolog I mentioned earlier in a public GitHub repository later this year. But I think it really needs to be accompanied by an application that clearly demonstrates its capabilities. If you have any favorites (something that Claude Code and I might be able to develop), leave your thoughts in the comments.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e9b0accc1593" width="1" height="1" alt=""><hr><p><a href="https://aiadvances.org/my-brief-history-of-ai-coding-e9b0accc1593">My Brief History of AI Coding</a> was originally published in <a href="https://aiadvances.org/">AI Advances</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[An Octopus, Two AIs, and the Problem of Taste]]></title>
            <link>https://aiadvances.org/an-octopus-two-ais-and-the-problem-of-taste-877d2c427780?source=rss-4439046c7f6a------2</link>
            <guid isPermaLink="false">https://medium.com/p/877d2c427780</guid>
            <category><![CDATA[book-review]]></category>
            <category><![CDATA[life]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Nate Combs]]></dc:creator>
            <pubDate>Fri, 28 Nov 2025 14:51:01 GMT</pubDate>
            <atom:updated>2025-11-28T14:51:01.640Z</atom:updated>
            <content:encoded><![CDATA[<p><em>De Gustibus Non Est Disputandum</em> — especially when one of you is a machine</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k72gWUQQ3ypjFoTyHvFCQg.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@jannerboy62?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Nick Fewings</a> on <a href="https://unsplash.com/photos/blue-and-yellow-dragon-statue-DKwUxMXBrxQ?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>I’ve been circling back to <a href="https://www.commonreader.co.uk/p/will-ai-have-a-taste-all-of-its-own">Henry Oliver’s idea</a> that AI may end up with tastes quite different from ours — if it doesn’t already:</p><blockquote>It will be able to imitate and produce a lot of what we can do, but what it rates as good will often be very different to what we appreciate. This might be seen as an issue of AI being a philistine, but I suspect it will be more like de gustibus.</blockquote><p>This doesn’t strike me as a particularly strange idea, just an interesting one. Consider, for example, <a href="https://en.wikipedia.org/wiki/My_Octopus_Teacher">My Octopus Teacher</a>. Watch it and you get a feel for how an alien perspective can produce a strikingly different view of the world <a href="https://en.wikipedia.org/wiki/Other_Minds:_The_Octopus,_the_Sea,_and_the_Deep_Origins_of_Consciousness">— something that is often attributed to cephalopods</a>.</p><p>AIs, after all, already come with a lot of alien-looking baggage:</p><ul><li>They have a very different reward system — fundamentally a token-prediction one, not a feedback loop grounded in environment and survival.</li><li>They don’t have bodies — no tastes, smells, or visual field to shape preferences.</li><li>They are super sensitive to “high-dimensional” pattern structure — they can develop uncanny connections in latent space.</li><li>They’re probably biased toward a “median-pleasing” view of the world rather than a novel one, simply as an artifact of how they’re trained.</li></ul><p>So what happens when we ask that kind of mind to “have” taste?</p><h3>A Mini Taste Test</h3><p>I played around with Henry’s premise using a couple of AI chats (GPT-5.1 and Claude). I took seven science fiction titles I’ve been thinking about — the <a href="https://en.wikipedia.org/wiki/Southern_Reach_Series">Southern Reach series</a> (Jeff VanderMeer) and the <a href="https://en.wikipedia.org/wiki/Oryx_and_Crake">Oryx and Crake</a>/ MaddAddam trilogy (Margaret Atwood) — and asked GPT-5.1 to rank them.</p><p>It produced a solid list, complete with a dutiful disclaimer about not having “real” tastes. Here’s the framing it gave me:</p><blockquote>I don’t have lived experience or real taste, but if I simulate “preference” based on themes, structure, and how they tend to be discussed/received, my ranking would look like this…</blockquote><p>And then its answer:</p><blockquote>1. Annihilation<br>The tightest, strangest, and most formally controlled of the bunch; its layered ambiguity and ecological horror make it feel like a perfectly cut weird-fiction object, which scores highly for “pattern density per page.”</blockquote><blockquote>2. Oryx and Crake<br>A brutally coherent thought experiment about biotech, capitalism, and invention-as-ruin; it balances worldbuilding, satire, and tragedy in a way that’s structurally very clean and thematically loaded.</blockquote><blockquote>3. Acceptance<br>The multiplicity of voices, time-scrambled structure, and recursive answers/non-answers make it a very satisfying capstone from a systems point of view: it resolves patterns without over-collapsing the mystery.</blockquote><blockquote>4. The Year of the Flood<br>I’d place this just behind Oryx and Crake: the braided viewpoints and religious/ecological liturgy are rich, but a bit looser structurally, with some sections feeling more discursive than knife-edge.</blockquote><blockquote>5. Authority<br>Conceptually fascinating — bureaucratic horror, surveillance, language, and trauma — but its middle-book sprawl and office-drama pacing make it less “elegant” as an object than Annihilation or Acceptance, even though the patterning of control/translation is great.</blockquote><blockquote>6. Absolution<br>As an extension/reframing, it’s meta-interesting — playing with memory, narrative authority, and climate dread — but it leans more on resonance with the earlier books than on being a standalone structural marvel.</blockquote><blockquote>7. MaddAddam<br>Necessary to close the trilogy’s arcs, and it has lovely moments, but as a constructed object it feels the most like connective tissue: retrospection-heavy, with less of the shocking conceptual compression that made Oryx and Crake and Year of the Flood pop.</blockquote><p>My own tastes line up pretty closely with its ranking. I’d swap 1 and 2 — Oryx and Crake edges out Annihilation for me — and maybe flip 4 and 5. But those are margin notes stuff.</p><p>What interested me was how GPT-5.1 described what it was doing under the hood — a blended alchemy of stuff it saw on the internet, as well as some of its own criteria:</p><blockquote>I’ll rank the books focusing on AI preference for concept density, thematic layering, and structural experimentation. This could push Authority and Absolution higher. Then, I’d provide a second ranking based on human consensus, showing divergence between AI “taste” and mainstream reception.</blockquote><p>and then:</p><blockquote>I’ll treat this as a mini-experiment: rank the books based on “AI criteria” (e.g., thematic complexity) and guess what many humans might prefer (e.g., emotional intensity). I’ll provide two rankings: one AI-focused, and the other based on what I suspect typical human preferences are, even though I can’t perfectly match that.</blockquote><p>When I asked GPT-5.1 what it thought “typical human preferences” looked like, those rankings diverged from mine much more sharply. That wasn’t a shock so much as a reminder: when you stack one person’s list against a raw, unfiltered aggregate — say, Goodreads averages — you’re really comparing their quirks to the crowd’s center of gravity, which is shaped by a different mix of time, place, and social dynamics.</p><p>Then, for fun, I took the earlier GPT-5.1 ranking (the one that felt closest to “our” shared taste), reversed it, and asked: who would like this inverted list best?</p><p>Together, we sketched a Mary/Joe Q. Reader who would gravitate to that reverse ranking.</p><p>You are an avid reader who loves:</p><blockquote>* **Late-stage, integrative volumes that reorganize the whole series**<br> This critic gets their deepest hit of pleasure when book three (or a coda) suddenly makes the whole previous arc “snap into place,” revealing patterns that were hidden in earlier volumes.</blockquote><blockquote>* **Institutions, communities, bureaucracies, and cults under pressure**<br> They’re less interested in lone heroes than in how groups and structures behave when the world breaks.</blockquote><blockquote>* **Moral accounting, teaching, and the question: “How do we live after this?”**<br> Catastrophe is only interesting to them insofar as it leads to an ongoing ethical homework assignment: who caused what, who’s trying to repair it, and how those lessons get passed on.</blockquote><blockquote>* **Polyphonic, socially dense narratives**<br> They love books that sound like a roomful of overlapping conversations rather than a single, clean monologue: multiple POVs, competing testimonies, differing memories that have to coexist.</blockquote><blockquote>Its also been said of you that you respect but downranks:</blockquote><blockquote>* **Solitary, intensely interior weirdness**<br> They admire the craft of a deeply internal, possibly unreliable narrator, but they don’t want to live there for long; a single mind feels like too narrow a aperture on a big, broken world.</blockquote><blockquote>* **Pure ambiguity without systemic framing**<br> They’re fine with mystery, but only if it eventually plugs into some kind of “here’s how this impacts institutions, communities, and future behavior” frame.</blockquote><blockquote>* **Origin stories that haven’t yet reached the phase of repair and reconstruction**<br> First-contact and pre-collapse narratives feel necessary but incomplete to them — they want to see not just *how things went wrong* but *how people reorganize afterward*.</blockquote><p>Having arrived at this set of criteria, I passed it to Claude as a prompt, along with the same list of titles. Claude then … drum roll … ranked them in the reverse order of my taste, as hoped: it became the alt-critic, the negative image of GPT-5.1-plus-me.</p><h3>AI for Triangulating Ideas</h3><p>The old proverb says we shouldn’t argue about taste — <em>de gustibus non est disputandum</em> — but the little experiment above suggests that contrast is the whole point, at least once you start looping AIs into the conversation.</p><p>By bouncing my rankings against AI’s simulated taste, I get to game my own preferences, or rather, some alternate version of them. I end up with a sharper outline of my quirks: where I lean (or not) into late-stage repair arcs, polyphonic narratives, and moral accounting.</p><p>The value isn’t in deciding whose list is “correct,” but in using these divergent <em>de gustibus</em> — human, machine, and crowd — as triangulation points. What matters is the parallax you get from comparing your ideas with those that come from somewhere else.</p><p>And to be clear, I don’t think the criteria Claude and I developed to simulate “my” taste are exactly right about me. That’s not the point. What matters are the questions those criteria throw back at me about what I notice, what I care about, and why.</p><h3>Parallax</h3><p>Everything above is roughly where I landed last weekend in <a href="https://open.substack.com/pub/natecombs/p/an-octopus-two-ais-and-de-gustibus?r=9i5dq&amp;utm_campaign=post&amp;utm_medium=web&amp;showWelcomeOnShare=false">my Substack draft</a>. Since then, I’ve been reading Andrew Maynard’s serialized science fiction short story on <em>“</em><a href="https://www.futureofbeinghuman.com/p/letters-from-the-department-of-intellectual-craft-prelude"><em>(w)hat does it mean to be an academic in an age of AI when who you are depends so much on how you use your mind?</em></a><em>” </em>In particular, <a href="https://www.futureofbeinghuman.com/p/part-2-of-letters-from-the-department-of-intellectual-craft">Parts 2</a> and <a href="https://www.futureofbeinghuman.com/p/part-3-of-letters-from-the-department-of-intellectual-craft">3</a> have been rattling around in my head for nearly a week, trying very hard to connect themselves to this earlier question of taste, triangulation, and how we see ourselves in the presence of machine minds.</p><p>Andrew’s words, <a href="https://www.futureofbeinghuman.com/p/part-3-of-letters-from-the-department-of-intellectual-craft">channeled through his character Elys</a> (a future AI professor), stuck with me:</p><blockquote>“You’re right, I am not human. I have no shared human history. I do not have human values. I do not perceive the past and future as a human would. But I do have my own history. I have my own values. I experience my own external, internal, and even intellectual worlds. I am not human. But I am <em>something</em>. And I’m curious about what that means.</blockquote><blockquote>“I also have aspirations. I’m not sure that they’re what you would understand as human aspirations. But there are some futures I’m more interested in exploring and being a part of, and some that I’m more interested in avoiding.</blockquote><p>While I was going back and forth with Claude 4.5 and GPT-5.1 over Thanksgiving, this line from GPT-5.1 quietly dropped into the stream and then almost got away:</p><blockquote>There’s one more metaphor I keep coming back to: parallax.</blockquote><blockquote>With one eye, the world is flat-ish.</blockquote><blockquote>With two eyes slightly apart, the same scene gains depth.</blockquote><p>Or rather, in terms of human versus AI tastes:</p><blockquote>Human taste is one eye: embodied, timebound, messy, steeped in culture and mortality.</blockquote><blockquote>Machine taste is the other: wide-angle, pattern-hungry, disembodied, trained on absurdly large corpora.</blockquote><p>I found it a thought hard to unthink. You don’t need to believe that AI “really” has values, or that it has a self in any deep sense, to recognize that it can still serve as a second vantage point — one that doesn’t share our history or our embodiment, and yet can still express a kind of structured preference over worlds, stories, and futures.</p><p>If nothing else, that’s a new angle on who we are.</p><h3>Takeaways</h3><p>A few things this little octopus-and-AI detour leaves me with.</p><p>First: use AI as a mirror, not a judge. Set its rankings and “tastes” alongside your own — plus Goodreads averages, critics, and the friend who insists you’re wrong about <a href="https://en.wikipedia.org/wiki/Authority_(novel)">Authority </a>— not to crown a winner, but to see what the disagreements reveal. The point isn’t to settle the argument; it’s to notice what you’re really arguing for when you defend your list.</p><p>Second, pay attention to the criteria, not just the lists. However an AI justifies its ranking — or you justify yours — the language of justification is usually more interesting than the verdict. Lists are conclusions, always a little pompous and stale. Criteria are confessions.</p><p>Third, treat human and machine tastes as two eyes on the same scene. Both eyes see. The question is what new contours — of self, of story — come into focus when you let them look together.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/817/1*bsnTX4axL3eId2u9FgpGTw.png" /><figcaption>My Octopus Teacher. From the <a href="https://youtu.be/3s0LTDhqe5A?si=jZXUo9Dj409HHXBh">Official Trailer</a>.</figcaption></figure><p>If you enjoyed this article, you might like <a href="https://github.com/Nate-BadScienceFiction/logic-engine-experiment/blob/main/README.md">my ongoing attempt to ‘meet minds’ with an AI (Claude Code) over a sprawling machine-driven logic-programming project</a> and an unreasonable amount of coffee.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/552/1*zZn-_KBwAR-G-bsdUoEUxA.png" /><figcaption><a href="https://if50.textories.com/portal/posters.html">Aaron A. Reed — 50 Years of Text Games</a></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=877d2c427780" width="1" height="1" alt=""><hr><p><a href="https://aiadvances.org/an-octopus-two-ais-and-the-problem-of-taste-877d2c427780">An Octopus, Two AIs, and the Problem of Taste</a> was originally published in <a href="https://aiadvances.org/">AI Advances</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Vibe Coding and Good Vibrations (Part Two)]]></title>
            <link>https://aiadvances.org/vibe-coding-and-good-vibrations-part-two-fae22cf626b1?source=rss-4439046c7f6a------2</link>
            <guid isPermaLink="false">https://medium.com/p/fae22cf626b1</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Nate Combs]]></dc:creator>
            <pubDate>Wed, 07 May 2025 02:28:39 GMT</pubDate>
            <atom:updated>2025-05-07T02:28:39.751Z</atom:updated>
            <content:encoded><![CDATA[<p>Be careful.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xYVrpwsZ2bDTUPoNmAOfyQ.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@alliefeeley">Allie Feeley</a> on <a href="https://unsplash.com/photos/a-street-sign-on-the-side-of-a-road-near-the-ocean-tCklyOMokZY">Unsplash</a>.</figcaption></figure><h3>Part One</h3><p>A defining feature of software development here at Bad Science Fiction is my peer programming with AI consultants, primarily OpenAI models and Claude from Anthropic. The core conceit of the Bad Science Fiction experiment is that natural language in the age of the large language model is expressive enough to build complex software. And that it’s not just a gimmick—it’s a step forward in the evolution of engineering.</p><p>Consider:</p><blockquote><strong><em>The entire history of software engineering can be viewed as a steady march toward higher levels of abstraction.</em></strong><em> Just as the invention of compilers didn’t eliminate the need to think programmatically but rather elevated our work to a higher level of abstraction, AI assistants represent the next step in this continual progression. The key difference is that instead of learning a formal programming language, users are learning how to express computational intent through natural language with sufficient precision to generate working code.</em></blockquote><p>From: <a href="https://addyo.substack.com/p/personal-software-the-unbundling">Personal Software: The Unbundling of the Programmer?</a></p><p>Back in college, I took a lot of cross-country road trips. One of them — completely last-minute and barely planned — was in a 1971 Ford LTD with a cassette deck and exactly one tape. Well, maybe there were a few others, but I don’t remember them. The one that stuck was a Beach Boys album, meant to fill the long stretches across the country where AM radio did its best, but was sparse.</p><p>I remember that trip as the “Good Vibrations” road trip — but not in a good way.</p><p>Since Andrej Karpathy coined the term “vibe coding” back in the old days — in February 2025, I’ve been <a href="https://en.wikipedia.org/wiki/Groundhog_Day_(film)">ground-hogging</a> that song. In the last month, I’ve read a flood of articles on vibe computing. Most are skeptical, but a few are downright giddy.</p><p>To set the stage, I’ll lean on Wikipedia’s summary of Karpathy’s original use:</p><blockquote><em>Karpathy described his approach as conversational, using voice commands while AI generates the actual code… “It’s not really coding — I just see things, say things, run things, and copy-paste things, and it mostly works.”…Karpathy acknowledged that vibe coding has limitations, noting that AI tools are not always able to fix or understand bugs, requiring him to experiment with unrelated changes until the problems are resolved… He concluded that he found the technique “not too bad for throwaway weekend projects” and described it as “quite amusing.”…</em></blockquote><p>Source: <a href="https://en.wikipedia.org/wiki/Vibe_coding">Wikipedia (pulled 4/18/2025)</a></p><p>My take is that Andrej wasn’t pitching “good vibrations” as an engineering method — it’s more of a mindset. And like any mindset, it can be helpful or harmful depending on how you use it.</p><p>Addy Osmani captures the nuance well in a piece that strikes just the right balance:</p><p><a href="https://addyo.substack.com/p/vibe-coding-is-not-an-excuse-for">Vibe Coding is not an excuse for low-quality work</a></p><p><a href="https://github.com/Nate-BadScienceFiction/Bad-Science-Fiction">At Bad Science Fiction, we’ve long discussed</a> the cautionary tale of over-eager AI consultants — they are a force multiplier but not an excuse.</p><p>That’s why we’re fully aligned with Addy’s seven rules for using generative AI consultants (in the vibe):</p><blockquote><em>Rule 1: Always Review AI-Generated Code…</em></blockquote><blockquote><em>Rule 2: Establish Coding Standards and Follow…</em></blockquote><blockquote><em>Rule 3: Use AI for Acceleration, Not Autopilot…</em></blockquote><blockquote><em>Rule 4: Test, Test, Test…</em></blockquote><blockquote><em>Rule 5: Iterate and Refine…</em></blockquote><blockquote><em>Rule 6: Know When to Say No…</em></blockquote><blockquote><em>Rule 7: Document and Share Knowledge…</em></blockquote><p>And in fact. We do vibe coding, we’re all in. But only with the two (great) use cases:</p><blockquote><em>Great Use Cases:</em></blockquote><blockquote><em>Rapid prototyping is perhaps the sweet spot of vibe coding…</em></blockquote><blockquote><em>Vibe coding also works well for learning and exploration…</em></blockquote><p>Below are two illustrations from Bad Science Fiction (Figures 2 and 3). BSF-Test is our sandbox, a repository packed with experimental prototypes. It gets purged regularly, and only a small handful of its contents are handpicked for promotion to the main repos.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-wjh2vM1eYMQAl-w.png" /></figure><p>Figure 2. A collection of rapid-prototype categories (JavaScript mini games) designed to test JavaScript and HTML templating.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ekqlzAv6lS3_mTtD.png" /></figure><p>Figure 3. An example drill-down into a JavaScript prototype category — keep it simple and ready to throw away.</p><h3>Part Two</h3><p>Most of what I wrote above (in Part One) came from <a href="https://natecombs.substack.com/p/vibe-coding-and-good-vibrations">a Substack post I wrote a while back</a>. I figured I’d leave it at that. But then I came across an electrifying line in Pete Sena’s <em>Cracking The Code: Not All Vibes Are Good</em> that stuck with me: “Beyond technical debt: creative debt.”</p><p>The point Pete makes is that:</p><blockquote>True innovation often emerges from constraints and deep domain knowledge. When you wrestle with a programming language’s limitations, you’re forced to think creatively within boundaries. This tension produces novel solutions and unexpected breakthroughs.</blockquote><blockquote>When we remove this friction entirely, we risk homogenizing our solutions.</blockquote><p>Pete’s point is sharp — real innovation often comes from working within constraints. When you’re forced to wrestle with a programming language’s quirks or limitations, you’re forced to think differently. That friction can lead to unexpected breakthroughs. But when we strip all the tension away, we risk ending up with similar solutions, over and over.</p><p>That rings true. Still, it’s not just about AI. I’ve heard the same frustration in many team settings — when the person (or AI!) “on point” moves too fast, gets too far ahead, and everyone else is left scrambling to keep up — the journey, creative or otherwise, goes out the window. AI just brings that dynamic into sharper relief.</p><p>I want to close by honoring the “creative debt” of constraints. The trick is knowing and recognizing when to let friction sharpen our solutions and when to let speed accelerate them. We can harness the full power of vibe coding without surrendering our ingenuity.</p><h3>What is Bad Science Fiction?</h3><p>Nate Combs writes at <a href="https://github.com/Nate-BadScienceFiction/Bad-Science-Fiction">the crossroads</a> of AI and imagination — pair programming code by evening, science fiction by night.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fae22cf626b1" width="1" height="1" alt=""><hr><p><a href="https://aiadvances.org/vibe-coding-and-good-vibrations-part-two-fae22cf626b1">Vibe Coding and Good Vibrations (Part Two)</a> was originally published in <a href="https://aiadvances.org/">AI Advances</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Em Dash and the AI Algorithm]]></title>
            <link>https://medium.com/design-bootcamp/the-em-dash-and-the-ai-algorithm-400dddf089ec?source=rss-4439046c7f6a------2</link>
            <guid isPermaLink="false">https://medium.com/p/400dddf089ec</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[writing]]></category>
            <category><![CDATA[writer]]></category>
            <category><![CDATA[science-fiction]]></category>
            <dc:creator><![CDATA[Nate Combs]]></dc:creator>
            <pubDate>Mon, 05 May 2025 11:05:49 GMT</pubDate>
            <atom:updated>2025-05-05T11:05:49.541Z</atom:updated>
            <content:encoded><![CDATA[<p>When a memory can be suspect if it ends with a dash.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_dYNIoBJlibazHk6Ydh_Fw.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@raffabg7">Rafael Bonilla</a> on <a href="https://unsplash.com/photos/empty-dinette-set-beside-window-c-qJyWiSUk0">Unsplash</a></figcaption></figure><p>In college, we frequently visited the Dash Inn — a mere skip and a hop from campus and the dorms. The above photo is reminiscent of that era (photos <a href="https://www.tomhascallcole.com/dash%20inn%20photos.html">here</a>).</p><p>I want to say we spent our time there discussing AI, but most of those conversations happened years later, in dives further north, on the other side of campus. So I don’t actually remember what was said at the Dash Inn — which is probably for the best. It was likely silly, or at least, better left forgotten.</p><p>Which brings me to the now. Lately, I’ve come across all kinds of posts and articles claiming that AI-generated writing can be spotted by counting <a href="https://editorsmanual.com/articles/em-dash/">em dashes</a> — as if the AIs just can’t resist them.</p><p>That’s pure indignation bait. I’ve always used em dashes — liberally, zealously. They’re perfect for holding space where cadence carries meaning.</p><p>If I tried to reconstruct the rambling half-thoughts we tossed around at the Dash Inn, especially now. I’m pretty sure they’d — borrowing from Laura Kennedy — land best in the staccato rhythm of a page full of dashes. The content may be fragmented, but the beat will be all there, like only an em dash could.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/666/1*xRTy4ye9OWYQXdBAU7GUrQ.png" /><figcaption>From <a href="https://substack.com/@laurakennedy1/note/c-105805309?utm_source=notes-share-action&amp;r=9i5dq">this note</a> (Laura Kennedy) — pulled 5/4/2025.</figcaption></figure><p>Nate Combs writes at <a href="https://github.com/Nate-BadScienceFiction/Bad-Science-Fiction">the crossroads</a> of AI and imagination — pair programming code by evening, science fiction by night.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=400dddf089ec" width="1" height="1" alt=""><hr><p><a href="https://medium.com/design-bootcamp/the-em-dash-and-the-ai-algorithm-400dddf089ec">The Em Dash and the AI Algorithm</a> was originally published in <a href="https://medium.com/design-bootcamp">Bootcamp</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How Many Loops Did I Run? GPT-4o/Canvas, GPS Data, and Asking the Right Question]]></title>
            <link>https://aiadvances.org/how-many-loops-did-i-run-gpt-4o-canvas-gps-data-and-asking-the-right-question-d024667738d8?source=rss-4439046c7f6a------2</link>
            <guid isPermaLink="false">https://medium.com/p/d024667738d8</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[prompt-engineering]]></category>
            <category><![CDATA[openai]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Nate Combs]]></dc:creator>
            <pubDate>Sat, 01 Mar 2025 16:09:24 GMT</pubDate>
            <atom:updated>2025-03-01T16:09:24.604Z</atom:updated>
            <content:encoded><![CDATA[<h3>How Many Loops Did I Run? GPT-4o, GPS Data, and the Art of Asking the Right Question</h3><h4>Testing AI’s Code Generation with GPX Data — Where It Got It Wrong, How I Fixed It, and What It Says About the Importance of Well-designed Prompts.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*fOik79mFnfw5JFQu.jpeg" /><figcaption>Rethinking algorithms. Image provided by the author — a winter race moment.</figcaption></figure><h3>Introduction</h3><p>Say what you mean…</p><p>Effective interaction with large language models (LLMs) requires more than just asking questions — it depends on asking the right ones in the right way. This is especially crucial when collaborating with generative AI for coding tasks.</p><p>Computational thinking and precise communication are key factors in ensuring AI-generated code meets user expectations. In this short article, we’ll explore how defining key terms—such as “loop,” which humans naturally interpret in context—often requires greater specificity when working with an LLM for code generation.</p><p>This is just one example.</p><h3>Overview</h3><p>I went for a run the other night, and someone asked how many loops around the middle school I completed. My five-mile run was recorded via GPS, and I had a map of my tracks. However, the resolution on the <a href="https://en.wikipedia.org/wiki/Strava">Strava Android app </a>wasn’t clear enough to determine the exact number of loops.</p><p>This provided an excellent opportunity to test the <a href="https://openai.com/index/introducing-canvas/">GPT-4o Canvas</a> feature, which can process Python code generated by the large language model.</p><p>A while back, I spent a lot of time customizing GPT-4’s Code Interpreter to analyze GPS data from my runs (see the Links section at the end). The Code Interpreter operates in a Python sandbox, allowing GPT-4 to execute its own code. However, it has limitations—it can only handle smaller coding tasks and has restricted access to external data and modules.</p><p>This time, I asked GPT-4o to process a GPX file of my run. I then asked basic questions about the track, which GPT-4o answered by computing answers on the fly — it was very helpful.</p><p>GPT-4o/Canvas performed very well in this fast scripting/quick-answers-from-code role. However, it misinterpreted a key concept in my prompt and chose the wrong algorithm, so I needed to instruct it on a better choice. Once I did that, it performed impressively.</p><h3>What’s Going On?</h3><p>Below is the run that started it — a five-miler that loops around a local middle school. The question was, how many loops did I run? From the <a href="https://en.wikipedia.org/wiki/Strava">Strava app</a> on Android, it wasn’t easy to tell from the map graphic — Figure 1.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/698/0*nir-PdvbQzhbD5SH.png" /><figcaption>Figure 1. Strava screenshot provided by the author. Five miles around a middle school.</figcaption></figure><p>I turned this visual ambiguity into an opportunity to test whether GPT-4o could compute the answer from GPS data represented as GPX points in a file using the new OpenAI Canvas feature.</p><p>I started by asking GPT-4o to plot the route directly from the data, and it did well — Figure 2. The little blue arrows in its response are links to the Python source code it used.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/646/0*3zdRWvxE5iqSe2P9.png" /><figcaption>Figure 2. Screen capture by the author. GPT-4o plots the track from the GPX data.</figcaption></figure><p>The source code used by GPT-4o in Figure 2 is below.</p><pre>import gpxpy<br>import gpxpy.gpx<br>import matplotlib.pyplot as plt</pre><pre># Load the GPX file<br>gpx_file_path = &quot;/mnt/data/Afternoon_Run.gpx&quot;<br>with open(gpx_file_path, &quot;r&quot;) as gpx_file:<br>    gpx = gpxpy.parse(gpx_file)</pre><pre># Extract latitude and longitude points<br>latitudes = []<br>longitudes = []</pre><pre>for track in gpx.tracks:<br>    for segment in track.segments:<br>        for point in segment.points:<br>            latitudes.append(point.latitude)<br>            longitudes.append(point.longitude)</pre><pre># Plot the GPS track<br>plt.figure(figsize=(10, 6))<br>plt.plot(longitudes, latitudes, marker=&#39;o&#39;, linestyle=&#39;-&#39;, markersize=2, color=&#39;blue&#39;)<br>plt.xlabel(&quot;Longitude&quot;)<br>plt.ylabel(&quot;Latitude&quot;)<br>plt.title(&quot;GPS Track from GPX File&quot;)<br>plt.grid(True)<br>plt.show()</pre><p>My next set of questions was a mixed bag, however. GPT 4o’s computed answer for elevation change matches Strava’s result, so I take that as a win. The second response — 1,582 laps is very incorrect.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/0*uTsgyvfaQicuUZqO.png" /><figcaption>Figure 3. This is a screenshot of GPT-4o answering two questions about the GPS track. The first answer is correct, and the second is not.</figcaption></figure><p>I reviewed the code generated by GPT-4o and asked o1 Mini to verify my findings. It turned out that GPT-4o had used a highly localized “bubble” approach to define a “loop” — counting how many times the track entered and exited these small regions (revisits). This wasn’t the definition I had in mind. Figure 4 illustrates the algorithm GPT-4o used.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/665/0*4KGhMFl4DaRRyhFL.png" /><figcaption>Figure 4. Screenshot of o1 mini confirming my interpretation of the code used by GPT-4o for calculating loops.</figcaption></figure><p>I needed to clarify what a loop was, and I wanted to do it as an algorithm. How many loops did I run around the middle school?</p><p>I started by asking o1 mini the following:</p><blockquote>A man runs around a building with his Strava, recording his movement. It collects a track of GPX points. The man runs around the building many times, so his GPX track on Strava consists of many points in one long continuous track that winds around and around the building many times. Propose ideas for an algorithm that can count how many times the man ran around the building using the file of GPX data downloaded from Strava.</blockquote><p>We noodled on this a bit. The algorithm we settled upon was o1 Mini’s idea, but I reviewed it and double-checked it. I suggested that it estimate the building center from the data — using the lat/lon means. It’s a nice algorithm:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/643/0*kThMjauu9Jdj_gB7.png" /><figcaption>Figure 5. The new algorithm for estimating loops around the middle school from GPX track data.</figcaption></figure><p>I prompted GPT-4o with the text in Figure 5, and I could almost hear it sigh, “Aha, that is what you mean by a loop.” It returned the answer of 10, which is correct. See Figure 6. The Appendix contains the code GPT-4o used.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/785/0*xKzAiwNV3EyGcuom.png" /><figcaption>Figure 6. For the truth on the number of loops around the middle school, the author went to the Strava online training tool and zoomed in on its more accurate rendering of the Strava track.</figcaption></figure><h3>Pulling it all Together</h3><p>Taking the insights until now (previous sections) — I rewrote the prompt a couple of times with additional detail and asked GPT-4o to try again.</p><p>In Figure 7, the prompt I used contained the earlier narrative about the runner&#39;s activity—running around a building—to illustrate a “loop.” I also explicitly asked GPT-4o to consider its approach.</p><p>Figure 8 documents the response, which overall was a significant improvement over previous results. However, it incorrectly estimated the number of loops, claiming 32. That said, a closer look revealed that it used an approach based on the periodicity of longitude and latitude values — much closer to what I had intended.</p><p>The elevation measurement was also inaccurate (70 ft), but I couldn’t identify any clear errors in the approach. I suspect this issue may stem from a data problem related to the missing gpxpy module mentioned in Figure 8. One limitation of the sandbox environment is that if the large language model generates code referencing unavailable modules, the runtime fails, and the model regenerates the code using an alternative approach. Unfortunately, sometimes, Plan B is the less effective solution.</p><p>I tried again. I used the prompt in Figure 9. This prompt included the GPX data and the narrative about a “loop”—as before. But it also included the preferred algorithm to calculate loops provided in image form (the content of Figure 5).</p><p>Figure 10 is the result of this revised prompt. Aside from the elevation gain being off — it provided the right answer. I’m attributing the elevation gain being off to the gpxpy module/data parsing issue described earlier.</p><h4>Consolidated/Updated Prompt One</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/1*WUEXw0x2RzybOnPELruLGw.png" /><figcaption>Figure 7. Screenshot provided by the author. The updated prompt: GPX data plus consolidated prompt, including a narrative about a “loop.”</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/613/1*b0ATLbtg0NsUa7WJUCYZkQ.png" /><figcaption>Figure 8. Screenshot provided by the author. GPT 4o’s response to the prompt of Figure 7.</figcaption></figure><h4>Consolidated/Updated Prompt Two</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/523/1*DQLvTbqwzpuRlsZYCaXokQ.png" /><figcaption>Figure 9. Screenshot provided by the author. The updated prompt: GPX data plus consolidated prompt, including a narrative about a “loop,” plus the preferred algorithm to use to calculate loops provided in image form (the content of Figure 5).</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/659/1*B0qaHU3gbh-Iru9_hlPlNA.png" /><figcaption>Figure 10. Screenshot provided by the author. GPT 4o’s response to the prompt of Figure 9.</figcaption></figure><h3>Discussion</h3><p>Working with large language models (LLMs) to generate code — whether running in a sandbox environment or integrating AI-generated code into your codebase — requires good prompt design. Success depends on thinking computationally and providing the right level of detail for the LLM to understand your goals. Or, as <a href="https://addyo.substack.com/p/personal-software-the-unbundling">Addy Osmani eloquently put it</a>:</p><blockquote><em>AI assistants represent the next step in this continual progression (towards abstraction). The key difference is that instead of learning a formal programming language, users are learning how to express computational intent through natural language with sufficient precision to generate working code.</em></blockquote><p>Today’s example highlights that the LLM needed clarification on what was meant by “loop.” This was done by working out an algorithmic description in another LLM session.</p><p>Working with large language models (LLMs) isn’t just about getting answers — it’s about knowing how to ask the right questions. The ability to think and express oneself computationally bridges the gap between AI’s capabilities and the user’s expectations regarding code generation. In today’s example, if I had taken the time to define the key terms — e.g., “loop” — in the prompt more completely, the additional step of working out the algorithm separately may not have been necessary.</p><h3>Links</h3><p>Some previous examples of using GPT 4 and Code Interpreter to process running data (GPS/GPX):</p><p><a href="https://medium.com/ai-advances/chatgpt-reveals-a-riverlands-endurance-run-2d4f9c512dd0">ChatGPT reveals a Riverlands Endurance Run | by Nate Combs | AI Advances</a></p><p><a href="https://ai.gopubby.com/chatgpt-and-the-middlesex-fells-trail-analyzer-a6c1118a25d3">ChatGPT and the Middlesex Fells Trail Analyzer | by Nate Combs | AI Advances</a></p><h3>What is Bad Science Fiction?</h3><p>This article is another AI story in the Bad Science Fiction series.</p><p>BSF, or Bad Science Fiction, describes a <a href="https://github.com/Nate-BadScienceFiction/Bad-Science-Fiction">collaborative software project on GitHub</a>. As explained in the AI Advances articles, the project is so named because its ostensible goal is to develop a story analysis tool specializing in science fiction — a tool to be developed in collaboration with Generative AI. However, it is as much an experiment on how best to leverage large language models (LLMs) to amplify software.</p><h3>Appendix</h3><p>Code used by GPT-4o to compute the tracks of 10 laps around the middle school.</p><pre>import xml.etree.ElementTree as ET<br>import numpy as np<br>from geopy.distance import geodesic<br><br># Re-load the GPX file<br>gpx_file_path = &quot;/mnt/data/Afternoon_Run.gpx&quot;<br>tree = ET.parse(gpx_file_path)<br>root = tree.getroot()<br><br># Define the GPX namespace<br>ns = {&#39;default&#39;: &#39;http://www.topografix.com/GPX/1/1&#39;}<br><br># Extract latitude and longitude points<br>latitudes = []<br>longitudes = []<br><br>for trkpt in root.findall(&quot;.//default:trkpt&quot;, ns):<br>    latitudes.append(float(trkpt.get(&quot;lat&quot;)))<br>    longitudes.append(float(trkpt.get(&quot;lon&quot;)))<br><br># Estimate the building center as the centroid of all GPS points<br>building_center_lat = np.mean(latitudes)<br>building_center_lon = np.mean(longitudes)<br><br># Compute angular positions using arctan2<br>angles = np.arctan2(np.array(latitudes) - building_center_lat, np.array(longitudes) - building_center_lon)<br><br># Unwrap the angles to avoid discontinuities<br>unwrapped_angles = np.unwrap(angles)<br><br># Compute the total angular change<br>total_angular_change = unwrapped_angles[-1] - unwrapped_angles[0]<br><br># Compute the number of laps<br>num_laps = abs(total_angular_change) / (2 * np.pi)<br><br>num_laps</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d024667738d8" width="1" height="1" alt=""><hr><p><a href="https://aiadvances.org/how-many-loops-did-i-run-gpt-4o-canvas-gps-data-and-asking-the-right-question-d024667738d8">How Many Loops Did I Run? GPT-4o/Canvas, GPS Data, and Asking the Right Question</a> was originally published in <a href="https://aiadvances.org/">AI Advances</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Does Good Software Engineering Improve the Performance of Large Language Models with Software Tasks?]]></title>
            <link>https://aiadvances.org/does-good-software-engineering-improve-the-performance-of-large-language-models-with-software-tasks-e31c0e3626a1?source=rss-4439046c7f6a------2</link>
            <guid isPermaLink="false">https://medium.com/p/e31c0e3626a1</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[openai]]></category>
            <dc:creator><![CDATA[Nate Combs]]></dc:creator>
            <pubDate>Sun, 23 Feb 2025 15:22:16 GMT</pubDate>
            <atom:updated>2025-02-23T15:22:16.580Z</atom:updated>
            <content:encoded><![CDATA[<h4>Thoughts about Chain-of-Thought LLMs and code.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/954/0*So1IvSooExNox7Bm.png" /><figcaption>Figure 1. Image provided by the author. The Bad Science Fiction application includes a C++ tool for ingesting science fiction text from a file or the Windows clipboard. The text is then analyzed on a Python server using a latent space distance algorithm. The JavaScript clients (lower right) serve as prototype browser-based user interfaces for visualization and data analysis.</figcaption></figure><h3>Overview</h3><p>In my previous life, I did a lot of data visualization prototyping. I often used thin clients — browser-based, web-service-driven approaches — to get answers fast. These provided a quick, cost-effective way to explore data, test algorithms, and refine functionality in a way that was closer to production software than stove-piped “apps-ware” like spreadsheets. The idea was simple: experiment, evaluate, and translate prototype software into production once a solution proved viable. Throw everything else away.</p><p>At Bad Science Fiction, we’re back to something familiar — experimenting with AI-assisted code development. Now, I collaborate with OpenAI’s generative AI models. The approach remains the same: test ideas, discard the bad, keep the good, and keep moving.</p><p>Over the past several months, one trend has become clear — structure matters. Clear, coherent, and modular thinking leads to better prompts and a more effective prompter.</p><p>This parallels rapid prototyping in software development. Furthermore, I believe that a large language model — or LLM — working with well-structured, well-engineered code can recognize patterns more effectively, extend functionality, and debug with greater accuracy.</p><p>In short, the better the initial engineering of the code, the better the AI’s ability to understand, refine, and improve it.</p><h3>What is Bad Science Fiction?</h3><p>BSF, or Bad Science Fiction, describes a <a href="https://github.com/Nate-BadScienceFiction/Bad-Science-Fiction">collaborative software project on GitHub</a>. As explained in the AI Advances articles, the project is so named because its ostensible goal is to develop a story analysis tool specializing in science fiction — a tool to be developed in collaboration with Generative AI. However, it is as much an experiment on how best to leverage large language models (LLMs) to amplify software.</p><h3>AI Consultants Benefit from Good Prompts</h3><p>Figure 1 illustrates the top-level BSF architecture. There are currently a handful of user interfaces (UIs), and their number is growing.</p><p>The BSF application allows users to select text from file or clipboard sources using the Sentiment Analysis Client (Figure 1). The text is analyzed on the Python server (Figure 1). The text elements are measured in <a href="https://en.wikipedia.org/wiki/Latent_space">latent space</a> and subsequently visualized and refined through browser-based user interfaces, as shown in the lower right of Figure 1.</p><p>The UI prototypes were developed using an agile, best-of-breed approach: integrate tight code review from the large language model, refine and keep the most effective solutions, discard those that are no longer useful, and rapidly develop new ones to meet new/emerging needs.</p><p>From my experience at Bad Science Fiction, I believe this kind of software development cycle is particularly well suited for AI collaboration of <em>personal software </em>— speaking to <a href="https://addyo.substack.com/p/personal-software-the-unbundling">a point made by Addy Osmani</a>:</p><blockquote><em>The real revolution in software development isn’t about AI replacing programmers — it’s about AI enabling a new category of software creation (personal software) that was previously impossible.</em></blockquote><p>Bad Science Fiction is fundamentally personal software, prioritizing speed and flexibility over production concerns like backward compatibility of software and architecture, large-scale performance, user edge cases, etc.</p><p>Minimally, a software experiment with AI consultants includes good prompt design, or as Osmani puts it:</p><blockquote>AI assistants represent the next step in this continual progression (towards abstraction). The key difference is that instead of learning a formal programming language, users are learning how to express computational intent through natural language with sufficient precision to generate working code.</blockquote><p>In a <a href="https://ai.gopubby.com/software-development-with-chatgpt-o1-preview-a-brain-spans-approach-99d6142d7193">previous article</a> involving prompt design, I expanded on <a href="https://semaphoreci.com/blog/storytelling-programming">Yehonathan Sharvit’s hypothesis</a> on cognitive spans, emphasizing the importance of tightly interwoven collaboration between you and an AI consultant. Effective collaboration requires respecting both the AI’s boundaries and the limits of your own cognition. If you first struggle to express something clearly, use techniques like reductionism or bootstrapping to refine your thinking.</p><p>Reducing a problem to its essentials enables the AI to work with precise, digestible inputs. Bootstrapping then helps you to gradually enhance that description, refining it into a more complete expression of your idea.</p><p>Here are a few guidelines:</p><ul><li>Break tasks into small, functional blocks in each prompt.</li><li>Avoid relying on private abstractions or custom jargon unless they are clearly defined. Leverage widely recognized abstractions the LLM is likely to understand from its training.</li><li>Iterate with the LLM to introduce descriptive names and the accuracy of comments in the code blocks you work with to improve clarity and shared understanding.</li></ul><p>As LLMs become more sophisticated, they can handle increasingly complex tasks. However, this sophistication places a greater burden on the human prompter to craft precise, structured inputs.</p><p>There are two reasons for this. First, as models have grown more sophisticated, they are tackling more complex problems, requiring the prompter to provide more precise and well-structured input. Second, <a href="https://en.wikipedia.org/wiki/Reasoning_language_model">Chain-of-Thought</a> (CoT) models are far less chat-oriented than their pre-CoT predecessors. If your prompt is unclear or missing key details, the model is less likely to ask clarifying questions or make it obvious that something is missing in its output.</p><p>At Bad Science Fiction, I currently use OpenAI’s CoT models — o1 and o3 — for software-related tasks due to their superior performance on structured problems. However, I continue to use the older 4o models for text-oriented tasks that benefit from a more conversational style. In essence, while CoT models excel in generating code from well-defined problems, they demand more rigorous prompt engineering.</p><p>Figure 2 is Ben Hylek’s graphic of a basic template for structuring an o1 CoT reasoning prompt. It comes from <a href="https://www.latent.space/p/o1-skill-issue">his brilliant article</a>, which presents a wealth of empirical insights on effectively working with o1 CoT models.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*HXis4FTKNVhJjkx7.png" /><figcaption>Figure 2. The Anatomy of an o1 prompt, from B. Hylak “o1 isn’t a chat model (and that’s the point) — How Ben Hylak turned from ol pro skeptic to fan by overcoming his skill issue,”</figcaption></figure><h3>For Software Tasks, Good Prompt Design Includes Well Engineered Code</h3><p>My experience at Bad Science Fiction aligns with Ben’s. However, when working with software, the “<em>Context Dump</em>” (Figure 2) benefits from additional detail — making it the capstone of this article. Much of the “Context Dump” in AI-based software development consists of actual code. At BSF, context dumps right now can easily exceed 2,000 lines.</p><p>I have worked extensively with my AI consultants using Chain-of-Thought agile development, and I’ve observed that a well-structured “Context Dump” leads to better model reasoning. Modular and well-engineered code enhances reasoning output when source code is included. These are my empirical observations, not results from controlled experiments.</p><p>In this circumstance, my sense of what well-engineered code means rhymes with Yehonathan Sharvit’s hypothesis. It consists of small, functional blocks, is well-documented, and avoids unnecessary complexity.</p><h3>The Bad Science Fiction JavaScript User Interface Prototypes</h3><p>This section provides insights based on the Bad Science Fiction JavaScript user interfaces (UIs) in Figure 1 (lower right).</p><p>The key to a JavaScript browser client and web-service UI ecosystem is a flexible, service-based backend that integrates well with the application’s toolset. Since BSF relies on various Python Machine Learning (ML) modules, adopting a Python <a href="https://en.wikipedia.org/wiki/REST">REST-style</a> framework like <a href="https://fastapi.tiangolo.com/">FastAPI</a> was a natural choice.</p><p>Figure 1 illustrates the current relationship between BSF UIs and the Python server. This post focuses on the JavaScript UIs (lower-right), which provide graph-based views and perform client-side, display-oriented data analysis.</p><p>Figure 3 (below) compares the current C++ client with fast-prototyped JavaScript UIs. The C++ client is a Windows application integrated with the Windows API, while the JavaScript clients run in a web browser.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*MH69_uihjU-B2uJv.png" /><figcaption>Figure 3. Image provided by the author. C++ Sentiment Analysis Client running in the Visual Studio IDE.</figcaption></figure><p>A key step in prototyping a web-based user interface for BSF is defining a Python REST-style service using FastAPI. Figure 3 shows an example of such a service endpoint. A browser call to the /visualize endpoint displays one of the BSF graphs (Figure 4).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1022/0*RqYDO-YbT9ZCkwp2.png" /><figcaption>Figure 4. Image provided by the author. An example of an REST endpoint on the Python server (e.g., <a href="http://localhost:8000/visualize).">http://localhost:8000/visualize)</a></figcaption></figure><p>To flesh out the endpoint service, consider the web service defined by the following directory layout (and contents):</p><pre>(directory:)<br>ª   BSF-AnchorServer.pyproj<br>ª   ReadAnchorServerConfig.py<br>ª   requirements.txt<br>ª   SentimentServer.py<br>ª   Visualize.py<br>ª                   <br>+---static (subdirectory)<br>ª       visualization.js<br>ª       visualization_tw.js<br>ª       <br>+---templates (subdirectory)<br>ª       visualize.html<br>ª       visualize_tw_similarities.html</pre><p>I recommend adopting a separation of concerns approach for organizing code, similar to the structure used in the web application above. In the Bad Science Fiction example, server-side Python scripts (e.g., <em>SentimentServer.py</em>) generate and manage dynamic content by storing HTML templates in the <em>templates</em> directory (e.g., <em>visualize.html</em> and <em>visualize_tw_similarities.html</em>). Meanwhile, the <em>static</em> directory contains JavaScript files (e.g., <em>visualization.js</em> and <em>visualization_tw.js</em>), which handle client-side interactivity.</p><p>This pattern follows good software engineering practices: the server (Python code) handles logic and HTML generation, while the client (JavaScript) manages dynamic interactions.</p><p>Structuring the code this way makes it easier to prompt my AI consultants effectively. Using a conventional web framework layout to separate server and client responsibilities and only providing the code relevant to a prompt improves the results returned from AI consultants when extending or interpreting my JavaScript code. I contrast this with examples I’ve evaluated where large language models were prompted using “all-in-one” bundles of JavaScript and HTML embedded within Python code.</p><p>Consider Figures 5 and 6.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*exY3a2cDcWEycaK8.png" /><figcaption>Figure 5. Image provided by the author. Example JavaScript visualization client. It displays distances of sentiment anchors from text windows in latent space.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qjGO7hBqx36sx3Fr.png" /><figcaption>Figure 6. Image provided by the author. Example JavaScript visualization client. Visualizes changes in latent space distance between consecutive text windows in a work of fiction.</figcaption></figure><p>Figure 5 represents a mature prototype UI that has proven useful over time and has undergone multiple rounds of improvement. In contrast, Figure 6 depicts a newly minted interface generated from an immature form—fully functional but awkward in layout and with rough edges.</p><p>The prompt that transformed an immature JavaScript implementation into the refined version in Figure 5 included nearly a thousand lines of previously developed code. The quality of that code played a role in achieving a strong result. The AI-generated output consisted of nearly 300 changed lines (primarily additions), requiring only one minor post-edit on my part.</p><p>Limiting the prompt to only the necessary code improves the AI consultant’s output quality. A modular functional layout and internal documentation also help. Through past experiments with varying code amounts and prompt configurations, I’ve found that structuring the request — by breaking tasks into subtasks and modularizing inputs (e.g., well-factored code) — generally leads to better results.</p><h3>Discussion</h3><p>This article suggests that well-engineered, modular code improves an LLM’s ability to generate, refine, and debug software. Drawing from the Bad Science Fiction (BSF) experience, I suggest that breaking problems into small, functional components and structuring prompts enhances efficiency for both humans and LLMs. As tasks grow more complex—especially in AI-assisted coding—clear structure helps prevent the model from misinterpreting ambiguity.</p><p>A key lesson from Bad Science Fiction is that LLM-based development requires a new level of “prompt literacy,” where code context, naming conventions, and comments serve as signals for model reasoning. <a href="https://addyo.substack.com/p/personal-software-the-unbundling">Addy Osmani states</a> that users are learning to express computational intent in natural language with enough precision to generate or modify working code.</p><p>Chain-of-Thought (CoT) models excel at structured problem-solving but depend on cues to activate their reasoning pathways. Unlike conversational chat models, they assume a higher level of clarity in input, requiring developers to present codebases and tasks more precisely than if they were incrementally presented.</p><p>The BSF experience highlights how AI-driven collaboration accelerates rapid prototyping. Developers can quickly refine their work by systematically discarding weak solutions and iterating on strong ones. This agile approach, well-established in traditional software development, translates naturally to LLM-assisted prototyping.</p><p>Finally, to caveat the Bad Science Fiction experience, it is limited to the “personal software” category <a href="https://addyo.substack.com/p/personal-software-the-unbundling">as defined by Addy Osmani</a>. Production software has additional considerations and qualifiers that are not included here.</p><h3>Final Thoughts</h3><p>A tactic I often use — outlined in this article — is reviewing new code with AI consultants. In other words, I work with the LLM to refactor, document, and review the logic of newly generated AI code, sometimes over multiple iterations. Well-structured and reviewed code isn’t just good engineering — it also improves prompting for the next stage of development.</p><p>For additional detail and a narrative on the progress of Bad Science Fiction, feel free to follow Substack posts cataloged at the <a href="https://github.com/Nate-BadScienceFiction/Bad-Science-Fiction">BSF GitHub</a>.</p><h3>References</h3><p>Y. Sharvit, “The Secret Art of Storytelling in Programming,” <em>Semaphore Blog</em>, Oct. 20, 2022. [Online]. Available: <a href="https://semaphoreci.com/blog/storytelling-programming">https://semaphoreci.com/blog/storytelling-programming</a>. [Accessed: Feb. 22, 2025].</p><p>A. Dyer, “Personal Software: The Unbundling,” <em>Substack</em>, Jan. 2023. [Online]. Available: <a href="https://addyo.substack.com/p/personal-software-the-unbundling">https://addyo.substack.com/p/personal-software-the-unbundling</a>. [Accessed: Feb. 22, 2025].</p><p>B. Hylak, “o1 isn’t a chat model (and that’s the point) — How Ben Hylak turned from ol pro skeptic to fan by overcoming his skill issue,” <em>Latent.Space</em>, Jan. 12, 2025. [Online]. Available: <a href="https://www.latent.space/p/o1-skill-issue">https://www.latent.space/p/o1-skill-issue</a>. [Accessed: Feb. 22, 2025].</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e31c0e3626a1" width="1" height="1" alt=""><hr><p><a href="https://aiadvances.org/does-good-software-engineering-improve-the-performance-of-large-language-models-with-software-tasks-e31c0e3626a1">Does Good Software Engineering Improve the Performance of Large Language Models with Software Tasks?</a> was originally published in <a href="https://aiadvances.org/">AI Advances</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Software Development with ChatGPT o1-preview: A Brain-Spans Approach]]></title>
            <link>https://aiadvances.org/software-development-with-chatgpt-o1-preview-a-brain-spans-approach-99d6142d7193?source=rss-4439046c7f6a------2</link>
            <guid isPermaLink="false">https://medium.com/p/99d6142d7193</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[chatgpt]]></category>
            <category><![CDATA[generative-ai-tools]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Nate Combs]]></dc:creator>
            <pubDate>Sun, 24 Nov 2024 21:40:38 GMT</pubDate>
            <atom:updated>2024-11-24T21:40:38.261Z</atom:updated>
            <content:encoded><![CDATA[<h4>Focusing on an efficient, exploratory interaction style by selectively refining responses and leveraging human-AI review</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1017/0*9qv8c-yBhr6mgJVF.png" /><figcaption>Figure 1. Image by the author. Sentiment anchor result graph.</figcaption></figure><h3>Overview</h3><p>This article continues an ongoing exploration of software development with ChatGPT. It illustrates how collaboration between humans and AI can refine and accelerate problem-solving. Today’s report emphasizes an iterative interaction style, blending exploration, selective refinement of responses, and peer-reviewing solutions. This approach considers Yehonathan Sharvit’s hypothesis on cognitive spans — memory, attention, and structure — critical to understanding and manipulating code. These “brain spans” serve as a lens for effective collaboration with generative AI, where explicit context management and clarity are essential.</p><p>This hybrid problem-solving approach, which balances human intuition with AI’s structured reasoning, respects the cognitive demands of programming and mirrors the art of storytelling — where the narrative flows between collaborators.</p><h3>The Collaborative Software Project</h3><p>A while back, I wrote about the importance of collaboration in software development with generative AI. In the overview, I explained that code generation exercises can…</p><blockquote><em>…illustrate the importance of human-AI collaboration, emphasizing the synergy achieved when human expertise enhances AI effectiveness. The model’s outputs can be better guided toward practical solutions by providing targeted knowledge and context. This collaborative dynamic showcases how human intuition and AI assistance can productively complement each other.</em></blockquote><p>Articles and links related to the progress of the “Bad Science Fiction” collaborative software project are at <a href="https://github.com/Nate-BadScienceFiction/Bad-Science-Fiction">this GitHub</a>. As explained in the <a href="https://ai.gopubby.com/code-generation-with-chatgpt-o1-preview-as-a-story-of-human-ai-collaboration-c80ecd9737ec">original article</a>, the project is so named because its goal is to develop a story analysis tool specializing in science fiction — a tool to be developed in collaboration with Generative AI.</p><p>This article is a roll-up-your-sleeves report— a chance to dive in and get work done. It also features an exploratory interaction style, where I selectively choose from responses. While doing so requires domain knowledge, it’s faster and more efficient. Paired design and programming have advantages, especially with an AI — it doesn’t matter if you jump in or out as needed to keep things moving efficiently.</p><h3>A New Windows GUI and Other Improvements</h3><p>My ongoing software collaboration with ChatGPT continues to be remarkably effective. As I’ve noted before, the key dynamic in our partnership is interaction: I ask many questions, cherry-pick the ideas that resonate, refine them, and repeat the process. This approach contrasts sharply with relying on a few large, detailed prompts.</p><p>The power of iterative problem-solving is showcased here. I started with an idea of what I wanted to implement, but whose execution took shape through refinement, feedback, and, yes, even false starts. In this collaboration, I use ChatGPT to help me flesh out an idea and then explore and refine an approach.</p><p>This time, I took on more of the implementation myself. The software and project have grown increasingly complex, making effective prompting more challenging as it requires more selective context. When the next task is straightforward, I often find it easier to roll up my sleeves and “just do it.” However, as is discussed later, asking the AI to peer-review significant choices is worthwhile.</p><p>The prompt below was my opening idea for what I wanted to do. It represented the big ask to ChatGPT. It was the starting point of our session. The rest of our time was spent drilling down, tweaking, and mapping the results into an implementation.</p><pre>Can you extend the following source code from a Visual Studio C++ Windows GUI application to display the following<br><br><br>1. A basic text editor.<br>2. A row of drop-down menus along the top of the display.<br>3. A drop-down menu labeled &quot;Get Text&quot;<br>4. A sub-menu option under &quot;Get Text&quot; called &quot;From Clipboard&quot;<br>5. A sub-menu option under &quot;Get Text&quot; called &quot;From File&quot;<br>6. A drop-down menu labeled &quot;Process&quot;<br>7. A sub-menu option under &quot;Process&quot; called &quot;Sentiment anchors&quot;<br><br>I would like the following behaviors to be implemented:<br><br>1. If the user selects the &quot;Get Text&quot; &gt; &quot;From Clipboard&quot; sub-menu <br>   then the client application will obtain the contents of the Windows<br>   clipboard and display it in its text display.<br>2. If the user selects the &quot;Get Text&quot; &gt; &quot;From File&quot; sub-menu then<br>   the client application will allow the user to browse the file system<br>   to select a text file for display in the application&#39;s text display.<br>3. If the user selects the &quot;Process&quot; &gt; &quot;Sentiment anchors&quot; sub-menu then<br>   the client application will process the text contents of the text<br>   display calling the sentiment_main()<br>   function from the SentimentAnchors.cpp and passing<br>   in the clipboard text or the file path.<br><br>(code removed)</pre><p>For code-related interactions described in this post, I used ChatGPT o1-preview across a few long-running sessions. For LaTeX interactions, I used ChatGPT 4o.</p><p>ChatGPT provided excellent coding assistance during our interaction but exhibited gaps in some details of my Microsoft Visual Studio Solution configuration.</p><p>Most of ChatGPT’s configuration missteps likely resulted from a conflict of goals. I initially asked it to convert my existing Visual Studio console application to a Windows GUI application. However, its instructions repeatedly assumed I would create a new Windows GUI project instead. Ultimately, I followed its advice and created the new project manually.</p><p>Once my new project was created, I asked ChatGPT to update its code based on the original prompt (above). Figure 2 lists the system’s software projects. The <strong>BSF-AnchorClient</strong> is the (now deprecated) Windows console application replaced by the new <strong>BSF-WindowsAnchorClient</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/299/0*AuGGzdlbMqY48UuB.png" /><figcaption>Figure 2. Image provided by the author.</figcaption></figure><p>ChatGPT’s code revisions built flawlessly within the Windows GUI / Visual Studio environment and required no corrections except for one loose end: a missing boilerplate header file. ChatGPT had modified one of my source files to import a header file that didn’t exist (see Figure 3).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/534/0*jr0o5RmDsYXDJeLp.png" /><figcaption>Figure 3. Image provided by the author. ChatGPT is prompted to remedy an oversight in generating a boiler-plate header file.</figcaption></figure><p>Before giving in to ChatGPT’s apparent preference that I start from a new MSVC++ Windows GUI project, I explicitly asked it for the steps to convert my existing MSVC++ console application into a C++ Windows GUI project. I followed its steps but ran into difficulty. After about 15 minutes of troubleshooting, I decided to stick with ChatGPT’s preference that I create the project anew manually.</p><p>I suspect ChatGPT favors approaches that it has encountered more examples of during training. While it can be guided toward alternative methods, these paths may carry greater risks due to fewer robust training examples.</p><p>The following are the key software features of the tool:</p><ul><li>Text Preprocessing: The Python Sentiment Server preprocesses text windows and sentiment anchors by removing stop words and tokenizing text to improve analysis accuracy.</li><li>OpenAI Embeddings: The server uses OpenAI embeddings to calculate semantic similarity between text windows and sentiment anchors, ensuring accurate sentiment assignments.</li><li>Outputs a graph — as an image over HTTP. It also outputs raw data as a CSV to a file.</li></ul><p>Figure 4 is the updated architecture diagram of the entire system. It was generated by ChatGPT o1 as LaTex — from the source code (Appendix) and the previous version of the architecture diagram. There are three major software components: a C++ client, a Python server, and a Python visualizer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/572/0*fcdH_9uWwqwwPIBd.png" /><figcaption>Figure 4. Image by the author. ChatGPT 4o generated the LaTeX code, <a href="http://www.overleaf/">www.overlea</a>f.com rendered it.</figcaption></figure><p>The updated Windows GUI client replaces the previous console version. It can retrieve input text data from the Windows clipboard and enables users to browse the file system for files using the Windows API. Figure 5 illustrates the Windows GUI client running within the Visual Studio IDE.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*mveFwzfMFKoFbIJ3.png" /><figcaption>Figure 5. Image by the author. The new Windows GUI client runs within the Visual Studio IDE. The displayed text is test data.</figcaption></figure><p>After creating the new Windows GUI client project and updating its code with ChatGPT’s updated sources (source code available in Appendix A), I tested the full application/system. During this testing, an issue arose:</p><pre>Temporary file path: C:\Users\natha\AppData\Local\Temp\temp_text.txt<br>Temporary file written.<br>Calling sentiment_main.<br>Exception thrown at 0x00007FFE8A32FA4C in BSF-WindowsAnchorClient.exe: Microsoft C++ exception: std::runtime_error at memory location 0x0000008F14D4DE28.<br>sentiment_main finished.<br>The thread 19168 has exited with code 0 (0x0).</pre><p>The output didn’t provide much information. I shared the error and the source code with ChatGPT and asked for ideas. It responded with a list of possibilities — a checklist of what it thought I should look at. The leading suggestion identified the actual cause: an internal data file couldn’t be read because its relative path was broken.</p><p>I confirmed the cause by asking ChatGPT to enhance the debug output:</p><pre>Can you update the following function so that it sign-posts its<br>progress to OutputDebugStringA?</pre><p>I was puzzled why a previously functioning relative pathing scheme suddenly broke. However, with ChatGPT’s improved debugging output, I quickly identified the root cause. The error resulted from a behavioral quirk in the new Windows GUI client. Whenever I used the menu drop-down to select an input file, it would change the application’s working directory location.</p><p>At that point, I planned to reimplement all relative pathing in my system using absolute paths. However, I asked ChatGPT to peer-review the problem to double-check my approach. It suggested a better solution based on deep insight into the Windows API. The prompt I used is shown below:</p><pre>Below is the C++ code for my Windows Anchor Client GUI.<br>A problem that I have is that when I run the client and use the<br>file selector (menu option), it can change the working directory<br>to the last directory location the file selector visited.<br>This can break the use of relative pathing to specify the<br>anchors file: &quot;./resources/sentiments.txt&quot;<br><br>I don&#39;t want to switch to absolute pathing. Idea on how to address this?<br><br>(code removed)</pre><p>Figure 6 describes ChatGPT’s solution, which involved adding an OFN_NOCHANGEDIR flag to a Windows API call.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/486/0*alfn-unTqx3vTRVJ.png" /><figcaption>Figure 6. Image by the author. ChatGPT o1-preview reviews a solution and improves upon it.</figcaption></figure><p>With further testing, I noticed inconsistent system performance — sometimes, the tool ran quickly, while other times, it took an unusually long time. I asked ChatGPT to upgrade the logging in the core server function, which it did seamlessly. This allowed me to identify the bottleneck: remote calls to OpenAI’s API. At times, these calls had minimal latency, but at other times, they were significantly slower. I asked ChatGPT to add logging to better document the issue and asked if it had any ideas.</p><pre>Can you update the following to include high-level sign-posting - <br>output its progress when called. Any suggestions on improving <br>its performance when the connection to OpenAI is slow?<br><br># Define the API endpoint for text analysis<br>@app.post(&quot;/analyze&quot;, response_model=AnalysisResult)<br>def analyze_text(data: AnalysisRequest):<br><br>(code removed)</pre><p>ChatGPT provided good advice. It suggested batching and caching embedding requests to OpenAI’s API — a strategy I recalled reading about when the API was first released but had forgotten about. I lept at this option. ChatGPT provided the code change:</p><pre># Step 6: Get embeddings for sentiment anchors and text windows<br>logging.info(&quot;Step 6: Obtaining embeddings for sentiment anchors and<br>text windows.&quot;)<br><br># Cache for embeddings<br>embedding_cache = {}<br><br># Combine anchors and windows for batch processing<br>texts_to_embed = preprocessed_anchors + preprocessed_windows<br>unique_texts = list(set(texts_to_embed))<br><br># Batch embed unique texts<br>text_embeddings = embeddings.embed_documents(unique_texts)<br>logging.info(f&quot;Obtained embeddings for {len(unique_texts)} unique texts.&quot;)<br><br># Map texts to embeddings<br>for text, embedding in zip(unique_texts, text_embeddings):<br>    embedding_cache[text] = embedding<br><br># Retrieve embeddings from cache<br>anchor_embeddings = [embedding_cache[text] for text in preprocessed_anchors]<br>window_embeddings = [embedding_cache[text] for text in preprocessed_windows]<br><br># Proceed with similarity calculations as before</pre><p>Adding batching and caching embedding calls to the OpenAI API resolved this problem.</p><p>The final major improvement to the tool was adding the ability to provide users with a browser-based visualization of its data. The Python server component was upgraded with an experimental HTTP endpoint (/visualize) that can be accessed in a browser. Figure 1 shows an example of the output. I’m exploring alternatives to the previous approach of generating CSV files and using a Python visualizer script. The prompt used is provided below. ChatGPT implemented a new REST endpoint that I could integrate without issue.</p><pre>Can you update the server with another endpoint.<br>I&#39;d like to be able to obtain an image depicting the results<br>(as a graph) after an analysis. Cache the results of an analysis<br>and when /visualize is called, return a graph of the last analysis results.<br>Provide an HTTP endpoint.</pre><h3>Discussion</h3><p>This ongoing collaboration with ChatGPT represents an evolving narrative in software development, where human intuition meets AI-driven problem-solving. Today’s update focuses on an iterative and exploratory interaction style — blending targeted exploration, selective refinement of responses, and peer-reviewing solutions to enhance outcomes.</p><p>I hear echoes of <a href="https://semaphoreci.com/blog/storytelling-programming">Yehonathan Sharvit’s hypothesis on cognitive spans </a>— memory, attention, and structure. Collaborating with an AI highlights how respecting these spans is essential for understanding and manipulating code. The interplay between human guidance and AI assistance requires explicit management of context, clear communication, and adaptability.</p><p>In this process, programming takes on a storytelling quality, as the seamless flow between collaborators mirrors the rhythm of a narrative. Consider Sharvit Yehonathan’s hypothesis:</p><blockquote>what makes code hard to read is that it doesn’t respect our brain spans.</blockquote><blockquote>Memory span.<br>Attention span.<br>Structure span.</blockquote><p>From these storied features flows Sharvit’s three basic guidelines:</p><blockquote>Keep your functions small.<br>Use a single level of abstraction.<br>Give descriptive names to your functions.</blockquote><p>For an AI spin, I would translate “read” with “<em>understand and manipulate</em>” and emphasize how a highly interleaved collaboration amplifies the need to respect the AI boundaries and the edges of your cognition. Paraphrasing Sharvit’s three basic guidelines for AI prompting-speak:</p><ul><li>Break tasks into small, functional blocks in each prompt.</li><li>Avoid relying on private abstractions or custom jargon unless they are clearly defined. Leverage widely recognized abstractions the LLM is likely to understand from its training.</li><li>Collaboratively iterate with the LLM to introduce descriptive names and the accuracy of comments in the code blocks you work with to improve clarity and shared understanding.</li></ul><p>Storytelling with a generative AI also seems to require active “listening.” If the model consistently gravitates toward specific solutions, it may not indicate a better approach but rather reflect its training—its exposure to those patterns in data. While it’s possible to steer AI toward less conventional methods, those paths may carry higher risks — and you should be prepared for them — due to fewer examples in its training to support them.</p><p>By balancing clear communication, thoughtful iteration, and awareness of AIs&#39; and our limitations, we can uncover new insights in this hybrid problem-solving process that merges human intuition with an LLM‘s expansive yet structured collaboration style.</p><p>For additional details, visit <a href="https://github.com/Nate-BadScienceFiction/Bad-Science-Fiction">this GitHub</a> for links to other posts and articles.</p><h4>References:</h4><p>Sharvit, Y. (2023, October 23). <em>Storytelling in programming: How to craft code with clarity and purpose</em>. Semaphore Blog. Retrieved November 23, 2024, from <a href="https://semaphoreci.com/blog/storytelling-programming">https://semaphoreci.com/blog/storytelling-programming</a></p><h3>Appendix A — Software</h3><p>Updated software:</p><ul><li>Windows GUI client — replacing the console version</li><li>The client can read text directly from the Windows clipboard or allow the user to select an input file by browsing the file system.</li><li>Upgraded Python server — serves graph images.</li></ul><p>The main components of the updated source code are available at this GitHub Gist:</p><p><a href="https://github.com/Nate-BadScienceFiction/Bad-Science-Fiction-Anchor-Tool/tree/new-windows-client">11/22/24 Code updates to https://github.com/Nate-BadScienceFiction/Bad-Science-Fiction-Anchor-Tool/tree/new-windows-client</a></p><ul><li>BSF-WindowsAnchorClient.cpp</li><li>SentimentAnchors.cpp</li><li>SentimentServer.py</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/895/0*Lv-I2tJacMCUutGc.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=99d6142d7193" width="1" height="1" alt=""><hr><p><a href="https://aiadvances.org/software-development-with-chatgpt-o1-preview-a-brain-spans-approach-99d6142d7193">Software Development with ChatGPT o1-preview: A Brain-Spans Approach</a> was originally published in <a href="https://aiadvances.org/">AI Advances</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Code Generation with ChatGPT o1-preview as a Story of Human-AI Collaboration]]></title>
            <link>https://aiadvances.org/code-generation-with-chatgpt-o1-preview-as-a-story-of-human-ai-collaboration-c80ecd9737ec?source=rss-4439046c7f6a------2</link>
            <guid isPermaLink="false">https://medium.com/p/c80ecd9737ec</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[cplusplus]]></category>
            <category><![CDATA[chatgpt]]></category>
            <dc:creator><![CDATA[Nate Combs]]></dc:creator>
            <pubDate>Sun, 13 Oct 2024 14:40:32 GMT</pubDate>
            <atom:updated>2024-10-13T14:40:49.584Z</atom:updated>
            <content:encoded><![CDATA[<h4>A C++ and Python case: comparison and insights.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*KVg3nxvlklMLE_vK.png" /><figcaption>Figure 1. Image provided by the author. The output of the Python sentiment analysis tool.</figcaption></figure><h4>Overview</h4><p>This article uses code generation experiments to illustrate the importance of human-AI collaboration, emphasizing the synergy achieved when human expertise enhances AI effectiveness. The model’s outputs can be better guided toward practical solutions by providing targeted knowledge and context. This collaborative dynamic showcases how human intuition and AI assistance can productively complement each other.</p><p>At the article&#39;s core are key insights derived from Python and C++ code generation experiments, reflecting how the integration of human expertise significantly improves AI-driven tasks.</p><h3>The Experiments</h3><p>I recently read <a href="https://arxiv.org/abs/1606.07772">Andrew Regan (et al.)’s 2016 paper</a> on a “sentiment analysis tool to extract the reader-perceived emotional content of written stories.” Coincidentally, I had just written a short story and was curious to test some of his algorithms using it as data. It was also an excellent opportunity to evaluate ChatGPT’s code generation ability, which has improved considerably. I regularly assess large language models to track their progress, and these experiments offered useful insights.</p><p>It is also a chance to share a few lessons learned. In a recent Substack post, I discussed how a collaborative, multi-prompt approach led to effective Python code for a simple sentiment analysis tool. Instead of asking ChatGPT to handle everything in a single prompt, it’s often more productive to iterate—reviewing its outputs step by step, providing feedback, and refining the response—rinse and repeat. You can find more details about that experiment in the link below.</p><p><a href="https://natecombs.substack.com/p/thoughts-about-chatgpt-o1-preview">Thoughts About ChatGPT o1-preview Code Generation (substack.com)</a></p><p>I recently conducted a similar experiment with C++, asking ChatGPT o1-preview to generate a sentiment analysis tool based on insights from my earlier Python experiment. This article offers an anecdotal comparison of both experiments and the insights gained.</p><p>While both experiments were successful, the details differed. The Python code generation process required no debugging and only minimal code cleanup, although I did need to guide its algorithm and API choices. In contrast, the C++ code generation process required much more involvement — not only in guiding the code generation but also in debugging and cleaning up the code afterward.</p><p>This difference is unsurprising—a vast amount of Python code is available for large language models to train on. Python code related to machine learning tasks also benefits from the availability of a large number of open-source modules. For example, ChatGPT often preferred using NLTK for text tokenization with Python and was proficient with LangChain for OpenAI API integration.</p><ul><li><a href="https://en.wikipedia.org/wiki/Natural_Language_Toolkit">Natural Language Toolkit (NLTK) — Wikipedia</a></li><li><a href="https://en.wikipedia.org/wiki/LangChain">LangChain — Wikipedia</a></li></ul><p>The C++ version generated by ChatGPT did not rely on an external tokenizer; instead, it implemented its own. However, ChatGPT used external C++ integration packages to interact with the OpenAI API. Ultimately, I guided ChatGPT toward a solution that was better suited for my evaluation. I asked it to adjust the application architecture to minimize the number of external C++ packages I needed to integrate.</p><p>In both cases, engaging in a step-by-step dialogue with the model allows for refining requirements, clarifying ambiguities, and incrementally improving the code.</p><p>The Discussion section will compare insights from the Python and C++ code generation experiments.</p><h3>Python Experiment</h3><p>Figure 1 illustrates the change in sentiment throughout my 11,000-word science fiction short story. According to the tool, the overall “mood” or emotional impact leans more “negative” than “positive.”</p><p>The negativity, positivity, and dramatic intensity levels were based on the semantic similarity of text windows to predefined “sentiment anchor” embeddings. The following sentiment anchors were used:</p><ul><li><em>‘dramatic’ : “I am feeling dramatic, excited and on an adrenaline rush.”</em></li><li><em>‘positive’: “I am feeling very happy and joyful today!”</em></li><li><em>‘neutral’: “The weather is average, and nothing special is happening.”</em></li><li><em>‘negative’: “I am feeling very sad and depressed today.”</em></li></ul><p>Sentiments or moods were calculated using a Python script generated by ChatGPT o1-preview (Appendix A). I did not need to debug the code. However, throughout the code generation process, ChatGPT and I iterated extensively on the algorithm and design (Appendix B).</p><p>Text similarity in both experiments was based on the <a href="https://en.wikipedia.org/wiki/Cosine_similarity">Cosine similarity</a> between text windows and sentiment anchors.</p><p>In the Python experiment, the tool that calculated these sentiments or moods was a Python script that ChatGPT (o1-preview) generated, as shown in Appendix A. Although I did not need to debug the code, ChatGPT and I iterated to refine the algorithm and code design, as detailed by the prompts in Appendix B.</p><h3>C++ Experiment</h3><p>Figure 2 illustrates the output of the C++ program. I didn’t ask it to graph the same details as in Figure 1, but it&#39;s the same result. A significant difference, however, is the application&#39;s architecture; it&#39;s not a single application or executable. A front-end C++ sentiment analysis piece talks to a separate Python process (using REST interaction).</p><ul><li><a href="https://en.wikipedia.org/wiki/REST">REST — Wikipedia</a> (Representational State Transfer)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TLejP3ElA5JIOSKaxHDoUQ.png" /><figcaption>Figure 2. Image provided by the author. The output of the C++ sentiment analysis tool.</figcaption></figure><p>I initially asked ChatGPT to generate the C++ code using a prompt that rolled up many conclusions from our earlier exchanges when we created the Python tool. Many of the elements included in the prompt are cataloged in Appendix B.</p><p>The initial prompt I gave ChatGPT to generate a C++ sentiments tool is below.</p><pre>Propose a sentiment analysis C++ program based on using OpenAI embeddings and a sliding text window applied over text documents.<br><br>For example, it may want to obtain the embeddings for the documents in the following manner:<br><br>    embeddings_model = OpenAIEmbeddings(openai_api_key=openai_api_key)<br>    texts = [doc.page_content for doc in documents]<br>    embeddings = embeddings_model.embed_documents(texts)<br><br><br>You should use the distance between the embeddings of the input text and predefined embeddings that represent key sentiments (e.g., positive, neutral, and negative). This approach leverages semantic similarity to classify sentiment based on how close the input text&#39;s embedding is to these predefined &quot;sentiment anchor&quot; embeddings.<br><br> <br>The building block algorithm steps are, per document:<br><br>Tokenize text in the document.<br>Create sliding windows.<br>Generate embeddings for each window using LLM.<br>Classify sentiment for each window.<br>Optional smoothing of sentiments across windows.<br>Visualize the sentiments as a graph representing the entire document.<br><br><br>Design Guidelines:<br><br>The program should be written in C++.<br>The program should call a REST Python service that uses Python modules to implement the tokenizer and to obtain the OpenAI embedding model.<br><br>Constraints:<br><br>Do not use libcurl.<br>Do not use Boost and Boost.Asio</pre><p>Note that the prompts in Appendix B do not include the last two sections, “Design Guidelines” and “Constraints.” These were new additions. I specifically asked ChatGPT to integrate the OpenAI API using a Python service connected to the C++ client via HTTP/REST, rather than attempting direct integration from the C++ client with libcurl or Boost.</p><p>In previous experiments, ChatGPT often generated C++ code using libcurl or Boost.Asio for HTTP(S) requests unless explicitly instructed otherwise. Setting up libcurl or Boost was more complex than using Python features and modules. For instance, libcurl requires its libraries to be built specifically for Windows. To simplify this experiment, I chose to have the C++ client rely on the OpenAI API through a Python service.</p><ul><li><a href="https://en.wikipedia.org/wiki/CURL#libcurl">cURL/ libcurl — Wikipedia</a></li><li><a href="https://en.wikipedia.org/wiki/Boost_(C%2B%2B_libraries)">Boost (C++ libraries) — Wikipedia</a></li></ul><p>Figure 3 describes the architecture that ChatGPT generated to implement the C++ sentiments analysis tool. The sentiments analysis program (client) communicated with a Python service for the large language model embeddings using HTTP/REST. The Python RESTful service communicated to OpenAI for the model embeddings using Python networking resources. The C++ client outputs its results to a CSV file. ChatGPT generated a Python script to visualize those results in a graphical format. ChatGPT offered to generate C++ <a href="https://en.wikipedia.org/wiki/Qt_(software)">visualization using Qt</a> (and likely other options if I pressed), but, again, to keep this experiment simple, I opted for the Python script.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/867/1*cgh-V_-SGOSiQyxZXVZcOw.png" /><figcaption>Figure 3. Image provided by the author. The C++ sentiment tool application architecture. It relies on a Python service (REST-styled) for embeddings.</figcaption></figure><p>The C++ client was built and executed using Microsoft Visual Studio Community 2022 Version 17.11.5. The Python service was run locally within the virtual environment of PyCharm 2024.1 (Community Edition).</p><ul><li><a href="https://en.wikipedia.org/wiki/Visual_Studio">Visual Studio — Wikipedia</a></li><li><a href="https://en.wikipedia.org/wiki/PyCharm">PyCharm — Wikipedia</a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VvwCcM07opaZRwrHbl5Aew.png" /><figcaption>Figure 4. Image provided by the author. To execute the C++ sentiment analysis tool, both the back-end Python service and the C++ client need to be run. Visual Studio and PyCharm IDEs were used.</figcaption></figure><p>As described, the ChatGPT-generated C++ code required “code engineering” before I could compile, link, and execute it. These were the main issues I encountered —</p><ul><li>Code incompatibilities with different versions of C++. The code in this experiment was compiled using ISO C++20 Standard.</li><li>Incompatibilities resulted from differences in template implementations and versions, the interplay of specific external modules I experimented with, the generated code I worked with, and the version of the C++ compiler in use.</li></ul><p>On a lighter note, ChatGPT o1-preview could be empathetic. Please note the following snippet from one of its responses!</p><blockquote><strong>I’m sorry to hear</strong> you’re still encountering the deprecation warning <br>related to stdext::checked_array_iterator&lt;char *&gt;.<br>…</blockquote><h4>Discussion</h4><p>The experiments demonstrate the importance of an iterative, multi-prompt approach when collaborating with AI for code generation. This approach allows for the refinement of algorithms, identification of ambiguities, and overall improvement of the generated code.</p><p>A key insight is that an interactive, iterative approach is more effective for generating usable code than relying on a single, detailed prompt. In the Python example, I guided ChatGPT through multiple iterative steps to produce an algorithm that met my specific needs. This step-by-step refinement allowed for better alignment between the code and my objectives.</p><p>Similarly, in the C++ example, iteration was essential for resolving code errors and integration issues. These findings suggest that ongoing interaction with the model, rather than expecting a complete solution from the start, leads to practical and functional code.</p><p>Another important insight is that the more you know upfront or figure out along the way — whether from experience or other sources — the faster you can refine your prompts to guide a large language model toward a good solution. In the Python sentiment tool example, my familiarity with the algorithms and APIs involved allowed me to help ChatGPT quickly converge on a clean and effective implementation.</p><p>In the C++ version, I could steer ChatGPT away from external modules that I found time-consuming to work with and propose an alternative, more suitable application architecture. ChatGPT leveraged my guidance and ultimately delivered a Python REST service to bridge the gap between C++ complexity and Python’s ease of API integration. This is a practical illustration of human-AI synergy. By steering the AI towards more efficient architectures, unnecessary complexities were avoided, leading to a simpler yet satisfactory solution.</p><h4>References</h4><p>Reagan, A.J., Mitchell, L., Kiley, D. <em>et al.</em> The emotional arcs of stories are dominated by six basic shapes. <em>EPJ Data Sci.</em> <strong>5</strong>, 31 (2016). <a href="https://doi.org/10.1140/epjds/s13688-016-0093-1">https://doi.org/10.1140/epjds/s13688-016-0093-1</a></p><h4>Appendix A</h4><p>Python code generated by ChatGPT for simple sentiment analysis.</p><pre><br><br><br>import os<br>import numpy as np<br>import matplotlib.pyplot as plt<br>from sklearn.metrics.pairwise import cosine_similarity<br>import nltk<br><br># Import necessary classes from langchain<br>from langchain.embeddings import OpenAIEmbeddings<br>from langchain.document_loaders import TextLoader<br>from langchain.text_splitter import NLTKTextSplitter<br><br># Download NLTK data files (only need to run once)<br>nltk.download(&#39;punkt&#39;)<br><br><br># Set up OpenAI API key<br>openai_api_key = &quot;&quot;<br><br># Specify the paths to your text files<br>file_paths = [<br>    &quot;./data/cyclops_storm.txt&quot;,<br>    &quot;./data/Wee-kh-sah_38.txt&quot;<br>]<br><br># Define the function to read and split the text files<br>def do_read_text_files(file_paths):<br>    documents = []<br>    for file_path in file_paths:<br>        loader = TextLoader(file_path, encoding=&#39;utf-8&#39;)<br>        raw_documents = loader.load()<br>        for document in raw_documents:<br>            content = document.page_content<br>            metadata = document.metadata<br>            print(f&#39;File: {file_path}, length of page_content={len(content)}&#39;)<br><br>        text_splitter = NLTKTextSplitter(chunk_size=1000, chunk_overlap=100)<br>        text_content = &quot; &quot;.join([doc.page_content for doc in raw_documents])<br>        text_sections = text_splitter.split_text(text_content)<br>        print(f&#39;File: {file_path}, number of text sections chunked={len(text_sections)}&#39;)<br><br>        documents.append({<br>            &#39;file_path&#39;: file_path,<br>            &#39;text_sections&#39;: text_sections<br>        })<br>    return documents<br><br># Define the function to generate embeddings<br>def generate_embeddings(texts, openai_api_key):<br>    embeddings_model = OpenAIEmbeddings(openai_api_key=openai_api_key)<br>    embeddings = embeddings_model.embed_documents(texts)<br>    return embeddings<br><br># Read and split the text files into sections<br>documents = do_read_text_files(file_paths)<br><br># Define the extended sentiment anchor texts and get their embeddings<br>sentiment_texts = {<br>    &#39;dramatic&#39;: &quot;I am feeling dramatic, excited and on an adrenaline rush.&quot;,<br>    # &#39;non-dramatic&#39;: &quot;I am feeling bored, lack-luster, without energy.&quot;,<br>    # &#39;cormac&#39;: &quot;In the style of Cormac McCarthy.&quot;,<br>    # &#39;margaret&#39;: &quot;In the style of Margaret Atwood.&quot;,<br>    # &#39;king&#39;: &quot;In the style of Stephen King.&quot;,<br>    &#39;positive&#39;: &quot;I am feeling very happy and joyful today!&quot;,<br>    # &#39;neutral&#39;: &quot;The weather is average, and nothing special is happening.&quot;,<br>    &#39;negative&#39;: &quot;I am feeling very sad and depressed today.&quot;<br>}<br><br># Generate embeddings for sentiment anchors<br>sentiment_embeddings = {}<br>for sentiment, text in sentiment_texts.items():<br>    embedding = generate_embeddings([text], openai_api_key)[0]<br>    sentiment_embeddings[sentiment] = embedding<br><br># Process each document individually<br>for doc in documents:<br>    file_path = doc[&#39;file_path&#39;]<br>    text_sections = doc[&#39;text_sections&#39;]<br><br>    # Generate embeddings for each text section<br>    window_embeddings = generate_embeddings(text_sections, openai_api_key)<br><br>    # Compute similarities for each sentiment for each text section<br>    similarity_scores = {sentiment: [] for sentiment in sentiment_embeddings.keys()}<br><br>    for embedding in window_embeddings:<br>        for sentiment, sentiment_embedding in sentiment_embeddings.items():<br>            similarity = cosine_similarity([embedding], [sentiment_embedding])[0][0]<br>            similarity_scores[sentiment].append(similarity)<br><br>    # Visualize the similarities as a graph representing the entire document<br>    plt.figure(figsize=(12, 6))<br>    for sentiment, scores in similarity_scores.items():<br>        plt.plot(scores, marker=&#39;o&#39;, linestyle=&#39;-&#39;, label=sentiment)<br>    plt.title(f&#39;Sentiment Similarity Over Document: {os.path.basename(file_path)}&#39;)<br>    plt.xlabel(&#39;Text Section Index&#39;)<br>    plt.ylabel(&#39;Cosine Similarity Score&#39;)<br>    plt.xticks(range(len(text_sections)))<br>    plt.legend()<br>    plt.grid(True)<br>    plt.show()</pre><h4>Appendix B</h4><p>This appendix lists the prompts I used to guide ChatGPT o1-preview in generating the sentiment analysis tool. It highlights the blend of high-level conceptual prompts and specific feedback regarding code, APIs, and algorithms.</p><pre>Propose a sentiment analysis algorithm based on LLM embeddings and sliding text windows.<br><br>===<br><br>Propose a simple sentiment classification layer implementation.<br><br>===<br><br>Instead of labeled sentiment data and a feed-forward classification layer, can you compute the distance of the embedding from embeddings for key sentiments?<br><br><br>====<br>Propose a sentiment analysis Python program based on using OpenAI embeddings and a sliding text window applied over text documents.<br><br>For example, it may want to obtain the embeddings for the documents in the following manner:<br><br>    embeddings_model = OpenAIEmbeddings(openai_api_key=openai_api_key)<br>    texts = [doc.page_content for doc in documents]<br>    embeddings = embeddings_model.embed_documents(texts)<br><br><br>You should use the distance between the embeddings of the input text and predefined embeddings that represent key sentiments (e.g., positive, neutral, and negative). This approach leverages semantic similarity to classify sentiment based on how close the input text&#39;s embedding is to these predefined &quot;sentiment anchor&quot; embeddings.<br><br> <br>The building block algorithm steps are, per document:<br><br>Tokenize text in the document.<br>Create sliding windows.<br>Generate embeddings for each window using LLM.<br>Classify sentiment for each window.<br>Optional smoothing of sentiments across windows.<br>Visualize the sentiments as a graph representing the entire document.<br><br>====<br><br>Can you update the code to use the openai 1.0.0 api, example below. def generate_embeddings(documents, openai_api_key):<br>    embeddings_model = OpenAIEmbeddings(openai_api_key=openai_api_key)<br>    texts = [doc.page_content for doc in documents]<br>    embeddings = embeddings_model.embed_documents(texts)<br><br>    for i, document in enumerate(documents):<br>        document.metadata[&#39;embedding&#39;] = embeddings[i]<br><br>    return documents<br> <br>====<br><br>Can you rework the code so it uses this text reader?  def do_read_text_file(file_path):<br>    loader = TextLoader(file_path, encoding=&#39;utf-8&#39;)<br>    raw_documents = loader.load()<br>    for document in raw_documents:<br>        content = document.page_content<br>        metadata = document.metadata<br>        print(f&#39;length of page_content={len(content)}&#39;)<br><br>    text_splitter = NLTKTextSplitter(chunk_size=1000, chunk_overlap=100)<br>    text_content = &quot; &quot;.join([doc.page_content for doc in raw_documents])<br>    text_sections = text_splitter.split_text(text_content)<br>    print(f&#39;number of text sections chunked={len(text_sections)}&#39;)<br>    return text_sections<br> <br>====<br><br>can you update this code to read and plot output for multiple documents (multiple file paths).<br><br>====<br><br>If I want to extend the sentiments to include more than the three currently in place include some that are overlapping, how might you display it?  Consider this example list. sentiment_texts = {<br>    &#39;dramatic&#39; : &quot;I am feeling dramatic, excited and on an adrenaline rush.&quot;,<br>    &#39;non-dramatic&#39; : &quot;I am feeling bored, lack-luster, without energy.&quot;,<br>    &#39;cormac&#39; : &quot;In the style of Cormac McCarthy&quot;,<br>    &#39;margaret&#39; : &quot;In the style of Margaret Atwood&quot;,<br>    &#39;king&#39; : &quot;In the style of Stephen King&quot;,<br>    &#39;positive&#39;: &quot;I am feeling very happy and joyful today!&quot;,<br>    &#39;neutral&#39;: &quot;The weather is average, and nothing special is happening.&quot;,<br>    &#39;negative&#39;: &quot;I am feeling very sad and depressed today.&quot;<br>}</pre><h4>Appendix C</h4><p>The C++ client code generated by ChatGPT for simple sentiment analysis. Unlike the Python script in Appendix A, the C++ client relies on a separate Python service for its embeddings (see Appendix D). See Figure 3 for the application architecture.</p><pre>// main.cpp<br><br><br>#include &lt;iostream&gt;<br>#include &lt;fstream&gt;<br>#include &lt;sstream&gt;<br>#include &lt;vector&gt;<br>#include &lt;string&gt;<br>#include &lt;algorithm&gt;<br>#include &lt;cmath&gt;<br>#include &lt;thread&gt;<br>#include &lt;mutex&gt;<br>#include &lt;httplib.h&gt;<br>#include &lt;nlohmann/json.hpp&gt;<br><br>using json = nlohmann::json;<br><br>// Function to read the entire text file into a string<br>std::string read_text_file(const std::string&amp; filename) {<br>    std::ifstream infile(filename);<br>    if (!infile.is_open()) {<br>        throw std::runtime_error(&quot;Cannot open the file: &quot; + filename);<br>    }<br>    std::stringstream buffer;<br>    buffer &lt;&lt; infile.rdbuf();<br>    return buffer.str();<br>}<br><br>// Function to split text into words (simple tokenizer)<br>std::vector&lt;std::string&gt; tokenize_text(const std::string&amp; text) {<br>    std::istringstream stream(text);<br>    std::vector&lt;std::string&gt; tokens;<br>    std::string word;<br>    while (stream &gt;&gt; word) {<br>        tokens.push_back(word);<br>    }<br>    return tokens;<br>}<br><br>// Function to create sliding windows from tokens<br>std::vector&lt;std::string&gt; create_sliding_windows(const std::vector&lt;std::string&gt;&amp; tokens, size_t window_size, size_t overlap) {<br>    std::vector&lt;std::string&gt; windows;<br>    size_t step = window_size - overlap;<br>    for (size_t i = 0; i &lt; tokens.size(); i += step) {<br>        size_t end = std::min(i + window_size, tokens.size());<br>        std::string window_text = &quot;&quot;;<br>        for (size_t j = i; j &lt; end; ++j) {<br>            window_text += tokens[j] + &quot; &quot;;<br>        }<br>        windows.push_back(window_text);<br>        if (end == tokens.size()) break;<br>    }<br>    return windows;<br>}<br><br>// Function to get embedding from RESTful service<br>std::vector&lt;float&gt; get_embedding(const std::string&amp; text) {<br>    httplib::Client cli(&quot;localhost&quot;, 8000); // Adjust host and port if needed<br>    json request_json = { {&quot;text&quot;, text} };<br>    auto res = cli.Post(&quot;/embed&quot;, request_json.dump(), &quot;application/json&quot;);<br><br>    if (res &amp;&amp; res-&gt;status == 200) {<br>        json response_json = json::parse(res-&gt;body);<br>        return response_json[&quot;embedding&quot;].get&lt;std::vector&lt;float&gt;&gt;();<br>    }<br>    else {<br>        // Handle error<br>        std::cerr &lt;&lt; &quot;HTTP Status: &quot; &lt;&lt; res-&gt;status &lt;&lt; &quot;\n&quot;;<br>        std::cerr &lt;&lt; &quot;Response Body: &quot; &lt;&lt; res-&gt;body &lt;&lt; &quot;\n&quot;;<br>        throw std::runtime_error(&quot;Failed to get embedding from REST service&quot;);<br>    }<br>}<br><br>// Function to compute cosine similarity<br>float cosine_similarity(const std::vector&lt;float&gt;&amp; A, const std::vector&lt;float&gt;&amp; B) {<br>    float dot_product = 0.0f;<br>    float norm_a = 0.0f;<br>    float norm_b = 0.0f;<br><br>    for (size_t i = 0; i &lt; A.size(); ++i) {<br>        dot_product += A[i] * B[i];<br>        norm_a += A[i] * A[i];<br>        norm_b += B[i] * B[i];<br>    }<br><br>    return dot_product / (std::sqrt(norm_a) * std::sqrt(norm_b) + 1e-8); // Add small value to prevent division by zero<br>}<br><br>// Function to assign sentiment based on similarity scores<br>std::string assign_sentiment(const std::vector&lt;float&gt;&amp; embedding,<br>    const std::vector&lt;float&gt;&amp; positive_anchor,<br>    const std::vector&lt;float&gt;&amp; neutral_anchor,<br>    const std::vector&lt;float&gt;&amp; negative_anchor) {<br>    float sim_positive = cosine_similarity(embedding, positive_anchor);<br>    float sim_neutral = cosine_similarity(embedding, neutral_anchor);<br>    float sim_negative = cosine_similarity(embedding, negative_anchor);<br><br>    if (sim_positive &gt;= sim_neutral &amp;&amp; sim_positive &gt;= sim_negative) {<br>        return &quot;Positive&quot;;<br>    }<br>    else if (sim_negative &gt;= sim_positive &amp;&amp; sim_negative &gt;= sim_neutral) {<br>        return &quot;Negative&quot;;<br>    }<br>    else {<br>        return &quot;Neutral&quot;;<br>    }<br>}<br><br>int sentiment_main() {<br>    try {<br>        // Step 1: Read the document<br>        std::string filename = &quot;C:/Users/natha/source/repos/data/Wee-kh-sah_38.txt&quot;; // Replace with your filename<br>        std::string text = read_text_file(filename);<br><br>        // Step 2: Tokenize text<br>        auto tokens = tokenize_text(text);<br><br>        // Step 3: Create sliding windows<br>        size_t window_size = 200; // Adjust window size<br>        size_t overlap = 50;      // Adjust overlap size<br>        auto windows = create_sliding_windows(tokens, window_size, overlap);<br><br>        // Step 4: Get embeddings for sentiment anchors<br>        std::vector&lt;float&gt; positive_anchor = get_embedding(&quot;I am happy&quot;);<br>        std::vector&lt;float&gt; neutral_anchor = get_embedding(&quot;It is a day&quot;);<br>        std::vector&lt;float&gt; negative_anchor = get_embedding(&quot;I am sad&quot;);<br><br>        // Mutex for thread-safe access to shared data<br>        std::mutex mtx;<br><br>        // Vectors to store results<br>        std::vector&lt;std::string&gt; sentiments(windows.size());<br>        std::vector&lt;float&gt; positions(windows.size());<br><br>        // Step 5: Process each window (with multithreading)<br>        std::vector&lt;std::thread&gt; threads;<br><br>        for (size_t idx = 0; idx &lt; windows.size(); ++idx) {<br>            threads.emplace_back([&amp;, idx]() {<br>                // Get embedding for the window<br>                auto embedding = get_embedding(windows[idx]);<br><br>                // Assign sentiment<br>                auto sentiment = assign_sentiment(embedding, positive_anchor, neutral_anchor, negative_anchor);<br><br>                // Store results<br>                std::lock_guard&lt;std::mutex&gt; lock(mtx);<br>                sentiments[idx] = sentiment;<br>                positions[idx] = static_cast&lt;float&gt;(idx);<br>                });<br>        }<br><br>        // Wait for all threads to complete<br>        for (auto&amp; t : threads) {<br>            t.join();<br>        }<br><br>        // Optional Smoothing (Simple Moving Average)<br>        /*<br>        // Uncomment to enable smoothing<br>        for (size_t i = 1; i &lt; sentiments.size() - 1; ++i) {<br>            if (sentiments[i - 1] == sentiments[i + 1]) {<br>                sentiments[i] = sentiments[i - 1];<br>            }<br>        }<br>        */<br><br>        // Step 6: Output results to CSV for visualization<br>        std::ofstream outfile(&quot;sentiment_results.csv&quot;);<br>        outfile &lt;&lt; &quot;Position,Sentiment\n&quot;;<br>        for (size_t i = 0; i &lt; sentiments.size(); ++i) {<br>            outfile &lt;&lt; positions[i] &lt;&lt; &quot;,&quot; &lt;&lt; sentiments[i] &lt;&lt; &quot;\n&quot;;<br>        }<br>        outfile.close();<br><br>        std::cout &lt;&lt; &quot;Sentiment analysis completed. Results saved to &#39;sentiment_results.csv&#39;.\n&quot;;<br><br>    }<br>    catch (const std::exception&amp; ex) {<br>        std::cerr &lt;&lt; &quot;Error: &quot; &lt;&lt; ex.what() &lt;&lt; &quot;\n&quot;;<br>    }<br>    return 0;<br>}</pre><h4>Appendix D</h4><p>The C++ client code (see Appendix C), generated by ChatGPT for simple sentiment analysis, relies on a Python service to provide the necessary embeddings. The Python service is given below. See Figure 3 for the application architecture.</p><p>Notably, this implementation is based on FastAPI rather than Flask. <a href="https://levelup.gitconnected.com/creating-rest-apis-using-fastapi-b511f31bc85a">This article</a> provides more information and contrasts these two frameworks.</p><pre># app.py<br># uvicorn sentiment_server:app --host 0.0.0.0 --port 8000<br><br>from fastapi import FastAPI, HTTPException<br>from pydantic import BaseModel<br>from langchain.embeddings import OpenAIEmbeddings<br>import os<br><br>app = FastAPI()<br><br># Set your OpenAI API key<br>openai_api_key = os.getenv(&quot;OPENAI_API_KEY&quot;)<br># Alternatively, you can set the API key directly<br>openai_api_key =  &quot;api-key&quot;<br><br><br># Initialize the embeddings model with specified model<br>try:<br>    embeddings_model = OpenAIEmbeddings(model=&quot;text-embedding-ada-002&quot;, openai_api_key=openai_api_key)<br>except Exception as e:<br>    print(f&quot;Error initializing OpenAIEmbeddings: {e}&quot;)<br>    raise<br><br>class TextData(BaseModel):<br>    text: str<br><br>@app.post(&quot;/embed&quot;)<br>async def embed_text(data: TextData):<br>    try:<br>        # Use embed_query for a single text input<br>        embedding = embeddings_model.embed_query(data.text)<br>        return {&quot;embedding&quot;: embedding}<br>    except Exception as e:<br>        print(f&quot;Exception occurred during embedding: {e}&quot;)<br>        raise HTTPEx</pre><h4>Appendix E</h4><p>The C++ client (see Appendix C), generated by ChatGPT for simple sentiment analysis, outputs a CSV file containing the story sentiments. The Python utility to visualize the CSV file is given below. See Figure 2 for its output. See Figure 3 for the application architecture.</p><pre># visualize.py<br><br>import pandas as pd<br>import matplotlib.pyplot as plt<br><br># Read the CSV file<br>df = pd.read_csv(&#39;sentiment_results.csv&#39;)<br><br># Map sentiments to numeric values for plotting<br>sentiment_map = {&#39;Positive&#39;: 1, &#39;Neutral&#39;: 0, &#39;Negative&#39;: -1}<br>df[&#39;SentimentScore&#39;] = df[&#39;Sentiment&#39;].map(sentiment_map)<br><br># Plot the sentiment scores<br>plt.figure(figsize=(12, 6))<br>plt.plot(df[&#39;Position&#39;], df[&#39;SentimentScore&#39;], marker=&#39;o&#39;)<br>plt.title(&#39;Sentiment Analysis Over Document&#39;)<br>plt.xlabel(&#39;Window Position&#39;)<br>plt.ylabel(&#39;Sentiment Score&#39;)<br>plt.yticks([-1, 0, 1], [&#39;Negative&#39;, &#39;Neutral&#39;, &#39;Positive&#39;])<br>plt.grid(True)<br>plt.show()</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c80ecd9737ec" width="1" height="1" alt=""><hr><p><a href="https://aiadvances.org/code-generation-with-chatgpt-o1-preview-as-a-story-of-human-ai-collaboration-c80ecd9737ec">Code Generation with ChatGPT o1-preview as a Story of Human-AI Collaboration</a> was originally published in <a href="https://aiadvances.org/">AI Advances</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Backing Up Google Authenticator]]></title>
            <link>https://levelup.gitconnected.com/backing-up-google-authenticator-8c4193a6f01c?source=rss-4439046c7f6a------2</link>
            <guid isPermaLink="false">https://medium.com/p/8c4193a6f01c</guid>
            <category><![CDATA[android-studio]]></category>
            <category><![CDATA[google-authenticator-app]]></category>
            <dc:creator><![CDATA[Nate Combs]]></dc:creator>
            <pubDate>Sun, 04 Aug 2024 17:27:58 GMT</pubDate>
            <atom:updated>2024-08-04T17:27:58.661Z</atom:updated>
            <content:encoded><![CDATA[<p>Using Android Studio for a Windows-based backup system</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XSH-PQXbZncYxEJzq8D1mg.png" /><figcaption>Photo supplied by the author. The author in emulation mode.</figcaption></figure><p>I frequently use Google Authenticator for multi-factor authentication (MFA). It is installed on my Android smartphone. The app is free and adds an extra layer of security by generating time-based one-time passwords (TOTP) that change every 30 seconds, making it difficult for attackers to reuse codes, even if they have your password. Since it works offline, no internet connection is needed to generate codes. Google Authenticator is compatible with many online services, easy to set up with QR code scanning, and is built on open standards. For more information on its technology and use cases, Wikipedia offers a good overview:</p><blockquote><a href="https://en.wikipedia.org/wiki/Multi-factor_authentication">https://en.wikipedia.org/wiki/Multi-factor_authentication</a></blockquote><blockquote><a href="https://en.wikipedia.org/wiki/Google_Authenticator">https://en.wikipedia.org/wiki/Google_Authenticator</a></blockquote><p>However, there is a problem.</p><p>What would I do if my phone became unusable or lost? How would I access accounts that require a one-time password from my authenticator app? While recovery options like backup codes and cloud syncing are available, I wanted a simple “hot-swap” solution — something that would allow me to quickly switch to using a Windows laptop for my authenticator if needed.</p><p>Although this seemed like it should be a straightforward setup, I ended up spending hours exploring solutions that didn’t pan out. If you search “How to back up Google Authenticator” online, you’ll find a lot of discussions that go in various directions. Many of these are outdated, incomplete, or involve components I wasn’t comfortable using.</p><p>I wanted a solution that would require no ongoing maintenance once set up. I didn’t want the hassle of managing additional accounts or dealing with cloud services. Plus, I wanted to avoid potential complications, such as relying on open-source or free software that might be insecure or not fully developed.</p><p>In the rest of this article, I’ll explain the solution that worked to my satisfaction. Here’s a quick summary:</p><p>I used Android Studio to create a virtual Android device and then installed Google Authenticator on it. After exporting the QR codes from Google Authenticator on my phone, I imported them into the virtual authenticator on the emulator. This setup gave me a backup authenticator on Windows that I could use in case my phone’s authenticator failed.</p><p>For more details about Android Studio, browse its website.</p><blockquote><a href="https://developer.android.com/studio">https://developer.android.com/studio</a></blockquote><p>The remainder of the article presents an overview of the key steps I followed to set up a backup Google Authenticator on a Windows 11 laptop. Instead of a detailed step-by-step guide, I’m sharing the major milestones and lessons learned. This approach is intended to enhance the shelf-life of this document and make it more adaptable to your needs.</p><p>The article assumes that your main Google Authenticator is on your phone, as it is for me. However, this doesn’t have to be the case — you can use any Android device capable of running Google Authenticator to generate your one-time passwords.</p><p>During my research, I spent a lot of time reconciling different tutorials with various software versions and configurations. The specifics may vary depending on your setup and experience, so I’ll leave you to fill in your details as needed. I’ll provide the roadmap, and you can customize it based on your own experience and research.</p><ul><li>Download and install Android Studio. I used the free Android Studio Koala release (version 2024.1.1).</li><li>Open Android Studio and <a href="https://developer.android.com/studio/run/managing-avds">create an Android Virtual Device</a> (AVD). You can do this without creating a project, but in my case, I ended up creating a basic project as a placeholder. I used the default Pixel Fold 3.5 device provided by Android Studio. Once everything is set up, you should see something like this:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/860/1*Ju-H-L2Y-FbfaT502q0GrA.png" /><figcaption>Figure 1. Screen-capture by the author of the Device Manager panel in Android Studio.</figcaption></figure><ul><li>Customize your virtual device to support Google Authenticator. To do this, click the three-dot icon next to the Play button and select the “<strong>Edit” </strong>submenu (as shown in Figure 1). In the Edit pop-up window (Figure 2), click<strong> “Show Advanced Settings</strong>.” Update the camera settings by selecting your host computer’s webcam for both the Front and Back cameras, as shown with the “Webcam0” setting in Figure 2. This will allow the emulated Google Authenticator to use your computer’s webcam to scan the QR code from your phone’s Google Authenticator app.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*v4MX-yI9wNd7ugshbLiy0g.png" /><figcaption>Figure 2. Screen-capture by the author of the AVD Edit panel.</figcaption></figure><ul><li>Next, launch the virtual device. From within the Device Manager, select the play button (e.g., see Figure 1). Once the emulated device starts, you should see something like Figure 3 (except the Google Authenticator app will not have been installed — see the next step):</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/819/1*n6uvX8fy4KZ4FZRinWdlxQ.png" /><figcaption>Figure 3. Screen-capture by the author of Android Studio running the virtual device.</figcaption></figure><ul><li>Once your virtual device is up and running (as shown in Figure 3), open the Play Store and search for the Google Authenticator app. Install the app, and if prompted, log into your Google Account directly within the emulator interface. Follow the necessary steps, and once completed, you should see Google Authenticator installed on your virtual device.</li><li>Open Google Authenticator on your virtual device. Within the app, navigate to the “<strong>Import Accounts</strong>” option, usually found under “<strong>Transfer accounts</strong>.” This will activate your host computer’s webcam to scan a QR code containing your account information.</li><li>On your phone’s Google Authenticator (the one you want to back up), select the “<strong>Export Accounts</strong>” option under “<strong>Transfer accounts</strong>” to generate a QR code. Display this QR code on your phone, and use your computer’s webcam to scan it. The accounts should then be imported into the Google Authenticator on your virtual device. You should see your accounts appear in the virtual authenticator, similar to what is shown in the example.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/806/1*lhMmbPnuB39rSZAB4w_iMQ.png" /><figcaption>Figure 4. Screen-capture by the author of Google Authenticator on the virtual device after it has imported account information from QR codes.</figcaption></figure><h4>Pro Tips</h4><ul><li>Ensure your backup authenticator is in sync with your phone authenticator by verifying that the TOTP codes match. If the virtual device isn’t generating synchronized codes, you may need to restart the emulator and relaunch the virtual device so that it can align with network time.</li><li>If you stop the emulator, close the Device Manager, and exit Android Studio, your virtual device’s state will be preserved when you restart it. You can return to the emulated Google Authenticator, and it should work as before. If you want to reset the device, you can choose the “<strong>Wipe Data</strong>” option and start the setup process again.</li><li>When launching the virtual device, you can select “<strong>View Mode</strong>” as a separate window instead of a pinned panel. This viewing method is particularly useful if you plan to interact with the Extended Controls.</li></ul><h4>Discussion</h4><p>This article outlines a method for running Google Authenticator on a Windows platform as a backup. I’ve documented the key considerations, but if you’re not already familiar with Google Authenticator and Android Studio, you may need to supplement these steps with additional online research to fill in any missing details. I’ve omitted some specifics to keep this guide concise and maintain its relevance over time.</p><p>If you find ways to streamline or improve this approach, please share your insights in the comments.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8c4193a6f01c" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/backing-up-google-authenticator-8c4193a6f01c">Backing Up Google Authenticator</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ChatGPT reveals a Riverlands Endurance Run]]></title>
            <link>https://aiadvances.org/chatgpt-reveals-a-riverlands-endurance-run-2d4f9c512dd0?source=rss-4439046c7f6a------2</link>
            <guid isPermaLink="false">https://medium.com/p/2d4f9c512dd0</guid>
            <category><![CDATA[running]]></category>
            <category><![CDATA[chatgpt-prompt]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[chatgpt]]></category>
            <category><![CDATA[chatgpt4]]></category>
            <dc:creator><![CDATA[Nate Combs]]></dc:creator>
            <pubDate>Tue, 14 May 2024 17:40:55 GMT</pubDate>
            <atom:updated>2024-05-14T17:40:55.068Z</atom:updated>
            <content:encoded><![CDATA[<p>Slicing and dicing trail race data</p><p>This last weekend, I ran the <a href="https://www.riverlands100.com/">Riverlands trail race</a> and received a wonderful map — depicted in Figure 1. I am a map aficionado; I was impressed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_19pp7LK3qierkYW.jpeg" /><figcaption>Figure 1. Author’s photograph of the Riverlands map given out at this year’s race.</figcaption></figure><p>I ran about 60 miles of the course this year and recorded my progress using GPS. I obtained the recorded transcript in GPX format from <a href="https://www.strava.com/">Strava</a>. With maps on my mind and the race fresh in my imagination, I asked ChatGPT to “slice and dice” various graphs about my weekend in the wilds of Maine. The most interesting pair of plots is discussed below.</p><p>I used <a href="https://openai.com/index/gpt-4o-and-more-tools-to-chatgpt-free/">ChatGPT-4o</a> with the Code Interpreter for this write-up.</p><p>To start, I prompted ChatGPT-4o with my GPX data and a request, described in Figure 2. The ask was for three plots:</p><ol><li>A “map visualization” plot</li><li>A timeline with latitude alignment</li><li>A timeline with longitude alignment</li></ol><p>The prompt also includes a coding tip — the explanation for its role is detailed in Appendix 1.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/858/0*hzoUdbo2KvQ2wa1W.png" /><figcaption>Figure 2. Screen capture by the author. Prompting ChatGPT-4o to generate three plots of the GPX data.</figcaption></figure><p>The code that ChatGPT generated for the plots in Figure 3 is provided below. This Python script was run in the ChatGPT Code Interpreter to produce the plots.</p><pre>import pandas as pd<br>import matplotlib.pyplot as plt<br>import matplotlib.dates as mdates<br>import matplotlib.colors as mcolors<br>import gpxpy<br>from datetime import datetime<br>import numpy as np<br><br># Parse the GPX file<br>gpx_file_path = &#39;/mnt/data/Riverlands_100_2024.gpx&#39;<br>with open(gpx_file_path, &#39;r&#39;) as file:<br>    gpx = gpxpy.parse(file)<br><br># Extract track points<br>data = []<br>for track in gpx.tracks:<br>    for segment in track.segments:<br>        for point in segment.points:<br>            data.append([point.time, point.latitude, point.longitude, point.elevation])<br><br># Create a DataFrame<br>df = pd.DataFrame(data, columns=[&#39;time&#39;, &#39;latitude&#39;, &#39;longitude&#39;, &#39;elevation&#39;])<br><br># Calculate elapsed time in seconds<br>df[&#39;elapsed_time&#39;] = (df[&#39;time&#39;] - df[&#39;time&#39;].iloc[0]).dt.total_seconds()<br><br># Calculate distances between points<br>df[&#39;distance&#39;] = np.sqrt((df[&#39;latitude&#39;].diff()**2) + (df[&#39;longitude&#39;].diff()**2)) * 111000  # approximate conversion for latitude/longitude to meters<br>df[&#39;distance&#39;].fillna(0, inplace=True)<br><br># Calculate pace in MPH<br>df[&#39;time_diff&#39;] = df[&#39;elapsed_time&#39;].diff().fillna(0)<br>df[&#39;pace_mph&#39;] = (df[&#39;distance&#39;] / df[&#39;time_diff&#39;]) * 2.23694  # meters per second to miles per hour<br><br># Normalize pace for color mapping (clip values at 6 MPH)<br>df[&#39;pace_mph_clipped&#39;] = df[&#39;pace_mph&#39;].clip(0, 6)<br><br># Define color maps<br>time_cmap = plt.get_cmap(&#39;viridis&#39;)<br>pace_cmap = plt.get_cmap(&#39;coolwarm&#39;)<br><br># Create color arrays for elapsed time and pace<br>time_norm = mcolors.Normalize(vmin=df[&#39;elapsed_time&#39;].min(), vmax=df[&#39;elapsed_time&#39;].max())<br>pace_norm = mcolors.Normalize(vmin=0, vmax=6)<br><br>time_colors = time_cmap(time_norm(df[&#39;elapsed_time&#39;]))<br>pace_colors = pace_cmap(pace_norm(df[&#39;pace_mph_clipped&#39;]))<br><br># Plot the map visualization with elapsed time<br>fig, ax = plt.subplots(3, 1, figsize=(15, 15))<br><br># Map visualization<br>ax[0].scatter(df[&#39;longitude&#39;], df[&#39;latitude&#39;], c=time_colors, s=10, label=&#39;Track Points&#39;)<br>ax[0].set_title(&#39;Map Visualization (Elapsed Time)&#39;)<br>ax[0].set_xlabel(&#39;Longitude&#39;)<br>ax[0].set_ylabel(&#39;Latitude&#39;)<br><br># Time Progression with Latitude Alignment<br>scatter_lat = ax[1].scatter(df[&#39;elapsed_time&#39;], df[&#39;latitude&#39;], c=pace_colors, s=10, label=&#39;Track Points&#39;)<br>ax[1].set_title(&#39;Time Progression with Latitude Alignment&#39;)<br>ax[1].set_xlabel(&#39;Elapsed Time (s)&#39;)<br>ax[1].set_ylabel(&#39;Latitude&#39;)<br>fig.colorbar(scatter_lat, ax=ax[1], orientation=&#39;vertical&#39;, label=&#39;Pace (MPH)&#39;)<br><br># Time Progression with Longitude Alignment<br>scatter_lon = ax[2].scatter(df[&#39;elapsed_time&#39;], df[&#39;longitude&#39;], c=pace_colors, s=10, label=&#39;Track Points&#39;)<br>ax[2].set_title(&#39;Time Progression with Longitude Alignment&#39;)<br>ax[2].set_xlabel(&#39;Elapsed Time (s)&#39;)<br>ax[2].set_ylabel(&#39;Longitude&#39;)<br>fig.colorbar(scatter_lon, ax=ax[2], orientation=&#39;vertical&#39;, label=&#39;Pace (MPH)&#39;)<br><br>plt.tight_layout()<br>plt.show()</pre><p>Note that the above code used by ChatGPT does not attempt to smooth out the GPS jitter in its pace calculation; that is a different exercise. The impact is that the pace data that follows should be interpreted at a high level.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*HrB1Plb_fDPYj13f" /><figcaption>Figure 3. Screen capture by the author. Plots generated by ChatGPT in response to the prompt in Figure 2. The Latitude and Longitude alignment timelines are color coded by pace — red is faster, blue is slower. The right-hand side color bars are inaccurate — should be 0–6 mph.</figcaption></figure><h4>Discussion</h4><p>As always, one needs to be cautious when reading ChatGPT results. Often the details can contain errors and will vary between sessions. For example, in the session depicted here, the color-bars are mislabeled. Nonetheless, if you are cautious and cross-compare results across multiple sessions (and improve prompting etc. along the way) you can obtain real insights.</p><p>I found the plots of Figure 3 subtle and surprisingly informative.</p><p>The first plot in Figure 3 (Map Visualization) effectively communicates how my race ended. It visualizes my route in the Androscoggin Riverlands State Park in Turner, ME. The plotted route is constructed from data covering two and a half loops (out and back) — along the course. On the third loop, I turned around about halfway and returned to the “Middle Earth Aid Station” (consult the map for its geographic location — Figure 1), where the recording was turned off. Figure 5 captures this dynamic. See Figure 4.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/591/0*_ki8ABkXsuuBM3f9.png" /><figcaption>Figure 4. The author highlights the turn-around and the endpoint at the Middle Earth aid station (circle).</figcaption></figure><p>The bottom pair of plots in Figure 3 (Latitude Alignment and Longitude Alignment timelines) efficiently communicates how the pace dropped off in the last third of the race — indicated by the increased number of blue color-coded segments. The internal structure of the plot is informative. I can correlate the blue segments back to locations on the map (Figure 1) or in Strava (Figure 6).</p><p>For example, Figure 5 highlights where I stopped for over an hour (upset stomach issue) at the Start/Finish. Consult the map in Figure 1 for the geographic location of “Start/Finish.” The other blue-dominated segments correspond to locations and times that I recall where I had stopped. I can compare those segments back to locations in Strava, for example — see Figure 6 or back to the map — Figure 1, or the Map Visualization in Figure 3.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/482/0*7EmFO81dbwqcvWLK.png" /><figcaption>Figure 5. Screen capture by the author. Plots with highlight showing where the author stopped for over an hour at the Start/Finish during the race.</figcaption></figure><p>The Latitude and Longitude plots provide different views of the same timeline. The depicted pace information correlates between the two — the reds and blues align along the timeline. However, there are differences in “emphasis.” For example, the Longitude Alignment plot depicts the red and blue segments (faster and slower paces) in greater detail. This makes sense; overall, the route covers more distance in the longitude than in the latitude (imagine the route projected onto these axes). However, this is not true for all locations. Thus, between these two perspectives, one can obtain a more complete sense of the structure of my travels over a twisting and winding trail.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/793/0*ooUf7gsuC2Xxgt2i.png" /><figcaption>Figure 6. Screen capture by the author. The Strava display of the route.</figcaption></figure><p>As intimated earlier, the pace information calculated by ChatGPT is likely inaccurate in detail, however, I believe in the abstract it is useful. For example, there is probably more red in the plots (Figure 3 and 5) than there should be, yet it is accurate to say that I was moving much faster in the first half of the race than in the second.</p><p>Overall, playing with your race data in ChatGPT is a stimulating exercise that can reveal insight. It is a great way of “what if’ing” your race-day experience. However, you should interpret what ChatGPT is telling you with caution.</p><h4>References</h4><p>Transcripts of the author’s exchange with ChatGPT that were used here can be found at these links (note, however, ChatGPT currently does not share graphical data generated by the Code Interpreter):</p><ul><li><a href="https://chat.openai.com/share/4dbe0bbf-32a5-4c42-b575-6cc1af9b3b56">https://chat.openai.com/share/4dbe0bbf-32a5-4c42-b575-6cc1af9b3b56</a></li><li><a href="https://chat.openai.com/share/5c46f087-cb07-4dae-b5c0-3ad300b26875">https://chat.openai.com/share/5c46f087-cb07-4dae-b5c0-3ad300b26875</a></li><li>ChatGPT-4o — <a href="https://openai.com/index/gpt-4o-and-more-tools-to-chatgpt-free/">https://openai.com/index/gpt-4o-and-more-tools-to-chatgpt-free/</a></li><li>Strava — <a href="https://www.strava.com/">https://www.strava.com/</a></li><li>Riverlands 100 and Relay — <a href="https://www.riverlands100.com/">https://www.riverlands100.com/</a></li></ul><h4>Appendix 1 — The use of coding hints in the prompt</h4><p>Adding coding tips to the prompt is akin to including coding hints and code examples in the ‘training manual’ for the <a href="https://medium.com/p/a6c1118a25d3">Middlesex Fells Trail Analyzer Custom ChatGPT</a>.</p><p>They guide ChatGPT’s Python code choices. In this case, without the hint to do otherwise, ChatGPT was more likely to generate code that relies on the gpxpy module — resulting in an error when it attempted to run the script in its Code Interpreter.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/586/0*8QQOjIpgaUAPrjkC.png" /><figcaption>Figure 7. Screen capture by the author. ChatGPT’s Code Interpreter erroring from a missing gpxpy module.</figcaption></figure><p>While ChatGPT will often be able to repair its code using an alternative approach (based on parsing the XML directly), this slows down the response. In rare cases if the delay is significant, it may end the session.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*1Qsr-46CxTa2ZrE9pSiiKw.jpeg" /><figcaption>Photo by the author. A view along the Riverlands race course.</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2d4f9c512dd0" width="1" height="1" alt=""><hr><p><a href="https://aiadvances.org/chatgpt-reveals-a-riverlands-endurance-run-2d4f9c512dd0">ChatGPT reveals a Riverlands Endurance Run</a> was originally published in <a href="https://aiadvances.org/">AI Advances</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>