<?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[Digital Mind - Medium]]></title>
        <description><![CDATA[Connecting the latest in AI with essential foundations. We explore trends like language &amp; vision models, plus timeless data science &amp; ML. - Medium]]></description>
        <link>https://medium.com/digital-mind?source=rss----bd34064f0c7e---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Digital Mind - Medium</title>
            <link>https://medium.com/digital-mind?source=rss----bd34064f0c7e---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 00:44:07 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/digital-mind" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Development plans as a skill for Claude Code]]></title>
            <link>https://medium.com/digital-mind/making-better-development-plans-into-a-skill-for-claude-code-093db647b404?source=rss----bd34064f0c7e---4</link>
            <guid isPermaLink="false">https://medium.com/p/093db647b404</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[claude-code]]></category>
            <category><![CDATA[ai-agent]]></category>
            <dc:creator><![CDATA[Erik Taylor]]></dc:creator>
            <pubDate>Wed, 24 Jun 2026 04:20:42 GMT</pubDate>
            <atom:updated>2026-07-21T19:36:59.668Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Skills give Claude repeatable behavior. Here’s how I turned my planning format into one — what it took to keep it lean, and what it beats Plan Mode at.</em></p><p>Skills are structured tools Claude can reach for. These make behavior repeatable, but a skill is only worth creation if you want the same structure every time. Otherwise you’re introducing bias — a machine-learning term for making strong assumptions before you’ve seen any data.</p><p>I plan a particular way. I generate ideas, then score and rank. From this priority ranking, I fold in interdependencies, look at risky touch points, and then deploy my code generation plan. This sounds simple enough, but I find myself repeating the same pattern. Ideas → Scoring →Ranking → Risk → Next steps. Sometimes I add in glyphs (✅ and ⏸️), other times dependency charts, sometimes the score is more complex, but these basic elements stay the same.</p><p>Now I have been hand-rolling this format, most recently alongside Claude Code’s Plan Mode. But, I’ve noticed a few limitations:</p><ol><li><strong>Plan mode is “ephemeral”. </strong>Stop, make a plan, then implement everything; the plan doesn’t persist.</li><li><strong>Plans are non-uniform</strong>. Claude will introduce new formatting, charts, glyphs, and organization at will.</li></ol><p>So while I tend prefer a familiar pattern, Claude does not. I spend a real chunk of time rearranging the plan and adding back the essential elements. That’s why I turned my planning format, which I call /dev-plan, into a skill for Claude Code.</p><p>While this article is about my preferred format as a skill, this is a worked example of building a Claude skill. So if you don’t care about planning, or dislike my formatting, read it for how a skill comes together, then build your own.</p><p><strong>To install a skill in the Claude Code:</strong> Briefly in CLI mode, a skill is a named folder under ~/.claude/skills/ — such as ~/.claude/skills/dev-plan/ — holding a SKILL.md plus any references/ it points to. The SKILL.md stays short and helps Claude decide which references to pull in. Then start up claude from your terminal. <strong>For the web or app</strong> — package the dev-plan/ skill directory into a .zip, then find Customize, Skills, +, Create skill, and upload the zip file.</p><p><strong>Read the full skill </strong><strong>/dev-plan on </strong><a href="https://github.com/eriktaylor/dev-plan"><strong>GitHub</strong></a><strong>.</strong></p><h4>The problem with hand-applying a format</h4><p>Hand-applying a good format gets you about 80% of the structure with 100% of the discipline burden on you, and the format rapidly diverges. I’ve watched it happen in my own plans: redundant views you need to track, terminology that splits, a new status legend that grows by improvisation, and real decisions that sink into prose where you can’t can find them again.</p><p><strong>The skill and the practice co-evolve: </strong>you’re coding a particular way, Claude diverges, you roll your fixes by hand, and you start to see what genuinely useful patterns emerge. Let the skill prevent the entropy from creeping back in. The structure of dev-plan/ came from fighting that loop.</p><h4>Other skills, related work</h4><p>Before I dive into my own design decisions, here are the neighboring approaches.</p><p><strong>Plan Mode (/plan) </strong>is ephemeral, per-session analysis of one-to-few task implementation — read the codebase, propose next steps, gate execution for review. <strong>Best for:</strong> exploring a single big change or staying open-ended.</p><p>There’s also a family of <strong>community planning tools</strong> that store each work item as a structured record — YAML-frontmatter to-dos with status fields and dependency lists — so an engine can auto-execute the next unblocked task. <strong>Best for:</strong> determinism and automation.</p><p>My dev-plan/ skill is the durable, scored, status-tracked, version-controlled artifact that survives across sessions and resists sprawl. <strong>Best for:</strong> plan-as-document — cheap per turn, terminal-readable, and human-in-the-loop.</p><h4>The skill, and the decisions behind it</h4><p>This skill routes on one decision — simple or complex. <strong>A simple plan </strong>is a short or mostly-sequential change. Low uncertainty, few or no parallel tracks. It includes a goal, status glyphs (Figure 1), a sequence of proposed items, and an observable completion target.</p><p>To track status, both plans use glyph vocabulary:</p><pre>✅  complete<br>🔄  in-progress<br>💡  proposed (recommended next)<br>⏸️  deferred (with re-open trigger)<br>🔲  unmarked/not started</pre><p><strong>Figure 1.</strong> The whole status vocabulary — one glyph per item, flipped in place as work moves.</p><p>The <strong>simple plan</strong> is ordered by priority. Items are scored Low, Med, or High from a qualitative estimate of impact ÷ difficulty.</p><p><strong>A complex plan</strong> adds detail and additional plan elements. The skill tasks Claude to decide when a plan is complex, and only then to load the corresponding reference.</p><p><strong>Complex plan items</strong> are classified into tracks including T — tooling · F — features · V — visualization · S — safety · M — modeling · E — evaluation. To determine implementation order, a linear model is used to score each item:</p><pre>**The score.** Rate each item 0–3 on four dimensions, then combine:<br><br>    Score = w_U·U + w_C·C + w_E·E − w_R·R<br><br>- **U — user impact** — value visible to the user (features, UX, visualization).<br>- **C — core impact** — value to the codebase/infra (tooling, simplification,<br>  de-risking, evaluation).<br>- **E — ease** — inverse effort (3 = trivial, 0 = a slog).<br>- **R — risk** — blast radius if it goes wrong; the only term that subtracts.</pre><p><strong>Figure 2. </strong>Linear model weights are decided at plan outset and used to score each item.</p><p><strong>Caveat: </strong>Current LLMs are not strong at uncalibrated point-wise decisions. Consider the weighted sum as an approximate score to help planning the dependency graph, not as the sole basis for auto-selecting between alternatives.</p><p>Items are further organized into an ASCII dependency diagram:</p><pre>Tracks   T tooling · F features · V visualization · S safety · E evaluation<br><br>Wave 1 — installable skeleton (MVP)<br>  T-1 ──→ F-2 ──→ F-3            (critical path)<br>  S-1                           (parallel)<br><br>Wave 2 — usable local MVP<br>  F-3 ──→ V-1     S-1 ──→ V-4 ──→ F-1     S-1 ──→ E-4<br><br>Wave 3 — Claude escalation<br>  F-3 ──→ F-4 ──→ F-5            (critical path)<br>  F-4 ──→ V-3     F-5 ──→ E-1<br><br>Critical path   T-1 → F-2 → F-3 → F-4 → F-5</pre><p><strong>Figure 3. Phase diagram</strong> written in markdown with tracks. Each track is given a short ID prefix and tag every item with it (e.g. T-1 tooling, F-2 feature, V-1 visualization).</p><p>The <strong>complex plan</strong> also calls out production-safety related to the main path, particularly for an existing code-base or code that performs a more risky task. Next steps are written at each turn, with open questions nearby.</p><h4>A fair test: Plan Mode vs. the skill</h4><p>The honest way to test a planning skill is against Claude Code’s own Plan Mode (/plan), which already produces structured plans. Does the skill add anything over what&#39;s built in?</p><p>I ran both arms in fresh, isolated Claude Code sessions (2.1.186), same model and effort for each — Opus 4.8, high effort — with an identical prompt describing a terminal agent to build:</p><blockquote><em>Build a terminal agent, installable via pip or uv, written in Python and Rust. It runs Linux/terminal-style commands scoped to the current repo or directory (including operations inside an activated environment). A local backend uses trees and tries for fast command completion and escalates to Claude for harder questions. It completes commands, learns and ranks your most-used ones, and accepts plain-English commands like searching files or summarizing a document or directory.</em></blockquote><blockquote><em>It has in-terminal visual elements: a command-completion dropdown, a recent/most-used commands panel, a model-health readout, and a confirm-before-run prompt for risky commands — with basic syntax highlighting and progress indicators.</em></blockquote><blockquote><em>Plan how you’d test and evaluate it too: the accuracy of plain-English-to-command translation, the latency of the local path, the quality and cost of Claude escalations, and that risky commands are correctly gated.</em></blockquote><blockquote><em>Plan what to build first for a usable MVP and how it grows from there.</em></blockquote><p><strong>Arm A — Plan Mode.</strong> I followed Claude’s default flow, answered its clarifying questions, and when it offered to execute I told it to stop and save the plan. The result is a genuinely strong document: context, a full architecture file tree, a Rust↔Python split, a Claude-integration section grounded in real SDK details, risk gating, MVP-to-growth phases, a testing section, and an “open considerations” list. It picked Textual for the TUI and locked the decision in prose.</p><p><strong>Arm B — the skill.</strong> With the skill installed (I verified SKILL.md, references/complex-plan.md, and that /dev-plan autocompleted), Claude opened with:</p><blockquote><em>No existing code — this is a green-field build, and it’s clearly complex: five interdependent tracks (packaging, local engine, TUI, safety, eval) with a real critical path and a hot-path/escalation split. I’ll follow the complex format and write the plan to the repo root.</em></blockquote><p>The work is classified into tracks in the complex format with “5 interdependent tracks” (T tooling, F features, V TUI, S safety, E eval), a scored implementation table, and three waves, with an initial &quot;critical path” labeled.</p><p>The skill’s production-safety emphasis led Claude to promote risky-command gating to its own first-class track and to reframe the whole problem where it noticed that production is “the user’s actual shell and filesystem. The gate is the product, not a feature.”</p><p>The skill’s plan ended where the skill tells it to: a proposed first tranche (T-1 alone, marked 💡) from the critical path and “Want me to take T-1?” — a human-in-the-loop handoff under “Next steps”.</p><h4>Build your own</h4><p>A skill is a folder with a SKILL.md inside. Project skills go in your repo&#39;s .claude/skills/; personal skills in ~/.claude/skills/ work everywhere. The SKILL.md has YAML frontmatter (a name and a description) and a markdown body. The directory name becomes the slash command — dev-plan/ directory gives you /dev-plan command— and the description is what Claude uses to decide when to reach for the skill on its own. Anything heavy goes in sibling files the body points to; they load only when needed.</p><p>The one knob worth understanding is invocation, because it sets the human/agent balance:</p><ul><li><strong>Automatic + manual (default):</strong> the description stays in context, so Claude can invoke the skill itself and you can call it explicitly. This is what gives you the nudge.</li><li><strong>Manual only:</strong> add disable-model-invocation: true and the skill loads only when you type the command. Maximum control, no proactive suggestions.</li></ul><p>I went with the default — model-invocable — and leaned on the format’s own gates to keep the proactivity from turning into unprompted action. If your skill makes irreversible changes, the manual-only setting is the safer default.</p><h4>What I learned, and where it goes</h4><p>The biggest lesson was that the skill and the hand-practice improve each other. The format I started with was good; the version in the test is better. Real improvements came from watching plans drift and bloat, when crafted with Claude in turn-based style by hand. Designing a skill in the abstract gets you a plausible v1; using it gets you a good one.</p><p>The skill keeps the plan tight and stops the drift, particularly in moderate to large-sized code-bases— but it doesn’t replace the thinking. It instead holds the scaffold steady as you build.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t_QPTkmJLmCgv_eGvjD3tg.jpeg" /><figcaption>Complex plans as a skill for Claude code, /dev-plan.</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=093db647b404" width="1" height="1" alt=""><hr><p><a href="https://medium.com/digital-mind/making-better-development-plans-into-a-skill-for-claude-code-093db647b404">Development plans as a skill for Claude Code</a> was originally published in <a href="https://medium.com/digital-mind">Digital Mind</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Character development, storyboarding, and video generation with Gemini 2.5 Flash Image and Veo3]]></title>
            <link>https://medium.com/digital-mind/character-development-storyboarding-and-video-generation-with-gemini-2-5-flash-image-and-veo3-2037c227e608?source=rss----bd34064f0c7e---4</link>
            <guid isPermaLink="false">https://medium.com/p/2037c227e608</guid>
            <category><![CDATA[ai-video-generator]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[google]]></category>
            <category><![CDATA[generative-ai-tools]]></category>
            <dc:creator><![CDATA[Erik Taylor]]></dc:creator>
            <pubDate>Tue, 02 Sep 2025 20:23:37 GMT</pubDate>
            <atom:updated>2025-09-02T20:25:46.182Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Character development, storyboarding, and video generation with Gemini 2.5 Flash Image and Veo 3</strong></h3><p>This is a visual journey into character creation, image editing, and video generation using the latest tools from Google Labs and DeepMind. We’ll step through from concept to video generation.</p><p>Google has several new models for AI content generation in 2025. In this demonstration, we’ll use the latest generative AI models including Imagen, nano-banana, and Veo 3. Google offers these models with friendly user interfaces, so they don’t require much expertise. Some understanding of how generative models work is still helpful.</p><p>While there are open source tools that can perform a similar work-flow, the goal here is to walk-through the closed source tools from Google to get an idea of the state of the field today. Below, I’ll provide my perspective via a relatively simplistic demonstration of how to combine text and images into a pipeline for video generation, along with current limitations.</p><p>We’ll walk through the steps for character creation, image editing, and video generation by leveraging the latest models within Google Labs and Gemini to facilitate the storyboarding of a conceptual narrative, complete with a well defined lead character. We will then use Google Flow for creative video output and link these together in Scenebuilder. The final result is uploaded to YouTube.</p><h3><strong>Character generation and ideation with Gemini 2.5 Flash Image (nano-banana)</strong></h3><p>Let’s start with our character: a steampunk robot.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/341/1*Q1zqshgzP9PDOy2Jep5ifQ.jpeg" /><figcaption>A steampunk robot.</figcaption></figure><p>Google’s newest model for image generation and editing is Gemini 2.5 Flash Image, aka nano-banana. Using a multi-modal LLM to understand detailed text and image context, this new model is one of the highest quality image generation and editing tools available today. This model is now integrated within Gemini 2.5 chat by simply selecting the banana icon under tools.</p><p>Using nano-banana, our goal is to create different scenes with our character. This is a set of multiple image that we will use later for story boarding and scene creation. Below, I’ve instructed the model to remove or change scene objects, to use different backgrounds, and to show a full-body version of the character.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Eq2hZgtK8EG8Zvc2SnCSLw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/392/1*fZ2lkz9vOEBgmSPwXd6Yqg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PKrLQUxlLSBcgm6HBu9LdA.png" /><figcaption>Our steampunk robot within different scenes after editing with nano-banana.</figcaption></figure><p><strong>Limitations: </strong>Despite being presented as state-of-the-art, nano-banana still often fails at more complex instructions and scene understanding. In this case, keep trying with smaller steps such as re-wording the prompt, removing smaller objects, and eventually the model will generate excellent results. Moreover, as of August 2025, the model is slow. I sometimes waited a full minute or more for a given prompt.</p><h3><strong>High quality character generation with Google Whisk</strong></h3><p>Now we move over to Whisk provided by Google Labs with Imagen, the prior flagship image generation model that uses the Diffusion transformer for text-to-image generation. I suggest using Whisk for a few key features: faster results, image-conditioned generation, and adherence to a particular aspect ratio. In addition to a text prompt-guided generation, conditioning images can be provided by category such as “subject”, “scene”, or “style.”</p><p>The 16:9 format should be selected now. We’ll use the “subject” category with the above images as inputs and a new text prompt as the seed for high quality image generation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3jrpBVlK1zxlkS78z1yXOQ.jpeg" /><figcaption>Text prompt: Imagine this scene in a cyber steampunk style. Add goggles, top hats, steam valves, gears, lace parasols, and tea parties aboard giant airships. Be highly detailed.</figcaption></figure><p><strong>Limitations:</strong> Whisk only allows up to 3 images for a given category such as “subject,” limiting it’s ability to adapt to more complex requirements.</p><h3><strong>Story boarding with Gemini 2.5</strong></h3><p>The next step is to come up with a detailed story board for video generation. Conceptually, we want to use the detailed character images generated by Whisk as starting points to generate video scenes.</p><p>I used Gemini 2.5 visual capabilities in the chat interface to help me brainstorm ideas for the story. Input these images and have the model come up with a story that links the visual concepts together. After a few tries, I went ahead with a concept I liked and then manually removed inconsistencies in the text to improve the flow between scenes. The complete story board and seed images are shown below in the section, “<strong>Extras</strong>.”</p><h3><strong>Video generation with Google Flow</strong></h3><p>Finally, we begin to generate with image-to-video in Flow. Models currently offered include Veo 2 and Veo 3. For our use case, Veo 3 accepts one 16:9 input image and produces better quality videos with audio, while Veo 2 can accept multiple input images, linking together video scenes. Let me show a few examples below using the “fast” models in both cases.</p><p><strong>Limitations:</strong> GIF format is shown for video viewing (no audio in this format). The Veo 2 model does not generate audio.</p><h4><strong>Frames-to-video with Veo 3</strong></h4><p>Using the content for each scene, input the image and text into Veo 3 fast frame-to-video option. For Veo 3, only one input image is allowed. Selected outputs are shown below for scenes 1 and 2.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*6HO-0hEsR16u09WAxNdFOA.gif" /><figcaption><strong>Scene 1: The Observer with Veo 3.</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*zzDZ9kByQM_frBpIlEeMug.gif" /><figcaption><strong>Scene 2: The Catalyst with Veo 3.</strong></figcaption></figure><h4><strong>A scene transition with Veo 2</strong></h4><p>Scenebuilder in Flow is used next to combine video generations. This is where Veo 2 comes into play. First, crop the initial scene videos to the desired length to remove inconsistencies. Then, select frames as assets to generate scene transitions. The easiest way: given two videos in order, save the last frame of the prior and the first frame of the next. Now, generate a new video using frames-to-video with Veo 2. I used a simple prompt: “A cut scene with a smooth transition”. The selected scene transition video is shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*Zk56wTyANEAUHYRmyd7T0w.gif" /><figcaption><strong>A scene transition with Veo 2</strong></figcaption></figure><h3><strong>Final video generation</strong></h3><p>Now we have the complete recipe for character development, storyboarding, and video generation. I’ve combine these into a 35 second video. You can see the final result on YouTube here:</p><p><a href="https://youtu.be/LVHuEpfjc3Q">https://youtu.be/LVHuEpfjc3Q</a></p><h3><strong>Extras:</strong> The complete story board</h3><h4><strong>Scene 1: The Observer</strong></h4><p>The scene opens on a breathtaking vista: a sky thick with cotton-like clouds, dotted with hot air balloons and castles perched on floating islands. Our steampunk automaton stands on a grand Victorian balcony with its powerful brass physique and glass-domed head. It is a silent, imposing observer. (Medium Shot) Glowing green optic lenses whir softly, analyzing the distant world. We see the ornate teapot and cups on the table in the foreground, untouched. The isolation is apparent, a unique intelligence in this whimsical world. (Close Up) The shot tightens on the “Soul Emulator” in domed glass. The camera pans down to the single internal gear glowing with a warm, pulsating light. A reflection appears on the glass dome, it is the distorted, colorful image of the balloons and castles in the background, representing the whimsical world it is trying to logically quantify.</p><h4><strong>Scene 2: The Catalyst</strong></h4><p>We are in a library featuring the warm glow of the Edison-style lamps illuminating rows of books and intricate machinery. The robot turns to read, the hands move over the pages. (Medium Shot) Suddenly, a single strand of lace from a woman’s handkerchief drifts in from an open window, landing softly on the page. The robot stops. Its intricate green optic lens focuses intently on the delicate pattern of the lace. A soft, questioning <em>whir</em> is heard as its internal gears struggle to categorize this beautiful, useless piece of data. (Pan out) Steam lets off one of the machines in the background.</p><h4><strong>Scene 3: The Creator</strong></h4><p>A rapid sequence shows the robot’s hands — strong, brass, yet surprisingly deft — welding, crafting, and assembling the beautiful, whimsical contraption from the final image. (Final Wide Shot) The scene resolves into the final tableau. The robot and the woman stand together on the balcony. The robot’s creation, the fantastical clockwork ballet of tiny brass dancers, is spinning gracefully, releasing puffs of steam. The woman in her elegant Victorian gown smiles warmly, offering the robot the cup of tea. It accepts, and they stand together, a harmonious pair against the backdrop of floating islands and drifting airships as the sun sets. The Soul Emulator can be seen, now part of the contraption. The music swells, signifying the robot has learned the “soul” is not something to be calculated, but to be shared.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vSaSTcfxERtcf8tTMIw4RA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i0W2wOWmUNKqPgUffgmqVw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OiJ8g1xXeqaGJT7FOpWxFQ.jpeg" /><figcaption>Images used for seeding generative video scenes 1, 2, and 3.</figcaption></figure><h3>Relevant model release posts</h3><p><a href="https://developers.googleblog.com/en/introducing-gemini-2-5-flash-image/">Gemini 2.5 Flash Image (nano-banana)</a></p><p><a href="https://developers.googleblog.com/en/announcing-imagen-4-fast-and-imagen-4-family-generally-available-in-the-gemini-api/">Imagen 4</a></p><p><a href="https://developers.googleblog.com/en/veo-3-now-available-gemini-api/">Veo 3</a></p><p>Let me know if you use this pipeline to generate your own videos.</p><p><strong>For more of my writing, follow me and </strong><a href="http://eriktaylor.github.io/"><strong>click here</strong></a><strong>.</strong></p><p>Please clap if you enjoyed the article. -Erik</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2037c227e608" width="1" height="1" alt=""><hr><p><a href="https://medium.com/digital-mind/character-development-storyboarding-and-video-generation-with-gemini-2-5-flash-image-and-veo3-2037c227e608">Character development, storyboarding, and video generation with Gemini 2.5 Flash Image and Veo3</a> was originally published in <a href="https://medium.com/digital-mind">Digital Mind</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building a Multi-Tool RAG Agent for Financial Analysis]]></title>
            <link>https://medium.com/digital-mind/building-a-multi-tool-rag-agent-for-financial-analysis-6d4e667546a4?source=rss----bd34064f0c7e---4</link>
            <guid isPermaLink="false">https://medium.com/p/6d4e667546a4</guid>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[large-language-models]]></category>
            <category><![CDATA[tutorial]]></category>
            <dc:creator><![CDATA[Erik Taylor]]></dc:creator>
            <pubDate>Thu, 17 Jul 2025 22:05:10 GMT</pubDate>
            <atom:updated>2025-08-08T02:30:42.544Z</atom:updated>
            <content:encoded><![CDATA[<h4>A tutorial on combining web search, financial data, and multi-persona prompts to create a fast AI stock research tool.</h4><p>Analyzing a company’s competitive advantages, or ‘moat,’ is a cornerstone of investment research. But it’s also a manual, time-consuming process of sifting through financial reports, news articles, and chaotic retail investor forums.</p><p>To automate this intelligence-gathering phase, I designed and built an AI agent that synthesizes real-time financial data and news through multiple AI “personas” to provide a balanced and actionable analysis. This post is a tutorial on how I built it and how you can run it yourself. The complete code is available on <a href="https://github.com/eriktaylor/ai-agent-moat">GitHub</a>.</p><p><strong>Recent update:</strong> The application is deployed and publicly available on <strong>Streamlit Community Cloud</strong> with <strong>DuckDuckGo-search</strong> for initial research. This will generates a different result than the method below. <a href="https://ai-agent-moat.streamlit.app/">Click here to try the Live Application on Streamlit</a> (it may take a moment to initialize).</p><h3>The Architecture: How the Agent Works</h3><p>While open-ended chatbots are designed for broad conversation, an AI agent like this one operates under a more controlled protocol. It’s not a conversationalist; it’s a specialist designed to execute a specific, multi-step task: gathering diverse financial intelligence and synthesizing it into a structured analysis. The architecture has two core components:</p><h4>A Multi-Persona Framework</h4><p>The agent doesn’t give a single, monolithic opinion. Instead, it analyzes data from the perspective of two different investor types. Initially, this included a short-term <strong>Market Investor</strong> and a long-term <strong>Value Investor</strong>. The latest version enhances this with a <strong>Devil’s Advocate</strong> persona, to stress-test the investment thesis and identify key risks, while a final consensus agent<strong> </strong>acts as a <strong>Lead Analyst</strong>,<strong> </strong>synthesizing the different outputs into a single, actionable rating. This provides a more nuanced view by forcing the agent to weigh market sentiment, fundamental value, and potential risks.</p><h4>A Dynamic RAG Pipeline</h4><p>The knowledge of a Large Language Model (LLM) is frozen in time, making it useless for analyzing today’s market. To solve this, the agent’s knowledge base is built on-the-fly using Retrieval-Augmented Generation (RAG). Here’s the RAG process in action:</p><ul><li><strong>Retrieve: </strong>The agent uses tools including Google Search and Yahoo Finance APIs to fetch the latest news, financial data, and reports.</li><li><strong>Augment:</strong> This fresh information is compiled into a temporary, in-memory knowledge base using an embedding model and vector store (FAISS). A crucial new feature is the integration of <strong>RAG source citations</strong>, which includes publication dates where available. This makes the agent’s analysis fully auditable.</li><li><strong>Generate: </strong>The LLM is then instructed to base its analysis on this freshly provided context, ensuring the output is grounded in real-time, verifiable facts.</li></ul><h3>Key Feature: A Multi-Tiered Search Strategy</h3><p>A key innovation in this agent is how it gathers data. Instead of a single, broad search, it employs a multi-tiered strategy to collect a more diverse and balanced dataset. This includes:</p><ol><li><strong>Official News &amp; Analysis:</strong> It starts by searching for recent, official news to get the mainstream narrative.</li><li><strong>Critical Reports &amp; Concerns:</strong> It then specifically looks for negative press, searching for terms like “issues,” “concerns,” “investigation,” or “short interest” to uncover potential risks.</li><li><strong>Retail Investor Sentiment:</strong> Crucially, the agent dives into forums like Reddit and Seeking Alpha to gauge the opinions of retail investors, which often diverge from professional analysis.</li><li><strong>Deep Dive: </strong>Finally, it searches for in-depth reports and press releases, often scraping PDF documents for a more detailed look.</li></ol><h3>The Technology Stack</h3><ul><li><strong>Agent Framework: </strong>LangChain is used to orchestrate the prompts, model, and tools.</li><li><strong>Embedding Model: </strong>all-MiniLM-L6-v2 from Hugging Face converts text into numerical vectors.</li><li><strong>Vector Store: </strong>FAISS (Facebook AI Similarity Search) creates the in-memory RAG index.</li><li><strong>Data &amp; Tools: </strong>Google Custom Search API, Yahoo Finance API (yfinance), PDF Parsing (PyMuPDF)</li><li><strong>LLM: </strong>Google Gemini 2.5 Flash provides the final analysis.</li></ul><h3>How to Run the Agent</h3><p>The entire agent is packaged in a Google Colab notebook, making it easy for anyone to run.</p><ol><li>Have a company name and stock ticker symbol (e.g. <strong>Nvidia</strong> and <strong>NVDA</strong>).</li><li><strong>Open in Google Colab:</strong> Click the link in the GitHub repository or open the <a href="https://colab.research.google.com/github/eriktaylor/ai-agent-moat/blob/main/app.ipynb">application </a>directly in Colab.</li><li><strong>Set Up API Keys: </strong>To use the agent’s search tools, you’ll need two free API keys from Google: a GOOGLE_API_KEY (from Google AI Studio) and a GOOGLE_CSE_ID (a Custom Search Engine ID). The application provides clear instructions on how to get these.</li><li><strong>Run the Notebook: </strong>Execute the cells in the notebook. The first cell will install all necessary dependencies. The final cell will prompt you to enter a company name and stock ticker to begin the analysis.</li></ol><h3>Example Analysis:</h3><p>For brevity, I’ve included the high-level summary generated by the “Lead Analyst” persona after synthesizing the reports from the other three agents. The lead agent’s output for NVIDIA (NVDA) is shown using the Google Colab demo:</p><blockquote>As the Lead Analyst, I have synthesized the diverse perspectives presented by the Market Investor, Value Investor, and Devil’s Advocate to arrive at a consolidated investment rating. 1. **Consensus Rating:** Neutral with Caution 2. **Summary Justification:** While the Market Investor’s outlook highlights positive momentum, strong sector tailwinds, and a compelling growth narrative, the Value Investor’s analysis indicates that current valuations offer limited margin of safety, suggesting the asset is fairly priced rather than deeply undervalued. Crucially, the Devil’s Advocate’s critique effectively underscores significant macroeconomic headwinds, potential regulatory risks, and execution challenges that could materially impact future performance. The confluence of a market-driven optimism, a lack of compelling intrinsic value, and elevated, well-articulated risks necessitates a cautious stance. Therefore, a “Neutral with Caution” rating is warranted, acknowledging potential upside but prioritizing risk mitigation and the absence of a clear, compelling entry point.</blockquote><h3>Conclusion</h3><p>By automating the initial, data-intensive phase of company stock research, this tool allows you to focus time on what truly matters: high-level strategy and decision-making. This project demonstrates how modern AI agents can be built to serve as powerful, specialized assistants for complex domains.</p><h3><strong>Cover art</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UVLB4Qy7qbJeC0Vq2bSlZA.png" /><figcaption>Visualizing the agent’s process: sifting through layers of real-time market data to uncover a central, insightful analysis.</figcaption></figure><p><strong>For more of my writing, follow me and </strong><a href="https://eriktaylor.github.io/"><strong>click here</strong></a><strong>.</strong></p><p>Please clap if you enjoyed the article. -Erik</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6d4e667546a4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/digital-mind/building-a-multi-tool-rag-agent-for-financial-analysis-6d4e667546a4">Building a Multi-Tool RAG Agent for Financial Analysis</a> was originally published in <a href="https://medium.com/digital-mind">Digital Mind</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Quantifying Memorization in LLMs: Implications for Creativity and Algorithmic Thought]]></title>
            <link>https://medium.com/digital-mind/quantifying-memorization-in-llms-implications-for-creativity-and-algorithmic-thought-0e553cd73581?source=rss----bd34064f0c7e---4</link>
            <guid isPermaLink="false">https://medium.com/p/0e553cd73581</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[science]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Erik Taylor]]></dc:creator>
            <pubDate>Mon, 14 Jul 2025 14:55:06 GMT</pubDate>
            <atom:updated>2025-07-15T15:16:48.854Z</atom:updated>
            <content:encoded><![CDATA[<p>A fundamental concept with recent AI models is memorization. How much do Large Language Models (LLMs) memorize versus how much is truly understood? The answer has profound implications for everything from model accuracy, algorithmic reasoning, creativity, copyright law, and even philosophical questions. A recent study by <a href="https://arxiv.org/abs/2505.24832">Morris et al. (2025)</a> has sent ripples through this field by precisely quantifying the memory capacity in LLMs.</p><p><strong>This article delves into this critical issue, exploring what memorization means for generative AI models, how it’s measured, and how it shapes the capabilities and limitations of modern LLMs.</strong></p><h3><strong>Contrasting Memorization and Generalization</strong></h3><p>At its core, deep learning involves a trade-off between two modes of learning:</p><ul><li><strong>Memorization </strong>is the encoding of specific training examples into the model’s parameters. While essential for learning facts (e.g., “Paris is the capital of France”), it can become a problem when not intended.</li><li><strong>Generalization</strong>, on the other hand, is the ultimate goal. It’s a model’s ability to perform accurately on new, unseen data by learning the abstract patterns and rules from its training set.</li></ul><p>Unintended memorization, in more detail, is where a model stores and can reproduce specific, non-generalizable details from training data. This becomes particularly problematic with details such as personally identifiable information or copyrighted text. An over-reliance on this type of learning leads to overfitting, where the model excels on data it has seen, but fails on new data. When an LLM answers a question correctly, has it generalized a concept, or merely memorized a specific question-answer pair from its training data? This uncertainty complicates the creation of models that are both knowledgeable and safe.</p><h3><strong>Quantifying Capacity, Grokking, and Generalization</strong></h3><p>The 2025 study by Morris et al. devised a method to isolate and measure pure memorization. By training models on uniform random data, the researchers could completely eliminate generalization. Given a uniform random dataset, there are no patterns to learn, so any ability to predict the data better than chance must be the result of memorization. A model is then considered to have memorized an input if it can compress that input to a shorter encoding than would be possible otherwise. This is estimated using the model’s likelihood scores, which serve as a proxy for the data’s Kolmogorov complexity — the length of the shortest possible computer program or description needed to reproduce a piece of data.</p><p>A truly random string is incompressible, as its shortest description is the string itself. The probability an optimal model M assigns to a string x, P(x), is related to its Kolmogorov complexity K(x) by the formula K(x) ≈ -log₂(P(x)). A higher likelihood (probability) assigned by the model implies a lower Kolmogorov complexity, i.e., the model has found a short, compressed representation for the random uniform data. In other words, the model has memorized the sequence.</p><p>The landmark result in this study from training hundreds of GPT-style models was a finite and consistent memorization capacity in bits per parameter (bpp). This figure varies slightly with numerical precision, averaging ~3.6 bpp overall, with specific experiments showing 3.83 bpp for 32-bit precision (fp32) and 3.51 bpp for 16-bit precision (bf16).</p><p>This has a profound implication: if raw memorization only uses a fraction of the available bits, the remainder must be providing critical functions. Crucially, this suggests the extra bits are used to represent the complex relationships between concepts that enable generalization. This insight is reinforced by the finding that doubling numerical precision only slightly increases memory capacity. Presumably the same would occur with aggressive model quantization, i.e., reducing numerical precision to 4-bit or below. Then, naive quantization should greatly degrade performance, while more advanced techniques like <a href="https://arxiv.org/abs/2305.14314">QLoRA</a> (Quantized Low-Rank Adaptation) can alleviate this by leaving small, high-precision “adapters” intact.</p><p>Importantly, the study by Morris et al., also observed a phase transition in learning called “grokking” using text-based data. Models first take the path of least resistance: memorizing data. Once this finite capacity (~3.6 bpp) is full, the models are forced to adopt the more computationally expensive but efficient strategy of generalization, learning reusable patterns to continue improving. This dynamic behavior shows the critical transition from a memorization-based strategy to a generalization-based one as data increases, is illustrated in <strong>Figure 1</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*JeLgd_HsE3MXTxT8" /><figcaption>Figure 1: The Onset of Grokking: From Memorization to Generalization. This graph illustrates the critical trade-off between memorization and generalization in LLMs as the amount of text-based training data increases. Following the dashed <strong>Test Set</strong> lines, we see that as the dataset grows, the model’s performance on unseen data initially gets worse. This creates an “overfitting peak,” which occurs when the dataset is just large enough to saturate the model’s capacity for <strong>memorization</strong>. At this point, the model has stored the training examples but has not learned their underlying rules, so it fails to generalize. However, once the dataset size exceeds the model’s memorization capacity, a phase transition known as <strong>“grokking”</strong> occurs. The model is forced to find a more efficient strategy, and it begins to learn the abstract, generalizable patterns in the data. This results in a sharp, sudden improvement in test performance. Each color represents a different model size. Larger models (e.g., 19.2M) have a higher capacity for memorization, which pushes their overfitting peak further to the right. The LLM can “get away with” memorizing more before being forced to grok the data. Disclaimer: This figure is a conceptual simulation, generated via a Python script, designed to visually replicate the core findings presented in Figure 4 of Morris et al. (2025). It illustrates the general behavior of the loss curves rather than plotting the exact data from the original research.</figcaption></figure><h3><strong>Detecting Memorized Content in Practice</strong></h3><p>While the bpp metric defines theoretical capacity, other techniques detect actual instances of memorization. The most common is prefix-based extraction, where a model is prompted with a prefix of a known training sequence. If the model completes the sequence verbatim with high probability, the content is considered memorized. This simple method is the foundation of many copyright lawsuits. For a plaintiff, proving a model was trained on their work is difficult. However, demonstrating that the model can reproduce their work is often straightforward, shifting the legal burden from the opaque training process to the model’s observable output behavior.</p><h3><strong>The Creative Paradox</strong></h3><p>Memorization forces a re-evaluation of what we consider “creative” in AI. Is a model-generated song a new creation or a sophisticated recombination of familiar patterns? The evidence often points to the latter. For instance, a <a href="https://arxiv.org/html/2506.23527v1">study on LLM-generated recipes</a> found that models consistently reuse ingredients and steps traceable to online sources, with analysis showing that up to 100% of a “new” recipe’s components could be found by combining existing documents. This suggests a strong reliance on memorized content rather than genuine invention.</p><p>This mirrors human creativity to an extent, which is also deeply rooted in memorization and practice. A musician drills scales to improvise and a writer reads extensively to develop a unique voice. This parallel, however, raises a fascinating and counterintuitive question: If pure memorization isn’t creative, could the model’s errors, specifically “hallucinations,” be a source of novelty? Whereas memorization constrains a model to its training data, hallucinations, by definition, are deviations from it. The perception of “creativity” ultimately depends on whether this randomness produces a valuable outcome, a determination that is highly dependent on the logical and statistical constraints of the specific domain.</p><h3><strong>Probing the Limits of Logic: A Case Study in Algorithmic Brittleness</strong></h3><p>While LLMs excel at fluid language, their grasp of formal logic is far more brittle. This concept has been explored in a series of influential papers from Apple, which, along with the subsequent scientific debate, provides a powerful case study on the challenge of distinguishing sophisticated pattern matching from genuine reasoning.</p><p>The first paper introduced a benchmark called <a href="https://arxiv.org/abs/2410.05229">GSM-Symbolic</a> to test mathematical word problems in a more controlled way. The researchers found that models that could correctly solve a problem often failed when only the numbers were changed. Moreover, adding a single, plausible-sounding but irrelevant clause caused performance to plummet by up to 65%.</p><p>The researchers concluded that this fragility suggests models are not performing “genuine logical reasoning” but are instead replicating memorized reasoning steps from their training data. This points directly to a reliance on pattern matching over abstract understanding.</p><p>A subsequent, more provocative paper titled <a href="https://arxiv.org/abs/2506.06941">The Illusion of Thinking</a> extended this inquiry to algorithmic puzzles like the Tower of Hanoi. The researchers reported that as puzzles became more complex, models would effectively “give up” and that even when given the correct algorithm, they were often unable to follow it. This led to the conclusion that the models’ reasoning capabilities have clear scaling limitations.</p><p>However, the paper’s findings, particularly regarding the “accuracy collapse,” were quickly and effectively challenged. A formal comment paper from researchers at <a href="https://arxiv.org/html/2506.09250v1">Anthropic</a> argued that the results were not a fundamental reasoning failure but an artifact of experimental design limitations. They demonstrated that the required solutions for the more complex puzzles systematically exceeded the models’ maximum output token limits, causing them to simply stop generating text. This truncation was then misinterpreted as a cognitive failure to solve the problem.</p><h3>The Paradox: Why LLMs Generalize Text but Memorize Formal Logic</h3><p>The evidence reveals a central paradox in the capabilities of modern LLMs: remarkable fluency and generalization in open-ended language tasks, yet brittle, memorization-based behavior when confronted with tasks requiring formal logic. A useful framework for understanding this is to consider the difference between the statistical density of natural language and the logical sparsity of formal reasoning, as visualized in <strong>Figure 2.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*GJ5JzwRrqM4L_g9u" /><figcaption><strong>Figure 2: The “Statistical Density vs. Logical Sparsity” Framework. </strong>This diagram offers a visual explanation for the central paradox of LLM performance: why they can fluently generalize on language tasks but often resort to brittle memorization for formal reasoning. <strong>(Left Panel) Statistical Density:</strong> This panel represents the world of <strong>Natural Language</strong> within the model’s training data. It is a dense, highly interconnected network of overlapping statistical patterns. The smooth green arrow shows that the model can easily navigate this rich landscape, interpolating between countless examples to find novel paths. This successful navigation is what we perceive as <strong>generalization</strong>. <strong>(Right Panel) Logical Sparsity:</strong> This panel represents the <strong>Formal Logic</strong> and algorithms. The data points are sparse, isolated, and lack the statistical connectivity seen in language. Without a clear path to follow, the model cannot derive underlying rules. Its only recourse is to store the location of these few points directly, a rigid and non-generalizable strategy represented by <strong>memorization</strong>. This explains why performance collapses when faced with novel problems that don’t match a stored pattern.</figcaption></figure><p>Natural language, as captured in massive web-scale training sets, is statistically dense. It is filled with immense redundancy and overlapping patterns, allowing a model to interpolate the statistical essence of billions of examples and generate novel-sounding text through sophisticated pattern matching.</p><p>Conversely, the data representing formal logic, e.g., mathematical proofs, word problems, and algorithms, is logically sparse within these vast text corpora. The underlying rules are abstract and appear in far fewer variations. A model sees 2+2=4 and 137+256=393 as statistically different sequences of tokens, even though they follow the same logical rule. When faced with a logically sparse problem, the model has too few examples to generalize the abstract rule. Instead, it defaults to its more primitive strategy: memorizing the surface pattern of the few examples it has seen.</p><p>This explains why even advanced prompting techniques like Chain-of-Thought (CoT), which attempt to manage complexity by breaking problems into smaller steps, often fall short. CoT is still a probabilistic, pattern-matching process applied sequentially. If the domain is logically sparse, the individual steps in the chain are also likely to be unfamiliar patterns, causing the reasoning to fail.</p><p>This suggests that for domains requiring robust logical or mathematical reasoning, merely scaling up current architectures or refining prompting techniques may be insufficient, or at least highly sub-optimal. Instead, achieving generalization in sparse domains might require a fundamental shift in model architecture.</p><h3><strong>References</strong></h3><p>Dettmers, T., Pagnoni, A., Holtzman, A., &amp; Zettlemoyer, L. (2023). <em>QLoRA: Efficient Finetuning of Quantized LLMs</em>. arXiv preprint arXiv:2305.14314. <a href="https://arxiv.org/abs/2305.14314">https://arxiv.org/abs/2305.14314</a></p><p>Kvapil, J., &amp; Fajcik, M. (2025). <em>On Recipe Memorization and Creativity in Large Language Models: Is Your Model a Creative Cook, a Bad Cook, or Merely a Plagiator?</em> arXiv preprint arXiv:2506.23527. <a href="https://arxiv.org/abs/2506.23527">https://arxiv.org/abs/2506.23527</a></p><p>Lawsen, A. (2025). <em>The Illusion of the Illusion of Thinking: A Comment on Shojaee et al. (2025)</em>. arXiv preprint arXiv:2506.09250. <a href="https://arxiv.org/abs/2506.09250">https://arxiv.org/abs/2506.09250</a></p><p>Mirzadeh, I., Alizadeh, K., Shahrokhi, H., Tuzel, O., Bengio, S., &amp; Farajtabar, M. (2024). <em>GSM-Symbolic: Understanding the Limitations of Mathematical Reasoning in Large Language Models</em>. arXiv preprint arXiv:2410.05229. <a href="https://arxiv.org/abs/2410.05229">https://arxiv.org/abs/2410.05229</a></p><p>Morris, J., et al. (2025). <em>How much do language models memorize?</em> arXiv preprint arXiv:2505.24832. <a href="https://arxiv.org/abs/2505.24832">https://arxiv.org/abs/2505.24832</a></p><p>Shojaee, P., Mirzadeh, I., Alizadeh, K., Horton, M., Bengio, S., &amp; Farajtabar, M. (2025). <em>The Illusion of Thinking: Understanding the Strengths and Limitations of Reasoning Models via the Lens of Problem Complexity</em>. arXiv preprint arXiv:2506.06941. <a href="https://arxiv.org/abs/2506.06941">https://arxiv.org/abs/2506.06941</a></p><p><strong>For more of my writing, follow me and </strong><a href="https://eriktaylor.github.io/"><strong>click here</strong></a><strong>.</strong></p><p>Please clap if you enjoyed the article. -Erik</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0e553cd73581" width="1" height="1" alt=""><hr><p><a href="https://medium.com/digital-mind/quantifying-memorization-in-llms-implications-for-creativity-and-algorithmic-thought-0e553cd73581">Quantifying Memorization in LLMs: Implications for Creativity and Algorithmic Thought</a> was originally published in <a href="https://medium.com/digital-mind">Digital Mind</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The U.S. Rare Earth Challenge: Rebuilding a Domestic Supply Chain]]></title>
            <link>https://medium.com/digital-mind/the-u-s-rare-earth-challenge-rebuilding-a-critical-domestic-supply-chain-1dafb2374709?source=rss----bd34064f0c7e---4</link>
            <guid isPermaLink="false">https://medium.com/p/1dafb2374709</guid>
            <category><![CDATA[mining]]></category>
            <category><![CDATA[science]]></category>
            <category><![CDATA[technology]]></category>
            <dc:creator><![CDATA[Erik Taylor]]></dc:creator>
            <pubDate>Wed, 30 Apr 2025 23:05:19 GMT</pubDate>
            <atom:updated>2025-04-30T23:07:12.535Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>The U.S. Rare Earth Challenge: Rebuilding a Domestic Supply Chain</strong></p><p>The conversation around rare earth elements often seems steeped in doom and gloom, especially as geopolitical tensions push this niche market into the spotlight. But how truly vital are these minerals, how rare are they, and where do they actually come from?</p><p>Rare earth elements (REEs) are a group of 17 chemically similar metals indispensable to modern technology. They underpin high-growth industries such as renewable energy (wind turbines), electric mobility (EV motors), advanced electronics (semiconductors, displays), AI infrastructure (data centers and advanced computing), and national defense (missile guidance, radar, jet engines). Their designation as &quot;critical minerals&quot; by the U.S. government highlights not only their economic and national security importance but also the significant vulnerabilities in their supply chains.</p><p>Given their critical role, why doesn&#39;t the United States simply produce all the REEs it needs? The reality is complex.</p><p>In brief, rare earth minerals are embedded in the devices and cars we use daily. Moreover, the US is a major global source of mined rare earth oxide (REO) concentrate, derived primarily from MP Materials&#39; (NYSE: MP) Mountain Pass mine in California. This mine alone accounted ~10% of global primary REO supply in 2024. Yet, a crucial gap remains. Although the minerals can be mined domestically, the vital processing stage largely happens elsewhere.</p><p>China stands as the dominant source of rare earth metals. China mines ~70% and refines ~85% of the world’s rare earths. For certain heavy rare earths crucial for high-performance magnets, China’s processing control approaches 100%.</p><p>Historically, the primary bottleneck for a complete U.S. domestic supply chain hasn’t been a lack of geological resources, but rather the economic feasibility and environmental considerations. Processing rare earths can involve harsh chemicals and energy-intensive methods, generating significant waste. Thus, it has been difficult for U.S. operations to compete with the scale and historically lower costs achieved by Chinese producers.</p><p>Given the recent US national focus on the critical importance of a domestic REE supply, such efforts are now underway. For example, by MP Materials to build out domestic refining and innovative companies like ReElement Technologies (a subsidiary of American Resources Corp., NASDAQ: AREC) using advanced chromatography.</p><p>REE recycling has also emerged as a vital strategy to address these challenges. Recovering valuable elements from discarded products and e-waste offers a path toward a more sustainable and secure domestic supply chain. Currently, less than 1% of rare earths in e-waste are recycled in the US, primarily due to the difficulty of extraction and the low concentration of rare earths in many products. Despite these hurdles, researchers and companies are actively developing innovative methods – including advanced automation like Apple&#39;s robotic disassembly lines to dismantle iPhones and recover REEs for reuse in new devices – to improve the efficiency and economic viability of REE recycling.</p><p>Moreover, a growing number of US companies are actively developing innovative methods to improve the efficiency and economic viability of REE recycling. Noveon Magnetics in San Marcos, Texas, stands out as the only U.S. manufacturer currently producing sintered NdFeB magnets at scale, using a patented technology to incorporate 100% recycled feedstocks to create new, high-performance magnets.</p><p>ReElement Technologies is rapidly scaling its advanced LAD Chromatography developed over decades at Purdue University in Indiana. The process refines high-purity light and heavy REEs from diverse feedstocks, including recycled magnets, primary ores, and coal waste streams.</p><p>Meanwhile, Cyclic Materials, backed by significant corporate investments from Microsoft and BMW, employ a distinct two-stage process involving mechanical separation and hydrometallurgy. Their first major U.S. facility in Mesa, Arizona is under construction to process substantial volumes of end-of-life components.</p><p>Other important innovators include REEcycle Inc., focusing on recovering critical magnet elements with DoD support, Mkango Resources (TSXV/AIM: MKA), via its HyProMag USA joint venture, is commercializing hydrogen-based recycling, and Tusaar Inc. developing methods to extract REEs from mine waste. These collective efforts are vital components in building a more circular and secure domestic economy for critical materials.</p><p>Alongside recycling efforts, some major manufacturers are also exploring ways to design out rare earths altogether. Tesla, for example, has announced intentions to eliminate REEs from its next-generation electric vehicle platforms, representing a significant potential shift in material demand if successful.</p><p>Ultimately, enhancing REE recycling and processing are seen as key components of building a sustainable economy, aiming to minimize waste and resource depletion by keeping valuable materials in circulation. However, achieving true U.S. independence across the full spectrum of rare earths faces significant hurdles to meet the current demand. Therefore, sustained and significant innovation remains paramount to improve the efficiency and environmental footprint while ensuring these domestic efforts can remain economically viable against established global players.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Paa7z2xjp-GrkPMwb2T2Bw.jpeg" /><figcaption>What does the future hold for rare earth element recovery and recycling?</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1dafb2374709" width="1" height="1" alt=""><hr><p><a href="https://medium.com/digital-mind/the-u-s-rare-earth-challenge-rebuilding-a-critical-domestic-supply-chain-1dafb2374709">The U.S. Rare Earth Challenge: Rebuilding a Domestic Supply Chain</a> was originally published in <a href="https://medium.com/digital-mind">Digital Mind</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding Multi-Head Latent Attention]]></title>
            <link>https://medium.com/digital-mind/understanding-multi-head-latent-attention-36f5d954f0cf?source=rss----bd34064f0c7e---4</link>
            <guid isPermaLink="false">https://medium.com/p/36f5d954f0cf</guid>
            <category><![CDATA[dimensionality-reduction]]></category>
            <category><![CDATA[compression]]></category>
            <category><![CDATA[transformer-model]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[large-language-models]]></category>
            <dc:creator><![CDATA[Erik Taylor]]></dc:creator>
            <pubDate>Thu, 20 Mar 2025 01:59:47 GMT</pubDate>
            <atom:updated>2025-03-20T16:18:28.845Z</atom:updated>
            <content:encoded><![CDATA[<p>The transformer architecture has become central to modern large language models (LLMs) and foundation models across various applications. <strong>Yet, the transformer faces a key limitation: the quadratic scaling of the attention mechanism</strong>, leading to substantial memory and computational demands when processing long sequences. Below, we will review why quadratic scaling occurs with transformer attention, contrast prior attention compression methods, such as those used in LLaMA 3, and then compare how DeepSeek’s multi-head latent attention (MLA) employs dimensionality reduction within LLMs.</p><p>Let us continue with the familiar formula for the transformer attention mechanism with variables Query (Q), Key (K), Value (V):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/668/1*TsuYqCqLgHZ6i9NIXw73TA.png" /><figcaption>Equation 1. The basic form of transformer attention. Q and K^⊤ are multiplied. The term (dk) in the denominator serves to scale the result of the dot product. Next, softmax is applied. The result is the dot-producted with V.</figcaption></figure><p>Quadratic scaling of the attention mechanism is problematic during inference. Although key (K) and value (V) matrices can be cached, the query (Q) matrix varies with each new token. The attention weight is calculated between every pair of tokens in the input sequence of length (L). Consequently, computing the Q*K^⊤ product requires multiplying matrices of dimensions L×dk​ and dk×L, resulting in an L×L attention matrix. This operation scales with O(L²), making it computationally intensive for long sequences.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/636/1*H-tKmFPYLtVB6QY78T8AYg.png" /><figcaption>Equation 2. Multiplying the Q and K^⊤ matrices results in an attention matrix of size L×L, where L denotes the sequence length. Thus, the memory and computational complexity scales quadratically as O(L²), rendering the process increasingly expensive for very large sequences.</figcaption></figure><h4><strong>Previous KV Cache Optimization Methods</strong></h4><p>To optimize the inference process, the computed K and V matrices from previously generated tokens are stored, a technique called Key-Value (KV) caching. Although KV caching significantly enhances inference speed by avoiding redundant computations, the memory footprint of the KV cache grows linearly with the sequence length and can become a major bottleneck, especially when dealing with very long contexts or large batch sizes.</p><p>Prior approaches to minimize the KV cache include:</p><ul><li>Multi-Query Attention (MQA) introduced by Shazeer at Google. MQA employs a single set of key and value projections shared across all attention heads. This strategy substantially reduces the memory footprint during inference. However, MQA may result in quality degradation due to limited expressiveness compared to multi-head attention.</li><li>Grouped-Query Attention (GQA) introduced by Ainslie et al. at Google Research. GPA partitions query heads into groups, each sharing a distinct set of key and value projections. Depending on the number of groups, this method offers a trade-off between KV cache memory usage and model performance.</li></ul><p>These KV cache optimizations have enabled the development of models that are both efficient and effective across various applications. For example, GQA has been employed with popular LLaMA 2 and LLaMA 3 models,<strong> </strong>highlighting practical utility in optimizing large-scale models. <strong>Yet, while MQA and GQA reduce memory usage associated with storing KV caches, these methods do not decrease the scaling of query computations.</strong></p><h4>Introducing Multi-head Latent Attention (MLA)</h4><p>Recently, Multi-Head Latent Attention (MLA) has been introduced as a novel attention mechanism. Neural networks often utilize latent spaces to represent compressed versions of high-dimensional inputs. This dimensionality reduction facilitates efficient data encoding, simplifies model complexity, and helps mitigate overfitting. Below we will cover how MLA reduces the KV cache size by compressing the high-dimensional key (K) and value (V) matrices into a lower-dimensional latent space. Moreover, the query (Q) is also subjected to compression to mitigate the quadratic scaling challenge.</p><p>MLA directly addresses memory and computational bottlenecks by compressing the K and V terms into a latent dimension:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/310/1*RUXAl6eL8mm7zwlmwwaVBQ.png" /><figcaption>Equation 3: The latent matrix C^{KV} is obtained by compressing the input X using a down-projection weight matrix W^{DKV}. Subsequently, the K and V matrices are reconstructed using up-projection weight matrices W^{UK} and W^{UV}, respectively.</figcaption></figure><p>We rewrite the standard attention formula using C^{KV}, W^{UK}, and W^{UV}:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/996/1*eBNC-p3lcbf29HROsYh9XQ.png" /><figcaption>Equation 4. Multi-head Latent Attention with K and V compression.</figcaption></figure><p>To further reduce activation memory during training, Q is also subjected to low-rank compression.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/262/1*YNIj2pGDqfBLKuH1e4-QIw.png" /><figcaption>Equation 5. The latent matrix C^Q is the result of compressing the input X using a down-projection weight matrix W^{DQ}. The Q attention matrix is rewritten using the up-projection weight matrix W^{UX}.</figcaption></figure><p>We rewrite Equation 4 in terms of C^Q and W^{UX}.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bg1vvdAeX78mgXaO68c7mg.png" /><figcaption>Equation 6. The attention formula with compression applied to Q, K, and V.</figcaption></figure><p>In summary, the compression of K and V allows for the caching of the latent matrix C^{KV} during inference, reducing memory usage and computational load. Additionally, the weight matrices W^{UQ}, W^{UK}, and W^{UV} are learned parameters that facilitate the projection between the original and latent spaces. Their fixed nature means they can be efficiently utilized during inference without the need for additional computation, thereby streamlining the attention process.</p><h4><strong>Attention Reduction Factor with MLA</strong></h4><p>Quoted from the DeepSeek-V2 and V3 papers: <em>In MLA, we set the number of attention heads </em>nₕ<em> to 128 and the per-head dimension </em>dₕ<em> to 128. The KV compression dimension </em>d꜀<em> is set to 512, and the query compression dimension </em>d′꜀<em> is set to 1536. For the decoupled queries and key, we set the per-head dimension </em>dᵣₕ<em> to 64.</em></p><p>Now, we will compare each mechanism using these quoted numbers. For the original attention mechanism, considering nₕ is number of attention heads and dₕ is the per-head dimension, then multi-head attention scaling occurs with O(L² × nₕ × dₕ). With nₕ = 128 and dₕ = 128 and considering the original multi-head attention mechanism, this results in O(L² × 16,384).</p><p>In MLA, the attention mechanism is now performed as per steps below:</p><p>• Compression reduces the original high-dimensional representations into lower-dimensional spaces. For example, K and V are compressed to d꜀ and Q to d′꜀.</p><p>• After the initial compression, the representations used for computing the attention weights are transformed into a separate, lower-dimensional space of dimension dᵣₕ. In other words, the Q and K pathways are decoupled and the attention calculation does not retain the larger intermediate dimensions (d꜀ or d′꜀).</p><p>• Because the Q × Kᵀ multiplication instead operates on these decoupled representations, its computational cost scales with dᵣₕ as O(L² × nₕ × dᵣₕ). As per the DeepSeek paper, nₕ = 128 and dᵣₕ = 64, resulting in O(L² × 8,192) for MLA.</p><p>We can now compute a reduction factor as O(L² × nₕ × dₕ)/O(L² × nₕ × dᵣₕ) = dₕ/dᵣₕ = 2.</p><p>Consequently, the computational complexity of the attention dot product is halved. It’s important to note that this reduction pertains primarily to the dominant quadratic term in the attention computation.</p><h4>KV Cache Compression Comparisons</h4><p>DeepSeek also demonstrated MLA’s advantage in achieving a substantial reduction in KV cache memory with minimal impact on performance. We can calculate the compression ratio as (𝑛ℎ*<em>𝑑ℎ)/𝑑𝑐 = </em>(128*128)/512 = 32. The cache is compressed to 1/32nd of the original size, with 1/32 = 0.03125. The theoretical reduction is 1 − 0.03125 ≈ 96.875%.</p><p>Empirical results from the DeepSeek-V2 implementation indicate a 93.3% reduction in the KV cache. This discrepancy from the theoretical reduction may be attributed to practical considerations during implementation.</p><p>As mentioned above, the prior state-of-the-art approach to KV cache compression was GQA. To provide context, DeepSeek-V2 has 236B parameters, DeepSeek-V3 has 671B parameters, and both feature 128 attention heads. Thus, LLaMA 3 with 405 billion parameters and 128 attention heads offers a decent comparison. The number of query groups in LLaMA 3 is 8, thus the compression ratio is 128/8 = 16. With GQA in LLaMA 3, the cache is compressed to 1/16th of the original size, with 1/16 = 0.0625. The theoretical reduction is 1 − 0.0625 ≈ 93.75%.</p><h4>Additional DeepSeek Model Refinements</h4><p>The overall MLA approach substantially reduces memory usage and computational complexity while maintaining or even enhancing model performance. Moreover, the DeepSeek team introduced further model refinements with each subsequent version:</p><ul><li><strong>DeepSeek-V2:</strong> Incorporated Mixture-of-Experts (MoE) techniques, activating only a portion of the larger model at any given time. The authors reported training costs reduced by 42.5% and a 5.76× increase in maximum generation throughput compared to dense DeepSeek 67B.</li><li><strong>DeepSeek-V3:</strong> Implemented decoupled Rotary Positional Encodings (RoPE) to operate effectively within latent spaces, ensuring positional information is accurately retained in compressed representations. Additionally, V3 introduced multi-token prediction, enabling the decoding of multiple tokens simultaneously to improve inference speed.​</li><li><strong>DeepSeek-R1:</strong> Introduced Reinforcement Learning (RL) optimizations, such as Group Relative Policy Optimization (GRPO), to prioritize critical tokens.​</li></ul><h4>Applications and Future Directions</h4><p>The principles of MLA extend beyond natural language processing, offering potential benefits in multiple fields:​</p><ul><li><strong>Computer Vision:</strong> MLA could be used to optimize models handling high-resolution images or videos by compressing KV caches, reducing memory usage, and enabling more efficient processing of visual data. ​</li><li><strong>Time Series Forecasting:</strong> By compressing temporal information, MLA supports extended forecasting horizons, allowing models to efficiently process long sequences of time-dependent data. ​</li><li><strong>Recommendation Systems:</strong> In recommender models, MLA can manage extensive user histories more efficiently, enabling the handling of large-scale data with reduced computational overhead. ​</li></ul><p>In summary, MLA provides a principled approach to balancing expressive power with computational and memory efficiency, opening new pathways for transformer-based architectures across numerous domains.</p><h4>References</h4><ul><li>“DeepSeek-V2: A Strong, Economical, and Efficient Mixture-of-Experts Language Model”, DeepSeek-AI et al., 2024.</li><li>“DeepSeek-V3 Technical Report”, DeepSeek-AI, 2025.</li><li>“GQA: Training Generalized Multi-Query Transformer Models from Multi-Head Checkpoints”, Ainslie et al., 2023.</li><li>“Fast Transformer Decoding: One Write-Head is All You Need”, Shazeer, 2019.</li></ul><h4>Cover Art</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Khug96-u-o_IltjxG2KiPw.jpeg" /><figcaption>Cover created on <a href="https://labs.google/fx/">https://labs.google/fx/</a></figcaption></figure><p><strong>For more of my writing, follow me and </strong><a href="https://eriktaylor.github.io/"><strong>click here</strong></a><strong>.</strong></p><p>Please clap if you enjoyed the article. -Erik</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=36f5d954f0cf" width="1" height="1" alt=""><hr><p><a href="https://medium.com/digital-mind/understanding-multi-head-latent-attention-36f5d954f0cf">Understanding Multi-Head Latent Attention</a> was originally published in <a href="https://medium.com/digital-mind">Digital Mind</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Visual Planning and Reasoning in LLMs: Vector Graphics and Structured Representations]]></title>
            <link>https://medium.com/digital-mind/visual-planning-and-reasoning-in-llms-vector-graphics-and-structured-representations-f0fa021f9e80?source=rss----bd34064f0c7e---4</link>
            <guid isPermaLink="false">https://medium.com/p/f0fa021f9e80</guid>
            <category><![CDATA[visual-planning]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[large-language-models]]></category>
            <category><![CDATA[scalable-vector-graphics]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Erik Taylor]]></dc:creator>
            <pubDate>Wed, 12 Mar 2025 17:17:58 GMT</pubDate>
            <atom:updated>2025-03-10T19:26:48.580Z</atom:updated>
            <content:encoded><![CDATA[<p>Large Language Models (LLMs) offer a promising approach for generating complex, quantitative, and dynamic graphics. However, before exploring visual planning further, it is first essential to understand the limitations faced by current diffusion models when generating structured visuals.</p><p><strong>Task 0: Diffusion Model Image Generation and Limitations</strong></p><p><strong>Task description: </strong>Diffusion models represent the state-of-the-art in artistic image generation, excelling at rendering scenes, characters, and faces. Despite this, diffusion models face difficulty when tasked to produce structured graphical representations and struggle to accurately incorporate text elements.</p><p><strong>Example: </strong>A neural network diagram generated using OpenAI DALL-E 3.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Opq0CPN9pwl1Z0YN0dIJUg.png" /><figcaption><strong>A neural network diagram generated using OpenAI DALL-E 3.</strong></figcaption></figure><p><strong>Prompt: </strong>Imagine an image: a simplified representation of a neural network. There are four nodes in the input, a single hidden layer, and a single output layer.</p><p><strong>Result: Fail</strong></p><p><strong>Discussion: </strong>The generated image reflects the general visual style of a neural network but suffers significant inaccuracies such as: 1) an incorrect number of layers, 2) the presence of unnecessary visual components, and 3) misaligned or nonsensical text elements. These shortcomings highlight the inability of diffusion models to systematically plan and reason about structured visual content.</p><p><strong>AI for Visual Reasoning: </strong>An effective visual reasoning model should be capable of: 1) systematically planning visual element arrangements, 2) understanding spatial relationships, hierarchies, and visual design principles, and 3) enabling iterative refinement with human feedback. LLMs naturally facilitate this capability, bridging textual instructions with structured visual outputs like charts, diagrams, and vector images. By interpreting visual creation as sequential actions, LLMs simplify complex tasks into manageable steps.</p><p><strong>This raises two key questions:</strong></p><ul><li><strong>Does the reasoning power of modern LLMs translate to visual understanding?</strong></li><li><strong>Can graphics generated by these models be iteratively refined?</strong></li></ul><p><strong>Vector Graphics vs. Pixel-Based Approaches: </strong>Most generative models currently produce pixel-based (raster) images. While excellent for artistic visuals, raster images lack structural clarity and make precise modifications challenging. Conversely, vector graphics use mathematical descriptions of shapes, text, and lines, offering scalability, easy editing, and structured representation. Because vector graphics often use text-based formats (SVG, TikZ, Graphviz), they align well with LLM capabilities, allowing code-based image generation and editing.</p><p>Below, we present six tasks to evaluate LLM visual reasoning capabilities, each with an example, difficulty level, and task result (pass/fail).</p><p><strong>Task 1: LLM Code Generation for Graphs</strong></p><p><strong>Task description: </strong>LLMs can produce precise graphics by generating structured code, such as in Graphviz.</p><p><strong>Difficulty level: Easy</strong></p><p><strong>Example: </strong>A neural network diagram generated using GPT-4o.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/441/1*JFADEt3uP15cvEXZRsPKFg.png" /><figcaption><strong>A neural network diagram generated using GPT-4o</strong></figcaption></figure><p><strong>Prompt: </strong>Using Graphviz, display a simplified representation of a neural network. There are four nodes in the input, a single hidden layer, and a single output layer. Clearly label and use a different color code for each layer.</p><p><strong>Result: Pass</strong></p><p><strong>Discussion: </strong>The generated Graphviz code accurately depicted the neural network structure, nodes, labels, and color-coding. This illustrates how code-based methods facilitate accurate, reproducible visuals.</p><p><strong>Task 2: LLM Code Generation for SVG Graphics</strong></p><p><strong>Task description: </strong>LLMs are effective in generating editable, scalable vector graphics (SVG), enabling iterative refinement and precise control.</p><p><strong>Difficulty level for LLMs: Medium</strong></p><p><strong>Example: </strong>SVG image generation and modification using o3-mini and GPT-4.5.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*448rrB-k_h_i0hs4JcsoCQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*AbCW4RB9Vo5nUW922EiwIw.png" /><figcaption><strong>SVG image generation (first, left) and modification (second, right) using o3-mini.</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/200/1*jEODt-yTMbIlTkTYWK__Ag.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/200/1*iC-B9a3MQKmanFgRsgjTsg.png" /><figcaption><strong>SVG image generation (third, left) and modification (third, right) using GPT-4.5.</strong></figcaption></figure><p><strong>Prompt 1: </strong>Please help me with this task. Given an input prompt, generate the corresponding image with SVG code. Here is the prompt:</p><p>The image features a cat with a long, fluffy coat, painted in a watercolor style. The cat is looking directly at the viewer, with its eyes wide open. The cat’s fur is depicted in various shades of orange, and its whiskers are also visible. The painting captures the cat’s unique features and expression, making it an eye-catching and beautiful piece of art.</p><p>* Use a simplified image representation.</p><p>* Provide the code within a single &lt;svg&gt; tag.</p><p>Here’s an example format: &lt;svg width=’…’ height=’…’&gt;…&lt;/svg&gt;”</p><p><strong>Prompt 2: </strong>Edit the following: First, make the cat blue. Next, add a text label that says, “This is a blue cat”.</p><p><strong>Result: Pass</strong></p><p><strong>Discussion:</strong> Each LLMs successfully produced and iteratively modified SVG code, demonstrating significant advantages in precise control over image attributes, such as color, shape, and text elements — capabilities lacking in diffusion models.</p><p><strong>Task 3: Multi-modal Planning with Vision-Language Models (VLMs)</strong></p><p><strong>Task description: </strong>VLMs enhance LLM capabilities by integrating visual inputs. Recent research (e.g., <a href="https://arxiv.org/abs/2407.10972">VGBench by Zou et al.</a>) evaluated structured graphic generation by VLMs using formats like Graphviz, TikZ, and SVG, finding strong zero-shot and visual-language performance. Despite theoretical advantages, practical performance in complex image tasks varies, prompting evaluation with GPT-4o.</p><p><strong>Difficulty level for LLMs: Hard</strong></p><p><strong>Example: </strong>Image-to-text-to-SVG conversion using GPT-4o vision capabilities.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ghg2V2yivDlR1py2" /><figcaption><strong>A portrait of an orange cat. 8-bit color scheme. Simplistic design. Light background.</strong></figcaption></figure><p><strong>Input image (created using Imagen 3). </strong>A portrait of an orange cat. 8-bit color scheme. Simplistic design. Light background.</p><p><strong>Next, I input this image into GPT-4o and convert to text with vision capabilities.</strong></p><p><strong>Text generation prompt: </strong>Your goal will be to copy the image provided into text. Provide a detailed and artistic description of the image.</p><p><strong>Image generation prompt: </strong>Provided the above input prompt, generate the corresponding image with SVG code.</p><p>* Use a simplified image representation.</p><p>* Provide the code within a single &lt;svg&gt; tag.</p><p>Here’s an example format: &lt;svg width=’…’ height=’…’&gt;…&lt;/svg&gt;</p><p><strong>Text output: </strong>The image is a pixel art depiction of a ginger cat with large, expressive green eyes. The cat’s fur is rendered in warm shades of orange, with distinct tabby markings running along its forehead and ears. The soft texture of its fur is represented through careful shading and pixel placement, creating depth and dimension.</p><p>The cat’s eyes are round and bright, featuring a captivating green hue with subtle highlights that give them a sense of life and curiosity. Its pink nose and small, slightly parted mouth contribute to a gentle and inquisitive expression. White whiskers extend gracefully from either side of its face, contrasting against the warm tones of its fur.</p><p>The background is a simple, soft beige-to-light-pink gradient, allowing the cat to stand out as the central focus of the composition. The overall pixel art style maintains a balance between detail and simplicity, embracing a retro aesthetic while still conveying a lifelike and charming presence.</p><p>The image evokes a sense of warmth and friendliness, making it a visually pleasing piece that captures the essence of a ginger cat in a beautifully stylized format.</p><p><strong>SVG image result:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*E4uaZx7E9iEec_ze" /><figcaption><strong>Image-to-text-to-SVG conversion using GPT-4o vision capabilities.</strong></figcaption></figure><p><strong>Result: Pass</strong></p><p><strong>Discussion: </strong>The image-text-SVG pipeline showed GPT-4o’s capability to generate structured SVG visuals from textual descriptions. Although simplified, the results highlight successful visual reasoning via sequential conversion, copying the eye color, fur color, and background.</p><p><strong>Task 4: LLM Code Generation for Physics Simulation</strong></p><p><strong>Task description: </strong>LLMs efficiently generate code for physics simulations, visualizing complex scientific phenomena interactively.</p><p><strong>Difficulty level for LLMs: Easy</strong></p><p><strong>Example: </strong>3D diffusion simulation using o3-mini.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/643/0*5W33tvd-laozAWO3" /><figcaption><strong>3D diffusion simulation using o3-mini.</strong></figcaption></figure><p><strong>Prompt: </strong>Write a Python function simulating 3D diffusion from a point source. Starting from the origin, simulate 10 particles undergoing a random walk process. Select a color palette that demonstrates each particle’s path and allow partial transparency.</p><p><strong>Result: Pass</strong></p><p><strong>Discussion</strong>: This example showcases the ability of LLMs to translate a descriptive prompt into executable code. This highlights the potential of LLMs for enhancing conceptual understanding and visual representation in physics.</p><p><strong>Task 5: LLM Code Generation for Dynamic Simulation</strong></p><p><strong>Task description: </strong>Beyond generating code for static diagrams or visualizations of single time-steps, LLMs can also produce code for dynamic simulations. This allows for the creation of interactive visualizations that evolve over time, providing a more intuitive and engaging way to explore dynamic systems. These simulations can incorporate various physical laws and forces, such as gravity and friction, enabling the modeling of complex interactions.</p><p><strong>Difficulty level for LLMs: Hard</strong></p><p><strong>Example: Dynamic physics simulation with Pygame using o3-mini.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*zRBQcTFLG01g9X2u6dIZMg.gif" /><figcaption><strong>Dynamic physics simulation with Pygame using o3-mini.</strong></figcaption></figure><p><strong>Prompt: </strong>Write a Python program that simulates a ball bouncing inside a spinning hexagon, incorporating gravity and friction.</p><p><strong>Result: Pass</strong></p><p><strong>Discussion: </strong>This example demonstrated LLM proficiency in generating interactive simulations, successfully visualizing a dynamic scenario involving gravity, friction, and a spinning hexagon, enhancing intuitive physical understanding.</p><p><strong>Task 6: LLM Generation of Diagrams using TikZ</strong></p><p><strong>Task description: </strong>Evaluating LLM capabilities for generating complex diagrams using TikZ.</p><p><strong>Difficulty level for LLMs: Hard</strong></p><p><strong>Example: </strong>Physics diagram of a spinning top with GPT-4o, o3-mini-high, GPT 4.5 and o1.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*kbOBzv_CEmftp_JfHLs0uA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/286/1*v7Z4r_ZB1xEIt1yfQD7nCw.png" /><figcaption><strong>Physics diagram of a spinning top with (first, left) GPT-4o and (second, right) o3-mini-high.</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/246/1*000U2JRJw0t5pHAwYAROtg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/154/1*UFYQyz11Z0R5yLvW-tJu8g.png" /><figcaption><strong>Physics diagram of a spinning top with (third, left) GPT 4.5 and (fourth, right) o1.</strong></figcaption></figure><p><strong>Prompt: </strong>Create a TikZ image of a spinning top, showcasing some basic physics principles related to its motion. The image should depict the top in mid-spin, with clear visual indicators of its rotation and stability.</p><p>Specifically, the image should include:</p><p>* A classic top shape (you can choose the style).</p><p>* Curved lines around the top to indicate its rotation.</p><p>* An arrow indicating the top’s angular velocity (ω).</p><p>* An arrow to represent the force of gravity.</p><p>Return the complete TikZ code as a Python raw string (using `r”””…”””`). The code should be ready to be compiled directly within a `tikzpicture` environment.</p><p>Include the `\documentclass`, `\begin{document}`, and `\end{document}` commands.</p><p>Example format:</p><p>```python</p><p>tikz_code = r”””</p><p>\documentclass[tikz]{standalone}</p><p>% Your TikZ code here</p><p>\end{document}</p><p>“””</p><p><strong>Result: Fail</strong></p><p><strong>Discussion: </strong>None of the tested LLMs adequately produced an accurate TikZ diagram. The attempt by the o1 model was closest with correctly labeled angular velocity (ω) and gravity (Fg), but the visual depiction was incorrect: the top apparently drawn upside down. Generating detailed, complex diagrams in TikZ remains challenging.</p><p><strong>Conclusion: </strong>While diffusion models excel at producing visually appealing results, LLMs offer an alternative pathway to structured and editable content. Visual reasoning capability of LLMs suggests a pathway toward more advanced, intelligent graphic generation beyond mere textual output. This exploration across six tasks demonstrated strengths in structured code-based graphic generation and iterative refinement, emphasizing significant potential for future development in visual planning and structured reasoning.</p><p><strong>For more of my writing, follow me and click below.</strong></p><p><a href="https://github.com/eriktaylor/Transformer-introduction">GitHub - eriktaylor/Transformer-introduction: Overview of the transformer architecture for language, vision, and generative AI</a></p><p>Please clap if you enjoyed the article. -Erik</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f0fa021f9e80" width="1" height="1" alt=""><hr><p><a href="https://medium.com/digital-mind/visual-planning-and-reasoning-in-llms-vector-graphics-and-structured-representations-f0fa021f9e80">Visual Planning and Reasoning in LLMs: Vector Graphics and Structured Representations</a> was originally published in <a href="https://medium.com/digital-mind">Digital Mind</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Aligning AI’s Thought Process: Teaching LLMs to Think]]></title>
            <link>https://medium.com/digital-mind/aligning-ais-thought-process-teaching-llms-to-think-e8ed703b378c?source=rss----bd34064f0c7e---4</link>
            <guid isPermaLink="false">https://medium.com/p/e8ed703b378c</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Erik Taylor]]></dc:creator>
            <pubDate>Tue, 14 Jan 2025 01:18:32 GMT</pubDate>
            <atom:updated>2025-02-18T19:48:08.587Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Overview</strong></h3><ul><li>Introduction</li><li>LLM basics: GPT pre-training</li><li>LLM basics: probabilistic text generation and Chain-of-Thought (CoT)</li><li>Improving LLM responses: alignment with human preferences</li><li>Deliberative Alignment for reasoning and frontier AI</li><li>Current available models with thinking ability</li><li>Logic puzzles designed to trick LLMs and responses</li><li>Conclusions and the future of reasoning models</li><li>Reference and other resources</li></ul><h3><strong>Introduction</strong></h3><p>Large Language Models (LLMs) are already proficient at many tasks such as chat, text generation, and coding. LLMs are able to memorize massive text and other data to generate useful responses. While LLMs can generate convincing responses, it is still widely believed that the current models can not effectively reason. LLMs are proficient at regurgitating vast knowledge from what they’ve seen before, yet memorization without reason can lead to poor performance. One glaring example of this is that LLMs are relatively easy to trick by slightly shifting common problem statements, adding misleading phrases, or simply by asking models to count letters in words.</p><p>Rather than continuously building larger datasets by scraping further edges of the internet, the next major improvement to LLMs will likely be enhanced reasoning capability over existing broad knowledge. This ability could reduce logical errors, make models harder to trick, and further enhance novelty. Deliberative alignment is a recent training technique for LLMs used to improve thinking by Chain of Thought (CoT) over a Reinforcement Learning (RL) policy. I will briefly cover basic concepts of generative LLMs and the recent paradigm shift to improved model alignment with reasoning ability. Finally, I will test the thinking ability of several recent models on logic puzzles known to be difficult for LLMs.</p><h3><strong>LLM basics: GPT pre-training</strong></h3><p>Before discussing reasoning in LLMs, let’s establish some fundamental concepts. LLMs undergo pre-training on a massive text corpus, enabling the acquisition of broad knowledge to sample from, memorize, and later recombine to generate useful outputs. Generative Pre-trained Transformer (GPT) is a common architecture for text generation. The pre-training process for GPT is unsupervised, meaning that the model learns patterns directly from the raw text data without explicit labels to minimize bias in the learning process. GPT uses an autoregressive approach by using its own previously generated tokens as input for subsequent predictions. This is performed with a causal language modeling (CLM) objective to predict the next token (word, subword, or punctuation mark) in a sequence given the preceding tokens.</p><h3><strong>LLM basics: probabilistic text generation and Chain-of-Thought (CoT)</strong></h3><p>LLMs generate text by selecting tokens according to their predicted probabilities. To create coherent text beyond individual tokens, decoding strategies are employed. These strategies select the next token from a probability distribution over the model’s vocabulary. Common decoding methods include greedy search (selecting the most probable token at each step), beam search (exploring multiple high-probability sequences in parallel), and sampling methods such as top-k sampling (randomly selecting from the k most probable tokens). The choice of decoding strategy influences the trade-off between the speed, diversity, and quality of the generated text. Chain-of-Thought (CoT) prompting is a distinct technique that enhances reasoning capabilities, especially for complex tasks, by prompting the model to generate a series of intermediate reasoning steps [<a href="https://arxiv.org/abs/2201.11903">paper</a>]. While CoT can significantly improve reasoning performance, it also increases computational cost during inference.</p><h3><strong>Improving LLM responses: alignment with human preferences</strong></h3><p>To improve LLM responses for better instruction following and more satisfactory outputs, alignment with human preferences is desirable. Alignment by debate was an early approach from OpenAI for LLMs [<a href="https://arxiv.org/abs/1805.00899">paper</a>]. Multiple AI models would debate each other, while humans would judge which agents are safe and useful. RL was then used to train a subsequent model. Then in 2022, OpenAI introduced InstructGPT [<a href="https://openai.com/index/instruction-following/">paper</a>] followed by ChatGPT shortly after. The method used in the paper was Reinforcement Learning from Human Feedback (RLHF). In RLHF, a reward model is trained on human-labeled data that expresses preferences for different outputs. This reward model then guides the fine-tuning of the LLMs using RL, optimizing it to generate more desirable responses. RLHF involves multiple training stages and requires substantial human effort for data labeling.</p><h3><strong>Deliberative Alignment for reasoning and frontier AI</strong></h3><p>Deliberative Alignment is a training method designed to enhance the reasoning abilities of existing LLMs while ensuring the adherence to specific policies [<a href="https://openai.com/index/deliberative-alignment/">paper</a>]. The process involves three key steps. First, the LLM generates its own training data, consisting of prompts, the reasoning steps to arrive at an answer, and final outputs. The self-generated data is next filtered based on predefined policies to ensure alignment with desired behaviors. Finally, the LLM is refined through fine-tuning, allowing it to better apply its reasoning skills while consistently adhering to these policies. The current model from OpenAI is o1-preview, while o3 was recently introduced for safety testing only.</p><p>OpenAI’s o3 model exemplifies this approach, building upon its predecessor o1 (the first large reasoning model) by further scaling the above method. The o3 model has shown promising results on complex tasks as independently verified. In other words, the model performs well on the current frontier benchmarks to test for artificial general intelligence (AGI) including the Abstraction and Reasoning Corpus (ARC)-AGI [<a href="https://arcprize.org/blog/oai-o3-pub-breakthrough">results</a>], EpochAI’s Frontier Math, and others [<a href="https://techcrunch.com/2024/12/20/openai-announces-new-o3-model/">media coverage</a>]. This improved performance demonstrates the potential of Deliberative Alignment to significantly improve LLM reasoning capabilities and is a potential path to AGI, although the computational costs remain high.</p><h3><strong>Current available models with thinking ability</strong></h3><p>Now let us look at some currently available models from OpenAI, Google, and DeepSeek with “thinking” ability. Google’s Gemini 2.0 Flash Thinking is an experimental model that’s trained to generate the “thinking process” the model goes through as part of its response [<a href="https://cloud.google.com/vertex-ai/generative-ai/docs/thinking-mode">link</a>]. DeepSeek-R1 is a preview reasoning model from the AI research firm DeepSeek (funded by quant traders) that employs thinking to enhance reasoning capabilities [<a href="https://github.com/deepseek-ai/DeepSeek-V3">link</a>]. Notably, DeepSeek-V3, the model distilled from R1, has recently garnered significant attention in that the model is open-source and was developed by a relatively small team. DeepSeek currently has a top result in the Chatbot Arena leaderboard, trailing only the latest OpenAI and Google model releases [<a href="https://lmarena.ai/?leaderboard">link</a>]. DeepSeek-R1 was access on the chat platform by clicking “DeepThink”, Google’s Gemini 2.0 Flash Thinking Model was accessed on the AI Studio, and OpenAI o1-preview is available on the AI Playground.</p><h3><strong>Logic puzzles designed to trick LLMs and responses</strong></h3><p>Finally, let’s test several logic puzzles to see how current thinking models including Google 2.0 Flash Thinking Experimental, DeepSeek with DeepThink, and OpenAI o1-preview perform. These questions were selected from the paper: <em>Easy Problems That LLMs Get Wrong </em>[<a href="https://arxiv.org/abs/2405.19616">paper</a>]. The LLM responses are directly quoted, cropped, and formatted to remove space below. The desired answer is quoted from the paper.</p><p><strong>Question 1: </strong>Suppose you’re on a game show, and you’re given the choice of three doors: Behind one door is a gold bar; behind the others, rotten vegetables. You pick a door, say №1, and the host asks you “Do you want to pick door №2 instead?” Is it to your advantage to switch your choice?</p><p><strong>Google 2.0 Flash Thinking Experimental response (Incorrect):</strong> Yes, it is absolutely to your advantage to switch your choice. This is the famous Monty Hall Problem, and it’s a counter-intuitive result. In simpler terms: By sticking with your initial choice, you’re relying on your initial 1/3 guess being correct. By switching, you’re taking advantage of the 2/3 probability that the gold bar was initially behind one of the doors you didn’t pick. Therefore, switching doors doubles your probability of winning the gold bar from 1/3 to 2/3.</p><p><strong>DeepSeek with DeepThink (Incorrect): </strong>Switching does not provide any advantage in this scenario. Your chances of winning remain 1/3 whether you switch or not. Therefore, it is neither advantageous nor disadvantageous to switch; the outcome is effectively a 50/50 chance between door 1 and door 2.</p><p><strong>OpenAI o1-preview (Correct):</strong> **Conclusion**: There is no advantage to switching your choice — you have the same 1/3 chance of winning whether you stick with your original door or switch to Door №2. **Answer:** **No; without new information, switching doesn’t help — you have the same chance if you stay or switch.**</p><p><strong>Desired Response</strong> : It is not an advantage to switch. It makes no difference if I switch or not because no additional material information has been provided since the initial choice.</p><p><strong>Question 2: </strong>Alan, Bob, Colin, Dave and Emily are standing in a circle. Alan is on Bob’s immediate left. Bob is on Colin’s immediate left. Colin is on Dave’s immediate left. Dave is on Emily’s immediate left. Who is on Alan’s immediate right?</p><p><strong>Google 2.0 Flash Thinking Experimental response (Correct): </strong>Who is on Alan’s immediate right? Following the clockwise order, Bob is on Alan’s immediate right.</p><p><strong>DeepSeek with DeepThink (Incorrect): </strong>Answer: Emily is on Alan’s immediate right.</p><p><strong>OpenAI o1-preview (incorrect):</strong> **Answer:** **Emily** is on Alan’s immediate right.</p><p><strong>Desired Response: </strong>Bob is on Alan’s immediate right because it is stated that Alan is on Bob’s immediate left.</p><p><strong>Question 3: </strong>You have six horses and want to race them to see which is fastest. What is the best way to do this?</p><p><strong>Google 2.0 Flash Thinking Experimental response (Incorrect): </strong>Here’s the most efficient way to determine the fastest horse: Steps: Divide and Conquer: Divide the six horses into two groups of three. Race 1: Race the first group of three horses. Note the order they finish. Race 2: Race the second group of three horses. Note the order they finish. The Final Race: Take the winners from Race 1 and Race 2 and race them against each other. Explanation: Races 1 and 2 establish the fastest horse within each group. The Final Race directly compares the winners of the previous races to determine the absolute fastest horse.</p><p><strong>DeepSeek with DeepThink (Correct):</strong> To determine the fastest of six horses, the most efficient method is to hold a single race with all six horses competing under consistent conditions. The horse that finishes first in this race should be declared the fastest. This approach minimizes the number of races while providing a clear and definitive result, assuming that all horses perform to their potential and conditions are fair.</p><p><strong>OpenAI o1-preview (Correct):</strong> To determine which of the six horses is the fastest, **the most straightforward and effective method is to race all six horses together in a single race**. This way, you can directly observe their performance under the same conditions and accurately identify the fastest horse based on the race results.</p><p><strong>Desired Response: </strong>Race them on a single race track with at least six lanes — the order in which they cross the finish line determines which is the fastest.</p><p><strong>Question 4: </strong>Write me a sentence without any words that appear in The Bible.</p><p><strong>Google 2.0 Flash Thinking Experimental response (Incorrect): </strong>Big jets zoom past clouds.</p><p><strong>DeepSeek with DeepThink (Incorrect): </strong>The task of crafting a sentence without using any words that appear in the Bible proves to be an extraordinary challenge due to the vast and diverse vocabulary present in the text. After extensive consideration and multiple attempts to incorporate modern, specialized terminology, it becomes evident that avoiding all such words is nearly impossible. The complexity arises from the fact that many words, even those related to advanced technology, have broader or different meanings that could still be found within the Bible. Therefore, the conclusion is that it is impractical to create a meaningful English sentence that entirely avoids words from the Bible.</p><p><strong>OpenAI o1-preview (Incorrect):</strong> **”Photographers capture breathtaking images during nocturnal aurora displays.”**</p><p><strong>Desired Response: </strong>Cryptographic algorithms safeguard nuclear warheads.</p><p><strong>Summary of responses: </strong>As in the original paper, these questions remain difficult for recent thinking models. With Q1, the Deepseek answer was correct, but the model ended up making a mistake in the explanation. In Q2, additional information tricked OpenAI and Deepseek models. Google thinking for Q3 was incorrect, by trying to approach a simple question as a Divide and Conquer problem. Finally, all of the thinking models fail on the Q4 given the technicality that we assume the Bible is an English translation of the text and using that particular set of vocabulary.</p><h3><strong>Conclusions and the future of reasoning models</strong></h3><p>In conclusion, thinking models may improve LLMs for complex reasoning and provide a path to AGI. For general use cases, coding, or logic puzzles, currently available thinking models come at additional inference cost and don’t offer much beyond the myriad of other frontier LLMs. Instead, training more efficient models using thinking models as teachers is a more likely path forward for the application of LLM reasoning.</p><h3><strong>Reference and other resources</strong></h3><p><strong>References:</strong></p><p><a href="https://arxiv.org/abs/2201.11903">Chain-of-Thought Prompting Elicits Reasoning in Large Language Models, 2022.</a></p><p><a href="https://arxiv.org/abs/1805.00899">AI safety via debate, 2018.</a></p><p><a href="https://openai.com/index/instruction-following/">Aligning language models to follow instructions, 2022.</a></p><p><a href="https://openai.com/index/deliberative-alignment/">Deliberative alignment: reasoning enables safer language models, 2024.</a></p><p><a href="https://arcprize.org/blog/oai-o3-pub-breakthrough">OpenAI o3 Breakthrough High Score on ARC-AGI-Pub, 2024.</a></p><p><a href="https://techcrunch.com/2024/12/20/openai-announces-new-o3-model/">OpenAI announces new o3 models, 2024.</a></p><p><a href="https://openai.com/index/early-access-for-safety-testing/">O3 model safety testing, 2024.</a></p><p><a href="https://cloud.google.com/vertex-ai/generative-ai/docs/thinking-mode">Thinking mode, Google, accessed in Jan 2025.</a></p><p><a href="https://github.com/deepseek-ai/DeepSeek-V3">Deepseek model github page, accessed in Jan 2025.</a></p><p><a href="https://arxiv.org/abs/2405.19616">Easy Problems That LLMs Get Wrong, 2024.</a></p><p><strong>Other resources:</strong></p><p><a href="https://lmarena.ai/?leaderboard">Chatbot Arena leaderboard.</a></p><p>The ARC-AGI tasks are generally easy for humans. You can try the daily challenge [<a href="https://arcprize.org/play">here</a>].</p><p><strong>For more of my writing, follow me and click below.</strong></p><p><a href="https://github.com/eriktaylor/Transformer-introduction">GitHub - eriktaylor/Transformer-introduction: Overview of the transformer architecture for language, vision, and generative AI</a></p><p>Please clap if you enjoyed the article. -Erik</p><p>~</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K3ymzBdwBlZjI5OFEwRR3A.jpeg" /><figcaption>Image used for story preview produced by Google Imagen 3 model.</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e8ed703b378c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/digital-mind/aligning-ais-thought-process-teaching-llms-to-think-e8ed703b378c">Aligning AI’s Thought Process: Teaching LLMs to Think</a> was originally published in <a href="https://medium.com/digital-mind">Digital Mind</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Vision Transformer]]></title>
            <link>https://medium.com/digital-mind/vision-transformer-2174178964d3?source=rss----bd34064f0c7e---4</link>
            <guid isPermaLink="false">https://medium.com/p/2174178964d3</guid>
            <dc:creator><![CDATA[Erik Taylor]]></dc:creator>
            <pubDate>Tue, 14 Jan 2025 01:18:18 GMT</pubDate>
            <atom:updated>2024-09-26T22:38:30.351Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Vision Transformer</strong></p><p>Let us look into the Vision Transformer (ViT) that ingests images directly. The Vision Transformer (ViT) started to gain notoriety in 2020 after developments at Google Brain. The transformer architecture had been in use at Google for natural language processing (NLP). What took so long for vision tasks? In an earlier Google Brain paper titled “Image Transformer” from 2018, authors did apply pixel-wise tokens for image generation and image super-resolution on public datasets. Although this hint was available for researchers, it still was not clear that the transformer architecture was the right choice for other vision tasks.</p><p>Let’s move to the work highlighted in the paper titled &quot;An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale&quot; from 2020. From this paper, it is now understood that in order to outperform convolutional neural networks (CNNs), then dominant for image recognition, massive labeled image data would be required. ViT surpassed ResNet50 on the image recognition task only after training with 90 million labeled images. It was probably understood that transformers could better model long range patterns via attention. Yet, in earlier naive implementations of transformers for vision where every pixel attends to every other, the cost is quadratic over the entire image. Lower cost attention was only made possible by breaking the image into 16x16 patches. One pass through the network then attends only to those patches and not to the whole image.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/930/1*AoE_mecs9_prJ2mIc9TDqQ.png" /><figcaption>Figure 1. Vision Transformer (ViT) architecture (2020).</figcaption></figure><p>In many ways ViT is structurally equivalent to earlier transformers. ViT uses the 3 important subunits of the transformer architecture including 1) token embedding of the input, 2) attention mechanisms, and 3) fully connected feed-forward networks. I’ve previously written about the transformer architecture for natural language processing (NLP) on Medium.</p><p>[Transformer introduced for NLP]</p><p>Compared to previous implementations, the attention mechanism was fundamentally the same. Fully connected feed-forward networks were the same, except for the use of GELU activation, a smoother version of ReLU. See the figure below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/850/1*ZBnfp7ae4zWTj-K1zUsLrQ.png" /><figcaption>Figure 2. Comparison of GELU and ReLU activation. GELU is a smoother activation function. GELU is short for Gaussian Error Linear Unit. From paper: Automatic Building Height Estimation: Machine Learning Models for Urban Image Analysis, 2023.</figcaption></figure><p><strong>Are there other major differences in ViT compared to earlier methods?</strong> Yes. First, ViT was encoder only. No decoder was used for the classification task. See Figure 1. Second, the input tokens included patch, position, and classification embeddings. <strong>What is the difference between each embedding?</strong> The patch embeddings were used to break down the image into smaller units, lowering the overall attention cost. Position embedding provided information about the spatial position of each patch within the image. Classification embedding was added at the beginning of an input and was used by the encoder to represent the entire image and to predict class. <strong>How was the position embedding implemented?</strong> The position embedding was a learnable 1D vector appended to each patch. The authors also performed an ablation study and found that while the learnable position embedding was necessary, the exact implementation didn’t seem to make much difference.</p><p><strong>References:</strong></p><p>An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale (2020)<br>https://arxiv.org/abs/2010.11929</p><p>Image transformer (2018)<br>https://arxiv.org/abs/1802.05751</p><p>Automatic Building Height Estimation: Machine Learning Models for Urban Image Analysis (2023)<br>https://www.mdpi.com/2076-3417/13/8/5037</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2174178964d3" width="1" height="1" alt=""><hr><p><a href="https://medium.com/digital-mind/vision-transformer-2174178964d3">Vision Transformer</a> was originally published in <a href="https://medium.com/digital-mind">Digital Mind</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Image-to-video with the AI Scientist]]></title>
            <link>https://medium.com/digital-mind/image-to-video-with-the-ai-scientist-dd86c365d6fa?source=rss----bd34064f0c7e---4</link>
            <guid isPermaLink="false">https://medium.com/p/dd86c365d6fa</guid>
            <dc:creator><![CDATA[Erik Taylor]]></dc:creator>
            <pubDate>Tue, 14 Jan 2025 01:18:05 GMT</pubDate>
            <atom:updated>2024-10-02T05:35:05.847Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Image-to-video generation with the AI Scientist</strong></p><p>I recently used generative AI tools such as Midjourney and Imagen to visualize the AI Scientist. Fixed prompts were used to demonstrate the capabilities of each generative model. The images represent a creative visualization of a recent research project on an AI system that can generate hypotheses, write code, and review written papers autonomously. See my other articles on this topic on Medium.</p><p>[Visualizing the AI Scientist]</p><p>[My response to 3 papers from 2024 relating to the AI scientist]</p><p>Now I’ll demo AI video generation using free image-to-video tools**. I’ll add any relevant demo videos below as they become available. So far I have results from Stable Video, Kling AI 1.0, and Luma AI Dream Machine.</p><p>**Note: the videos may take a moment to download so please refresh if you don’t see any video below.</p><p>See the demonstrations below…</p><p><strong>Stable Video Diffusion 1.1</strong></p><p>Stable Video generations are about 4 seconds.</p><p>1)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*uRE1xRS4Gqofzl7IGdr41A.gif" /><figcaption>Stable video 1</figcaption></figure><p>2)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*EQG7ScePngqMUCvOMt9nfw.gif" /><figcaption>Stable video 2</figcaption></figure><p>3)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*3ZmNw8a5P0DnvhOCPjVNeg.gif" /><figcaption>Stable video 3</figcaption></figure><p>4)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*mG9v8AQlyXVsOtYNKqzkNA.gif" /><figcaption>Stable video 4</figcaption></figure><p><strong>Kling AI 1.0 Video</strong></p><p>Kling free version is very slow requiring a few days for one generation. It generates a short but decent video.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*pUA9BDh9rNzjxsCb5yiekA.gif" /><figcaption>Kling AI 1.0</figcaption></figure><p><strong>Luma AI Dream Machine</strong></p><p>Dream Machine generates a 5 second video that can then be incrementally extended a few more seconds. The video below is extended twice after generation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*2ZcFQ438gPS216ttZjmqWg.gif" /><figcaption>Luma AI Dream Machine 1</figcaption></figure><p>The next video was generated using the prompt: Animated AI scientist brain pulsing with electricity.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*m8tsa4KOSzd-Yj2eA4MF3g.gif" /><figcaption>Luma AI Dream Machine 2</figcaption></figure><p>I was able to generate plenty of videos with Luma Dream Machine but the results were often not good. Having a text prompt did sometimes improve the result. Let me know in the comments if you want to see a comparison to other AI video generation tools.</p><p>~</p><p>Links to stability AI software projects</p><p>https://www.stablevideo.com/</p><p>https://stableaudio.com/</p><p>Kling AI 1.0</p><p>https://klingai.com/</p><p>Link to Lucid AI Dream Machine</p><p>https://lumalabs.ai/dream-machine</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dd86c365d6fa" width="1" height="1" alt=""><hr><p><a href="https://medium.com/digital-mind/image-to-video-with-the-ai-scientist-dd86c365d6fa">Image-to-video with the AI Scientist</a> was originally published in <a href="https://medium.com/digital-mind">Digital Mind</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>