<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Charles Curt on Medium]]></title>
        <description><![CDATA[Stories by Charles Curt on Medium]]></description>
        <link>https://medium.com/@charles.curt?source=rss-f8a9438f1510------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*VUYnUNRST882Wrgp</url>
            <title>Stories by Charles Curt on Medium</title>
            <link>https://medium.com/@charles.curt?source=rss-f8a9438f1510------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 01:56:33 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@charles.curt/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Why AI Agents Fail in Regulated Industries (And the Missing Layer That Fixes It)]]></title>
            <link>https://medium.com/@charles.curt/why-ai-agents-fail-in-regulated-industries-and-the-missing-layer-that-fixes-it-7436483f651f?source=rss-f8a9438f1510------2</link>
            <guid isPermaLink="false">https://medium.com/p/7436483f651f</guid>
            <category><![CDATA[privacy]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[data-privacy]]></category>
            <category><![CDATA[data-protection]]></category>
            <dc:creator><![CDATA[Charles Curt]]></dc:creator>
            <pubDate>Wed, 29 Oct 2025 21:10:28 GMT</pubDate>
            <atom:updated>2025-10-29T21:10:28.378Z</atom:updated>
            <content:encoded><![CDATA[<p>You built an amazing AI agent. It handles customer service perfectly in demos. It processes claims faster than any human. It navigates complex workflows with ease.</p><p>Then you try to sell it to a hospital. Or a bank. Or an insurance company.</p><p>And everything stops.</p><p>Not because your agent isn’t good enough. Because they won’t let it see the data it needs to work.</p><h3>The Wall Every AI Company Hits</h3><p>According to Cloudera’s 2025 Enterprise AI Report, 53% of organizations identify data privacy as their primary concern blocking AI agent implementation surpassing technical integration challenges, deployment costs, and every other obstacle.</p><p>Think about what your agent needs to do its job:</p><p><strong>Customer service agent?</strong> Needs to see account numbers, addresses, transaction history, SSNs.</p><p><strong>Claims processing agent?</strong> Needs to access policy details, medical records, claim amounts, personal information.</p><p><strong>Healthcare documentation agent?</strong> Needs to read patient charts, see diagnoses, access protected health information.</p><p><strong>Back-office automation agent?</strong> Needs to process forms with real customer data across multiple systems.</p><p>The enterprise says: “Absolutely not. That data is too sensitive. We can’t give an AI agent access to that.”</p><p>And they’re right to be concerned. One data breach, one hallucination that leaks a customer’s SSN, one compliance violation it’s catastrophic.</p><h3>Why Current “Solutions” Don’t Actually Work</h3><p>You’ve probably tried to work around this:</p><p><strong>“We’ll use synthetic data for training”</strong><br> Problem: Synthetic data doesn’t capture real-world complexity. Your agent learns patterns that don’t exist in production. It works in testing, fails in reality.</p><p><strong>“We’ll limit the agent’s data access”</strong><br> Problem: Now your agent is crippled. It can’t complete workflows because it doesn’t have the information it needs. You’re selling a handicapped product.</p><p><strong>“We’ll implement strong security measures”</strong><br> Problem: Enterprises don’t care. The risk is still there. Their compliance team still says no. “Trust us, we’re secure” doesn’t work in healthcare or finance.</p><p><strong>“We’ll anonymize the data post-hoc”</strong><br> Problem: Your agent still saw the real data during processing. That’s the risk they won’t accept.</p><p>None of these solve the fundamental problem: <strong>AI agents operate at the interface layer they see what’s on screen and that’s where sensitive data lives.</strong></p><h3>The Missing Layer</h3><p>Here’s what nobody’s building: a layer between the agent and the sensitive data that operates in real-time at the interface level.</p><p>Think about how your AI agent actually works. It doesn’t query databases directly. It looks at screens, reads forms, clicks buttons, navigates interfaces. Just like a human does.</p><p>What if everything your agent saw was a functional placeholder?</p><p>Not “Jane Doe” → but “Sarah Martinez”<br> Not “SSN: 123–45–6789” → but “SSN: 847–29–3021”<br> Not “Account #4829…” → but “Account #7341…”</p><p>But here’s the key: these placeholders <strong>work identically to real values</strong>. Your agent can search for “Sarah Martinez,” copy that account number, paste it into another system, validate it, process the workflow everything functions perfectly.</p><p>The underlying systems see and process the real data. Your agent sees and works with placeholders. The workflow is identical.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D4wqzHo8LClPO1-9txXUEA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ecVQmG8FkwvXBFUGhbw64A.png" /></figure><h3>Why This Actually Changes Things</h3><p>This isn’t just better security theater. It’s architectural.</p><p><strong>For training:</strong> You can record real workflows from sensitive industries. Workers use the same masked interface. After destroying the mapping, you have genuine workflow recordings with zero sensitive data. Healthcare workflows. Banking operations. Insurance processing. All recordable for the first time.</p><p><strong>For deployment:</strong> Your agent operates through the same layer in production. Training environment and deployment environment are identical. No distribution shift. What it learned is what it does.</p><p><strong>For sales:</strong> Your pitch becomes: “Our agent never sees real SSNs, account numbers, or PHI. By design, not by policy. It’s architecturally unable to expose sensitive data.”</p><p>That’s a conversation enterprises will actually have.</p><h3>The Real Opportunity</h3><p>Right now, massive markets are essentially closed to AI agents:</p><ul><li>Healthcare operations (prior auth, medical coding, patient scheduling)</li><li>Financial services (customer service, fraud detection, transaction processing)</li><li>Insurance (claims processing, underwriting support, policy administration)</li><li>Government services (benefits processing, application handling)</li></ul><p>These aren’t small markets. They’re multi-billion dollar opportunities where organizations desperately want AI agents but can’t figure out how to deploy them safely.</p><p>The companies that solve the data access problem will own these markets.</p><h3>This Is The Infrastructure Layer</h3><p>You don’t need to build this yourself. Just like you don’t build your own auth system or payment processing, you don’t need to build interface-layer data masking.</p><p>You need to integrate with it.</p><p>Think about the positioning: Instead of fighting the “we can’t give AI access to sensitive data” objection, you eliminate it. Your agent works through a layer that makes data exposure architecturally impossible.</p><p>Suddenly, healthcare companies take your calls. Banks move you past their compliance reviews. Insurance companies start pilots.</p><h3>What’s Next</h3><p>If you’re building AI agents for regulated industries, you’re either solving this problem or you’re hitting this wall. There’s no middle ground.</p><p>The companies that figure out how to deploy agents in healthcare, finance, and insurance without exposing sensitive data will capture markets that are currently locked.</p><p>The infrastructure layer exists. The question is whether you’ll integrate it before your competitors do.</p><p><strong>Building AI agents for regulated industries?</strong> I’ve been working on this problem for the past year. If you’re hitting the data access wall, I’d love to share what I’ve learned. Reach out: charles@redactsure.com or <a href="https://redactsure.com/">book a 15-min call</a>.</p><p>The technology is called UI Encryption, and it’s operational today. But this post isn’t about the tech it’s about the problem every AI company is hitting. Let’s figure out if this applies to what you’re building.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7436483f651f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Forever AI Agent]]></title>
            <link>https://medium.com/@charles.curt/the-forever-ai-agent-438e480dc9fc?source=rss-f8a9438f1510------2</link>
            <guid isPermaLink="false">https://medium.com/p/438e480dc9fc</guid>
            <dc:creator><![CDATA[Charles Curt]]></dc:creator>
            <pubDate>Fri, 03 May 2024 21:15:42 GMT</pubDate>
            <atom:updated>2025-01-31T22:40:51.229Z</atom:updated>
            <content:encoded><![CDATA[<p>How do we build the true autonomous agent we dream of?</p><p>In this discussion, I’ll review my research and others, then combine them all into a system trying to meet the objective of a true forever agent.</p><p>I do not claim to have completed my work. I only argue that this is the path to our shared goal. If you’re interested, I would like your support and thoughts.</p><p>charles@sliced-ai.com</p><h3>Defining agency</h3><p>I’ll make this simple. The definition of agency in AI models is identical to that given to natural systems. A mouse is a perfect mouse agent, forever a mouse, forever following the task of a mouse. Humans do this, but on arbitrary tasks, software engineers do not forget their primary tasks, and they certainly don’t work so long that they forget they are software engineers.</p><h3>Why can’t this work now?</h3><p>We are building agent systems in a near-impossible manner to achieve this infinite agentic task described above. We are following the hard path of this. Let’s talk about two research projects I built to frame this.</p><ul><li><a href="https://medium.com/@charles.curt/llm-meetings-a-study-on-multi-agent-coherency-cee91fd663b2">A study on an AI agent meeting with gpt3</a></li><li><a href="https://medium.com/@charles.curt/llm-agent-depth-coherence-study-incomplete-547a4dcd289a">A study on Agent task coherence with the original llama</a></li></ul><p>In these, I work on how AI agents behave and fail. The main findings are the following.</p><blockquote><em>1. Context is lost reasoning</em></blockquote><blockquote><em>2. An AI agents autonomous task coherence is nearly an exponential compute problem as recursion increases.</em></blockquote><p>I won’t explain these as we have a lot more to go, and my other writings have done that already. I wrote two articles to help you better understand these ideas.</p><ul><li><a href="https://medium.com/@charles.curt/strong-vs-weak-ai-agents-b9f7e2379ba9">An article on context is lost reasoning</a></li><li><a href="https://medium.com/@charles.curt/why-dont-our-heads-explode-thinking-about-stop-signs-and-my-thoughts-on-squirrels-fe5e997440e1">An article on agent recursive depth issue</a></li></ul><p>Ok, now I assume you understand the above and why achieving our infinite autonomous agent goal is nearly impossible with current methods. It may be achievable, but the computational cost will be massive beyond belief.</p><h3>Understanding the forever agent</h3><p>So, let’s start with some external research. The first step in understanding the solution.</p><h3>Continual Learning</h3><p>The true goal and solution combining the above concepts are straightforward. Create an AI agent that continually learns, reducing the context needed per step and allowing <em>more powerful reasoning per step</em> as depth increases.</p><ul><li><a href="https://arxiv.org/abs/1802.07569">A review of CL</a></li></ul><p>I don’t want to go too deep into CL and its techniques, but it suffices to say it’s an unsolved problem. I have some thoughts I’ll add nearer to the solution.</p><p>So, what’s the main problem in achieving an AI agent that follows CL?</p><h3>Model Collapse &amp; Forgetting</h3><ul><li><a href="https://arxiv.org/abs/1612.00796">Overcoming catastrophic forgetting in neural networks</a></li><li><a href="https://arxiv.org/abs/2307.01850">Self-Consuming Generative Models Go MAD</a></li><li><a href="https://arxiv.org/abs/2205.10487">Scaling Laws and Interpretability of Learning from Repeated Data</a></li><li><a href="https://arxiv.org/abs/2305.17493v2">The Curse of Recursion: Training on Generated Data Makes Models Forget</a></li></ul><p><strong>So, what we learned from these papers is the following:</strong></p><ul><li>An AI model cannot train on purely synthetic data forever. There is a <em>limit and a ratio that is positive</em>, but a pure model will eventually damage the model’s general ability.</li></ul><p><strong>What we can extrapolate from this:</strong></p><ul><li>Fine-tuning for a specific task damages the model’s general ability as your dataset is not as broad as the original.</li><li>Synthetic data is a subsample of the model with error, errors compound.</li></ul><p><strong>A deep question arises:</strong></p><p>How do natural systems not fail given synthetic data? Dreams are synthetic data, we don’t collapse. However, we do hallucinate, given a lack of stimulus.</p><ul><li><a href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4354964/">Predicting Psychotic-Like Experiences during Sensory Deprivation</a></li></ul><p>Hmmmmm…….Interesting!</p><h3>Collapse and Forgetting has always been a secret positive</h3><p>We have always tried to prevent these systems from collapsing, but what if I told you that it’s actually a good thing? On top of that, I argue that it is deeply natural for these systems to forget.</p><p><strong>Forgetting is a good thing:</strong></p><ul><li><a href="https://www.nature.com/articles/s41586-024-07367-3">Sleep pressure modulates single-neuron synapse number in zebrafish</a></li><li><a href="https://pubmed.ncbi.nlm.nih.gov/32029629/">A natural part of the human brain</a></li><li><a href="https://arxiv.org/abs/2202.00155">Fortuitous Forgetting in Connectionist Networks</a></li><li><a href="https://arxiv.org/abs/2307.01163">Improving Language Plasticity via Pretraining with Active Forgetting</a></li></ul><p>The last one is particularly impactful. An LLM learning language translation has shown some interesting promise, this sounds familiar!</p><p>Now, how do we combine model collapse and forgetting in an LLM?</p><h3>Ratio is king</h3><p>You’ll notice something reading over enough model collapse and synthetic data papers, which is a subtle point. One this paper below more explicitly discusses.</p><ul><li><a href="https://arxiv.org/abs/2404.01413v2">Is Model Collapse Inevitable? Breaking the Curse of Recursion by Accumulating Real and Synthetic Data</a></li></ul><p>There is something interesting to learn here. A ratio of synthetic data and more general data does not cause model collapse with all types of models, not just LLM.</p><p><strong>Did you catch it? Let’s change a word.</strong></p><blockquote><em>A ratio of non-general data and more general data does not cause model collapse with all types of models, not just LLM.</em></blockquote><p>So we can make models that don’t collapse, and that’s good, how is that an agent?</p><h3>Creating a strong agent</h3><p>How might you try to inject strong agency into your AI? Well, I’ll tell you right now what does this damn near perfectly.</p><p><strong>Reinforcement Learning (RL)</strong></p><p>Let’s drop the classics for your enjoyment</p><ul><li><a href="https://www.nature.com/articles/nature14236">Human-level control through deep reinforcement learning</a></li><li><a href="https://arxiv.org/abs/1803.10122">World Models</a> (my favorite, talks about dreams)</li><li><a href="https://arxiv.org/abs/1312.5602">Playing Atari with Deep Reinforcement Learning</a></li></ul><p>Why does this work so well? In the framework of our discussion, the reasoning is that this works because the model is deeply tuned into the problem. It literally cannot behave outside of its training, which is entirely about one task.</p><p>Cool system and clearly a component we need, but it has two flaws:</p><ul><li>The reward method is restrictive in all the work I’ve seen.</li><li>It does not allow learning a new task in real-time.</li></ul><p>From my study, I have not seen a system like this built to function in a time-step fashion (send me a link if you’ve seen this). It randomly shuffles events the model trains on, training in a time-linear fashion is too noisy.</p><h3>Realizing the Forever Agent</h3><p>Ok, if you’ve understood the above, you are now where I am trying to build.</p><h3>Injecting arbitrary agency into an LLM</h3><p>I started this journey of mine based on that original article (<a href="https://medium.com/@charles.curt/llm-meetings-a-study-on-multi-agent-coherency-cee91fd663b2">A study on an AI agent meeting with gpt3</a>) there is a line in there that’s important:</p><blockquote><em>I need to fine tune each model individually before a meeting.</em></blockquote><p>I did this and found that I can actually improve the depth at which an AI agent performs its tasks. This isn’t some new phenomenon, it’s essentially what many people are doing. It is also an essential part of RL. The key difference is that RL assumes that you have data from the future to train it from end to end.</p><p>What I found is that, yes, I can train a model for an arbitrary language task modeled from synthetic data, BUT it decreases its generalizability until it fails to do anything.</p><p>There is one more point to this idea I want to discuss before talking about what I’m building.</p><h3>Compounding Reasoning Chains</h3><p>When an LLM runs an inference, it actually reasons for the context and the problem it is trying to solve. In a very real sense, they are both the same thing divided by arbitrary lines we fine-tuned to follow.</p><p>Imagine any task you perform as a chain of reasoning:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cysaE1gr8Cxcz1yy.png" /></figure><p>And now, let’s think of this in the context of what agent systems do and their types of tasks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*xnqrtxZmeMm-N5fH.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/932/0*CZpgRHJSWxVMkJs0.png" /></figure><p>What stands out most is that agents have several issues:</p><ul><li>you repeat information</li><li>It cannot see the entire task</li></ul><p>Combine that with the problems I discussed before, and you will have a difficult system to manage!</p><h3>Inject the reasoning chain into the model</h3><p>The true unlock will come when each step is able to fully remember all the previous ones. Instead of each block here being an independent reasoning chain, combine them all into a single chain of thought. This is why many view infinite context as the solution. Let’s have the model remember every previous step in order to allow it to generalize forward correctly. This may very well work. However, I see it as massively inefficient. Every day you wake up, do you process your entire life to understand where you are? Does it require computational power in order for you to be in the context-aware situation you are in now?</p><blockquote><em>Parameter memory is free reasoning</em></blockquote><p>Another issue with infinite context is that you need an absurdly powerful model to understand it all. Anyone who has worked in a massive context will see this. You can insert everything, but it’s limited, and that limit is talked about in my article. <a href="https://medium.com/@charles.curt/strong-vs-weak-ai-agents-b9f7e2379ba9">An article on context is lost reasoning</a>. Again, context is lost reasoning ability.</p><p>So, we are trying to solve this problem below and build something that works. Again, the point is that if we can store reasoning chains inside of the model, it will allow reasoning to compound over time without us losing reasoning power to compute the previous stage.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*-MV1P7-RV-xQjGtD.png" /></figure><h3>How?</h3><p>Parameter memory is free reasoning.</p><p>Here’s a graph of my current research goal:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*9b5h99pMhucIALgb.png" /></figure><p>A: Model baseline<br>- A.0: General accuracy on a diverse dataset<br>- A.1: General accuracy of memory-based task<br>In this baseline, a model remembers nothing of a new task but performs well on a general assessment of ability.</p><p>B: Fine-Tuning<br>As the model trains on this new task, it will remember this information at the loss of its generalizability (e.g. model collapse).<br>- <a href="https://arxiv.org/abs/2205.12506">Memorization in NLP Fine-tuning Methods</a></p><p>C: Adversarial Training<br>In this stage, the model is battling between remembering its new task and being generalized across all tasks.</p><p>D: AGI Achieved<br>This stage shows that the model has now learned how to insert new information into its internal structure efficiently. The overall goal of this project is to find a RL method that promotes this objective.</p><p>I hope you can see from my previous discussion here and the current research that stages A and B are already known to function this way. My work on injecting synthetic data to increase reasoning depth is my own work at this stage.</p><p><strong>The goals of my work are as follows:</strong></p><ul><li>Build a method that can reproduce stage C.</li><li>Build a reward objective that allows this stage to progress to D.</li></ul><p><strong>Is this final stage achievable?</strong></p><p>Yes, just by myself? maybe not.</p><p>This assumes that we can build a powerful reward-based method that promotes data insertion into the model’s current structure as a positive reward, leading to an adversarial stage followed by a new internal structure formed within the model.</p><p>The full product I am building is below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*SS14ROnY51YUPsEO.png" /></figure><p>Let’s assume this works for a moment. I want to talk about the implications of this type of system.</p><ol><li>The AI everyone fears/hopes for has already been released.<br>- When this system is mature, it will allow even very small AI models to perform near-infinite tasks.<br>- The reasoning ability models have on zero-context tasks will be extendable to all long-term tasks. Perhaps smaller models will take longer, and larger ones will go faster, but it’s possible they will both be able to achieve incredible feats.</li><li>We are wasting a massive amount of money building infinite reasoning.<br>- We will still be building these massive reasoning models, but average tasks and agent companies will not use them.</li></ol><blockquote><em>We must separate reasoning from memory for AGI to be achieved.</em></blockquote><p>Join me in this task.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=438e480dc9fc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Compounding Reasoning Chains]]></title>
            <link>https://medium.com/@charles.curt/compounding-reasoning-chains-2c5cb0df2ee9?source=rss-f8a9438f1510------2</link>
            <guid isPermaLink="false">https://medium.com/p/2c5cb0df2ee9</guid>
            <category><![CDATA[agi]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Charles Curt]]></dc:creator>
            <pubDate>Fri, 03 May 2024 16:54:49 GMT</pubDate>
            <atom:updated>2025-01-31T22:41:02.058Z</atom:updated>
            <content:encoded><![CDATA[<p>I wrote about the concepts and research around what I term:</p><p>“<a href="https://medium.com/@charles.curt/the-forever-ai-agent-f9cc39a23f8d">The Forever AI Agent</a>”</p><p>However, I realized it was very technical, and one of the key concepts can be extracted and discussed much more easily. So, I’d like to discuss how a forever agent will grow not by having infinite reasoning abilities but by having an infinitely connected reasoning chain.</p><h4>You vs. AI</h4><p>Here’s a problem I bet you aren’t great at:<br>Get a pen and paper and write a 500-word essay without a single flaw, you also cannot stop to think while working on it.</p><p>I asked Chatgpt4 this question:<br>Write a 500-word essay on why sheep are important for the economy of Iran.</p><p>Instantaneously a near-perfect essay pops out without breaking a sweat. However, I would be astounded if I or someone unpracticed could do this almost instantly without errors or cohesive issues of any kind. Hell, I can’t even write this article without stopping, telling an AI to fix grammar issues (thanks, Grammarly!), and thinking about the next topic.</p><h4>A different view of reasoning</h4><p>I have a different view of AI and reasoning that may scare or excite you, depending on where you sit on the doom scale.</p><p>Our models aren’t perfect, and there is definitely room to grow in reasoning, but I think the biggest unlock will not be bigger models having more of it.</p><p>Go play around with smaller AI models, and you may be surprised. They’re kind of smart! Dumb in many ways but also pretty good. They fall apart when you have to insert context for them to reason over.</p><p>I like to view models as having two components to reasoning.</p><p>1. The in-context learning and how you structure the prompts.<br>2. In parameter reasoning from the pertaining and fine-tuning stage.</p><p>I am particularly interested in the second one here. When asking chat that question above, you don’t need in-context learning to understand sheep, Iran, or how an article is created. More important to notice is that the knowledge inside the model does not somehow damage the output it makes, it clearly helps it.</p><h4>Reasoning Chains</h4><p>Here’s a reasoning chain for a simple use case of a current LLM chatbot.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*v0AVBVA_wFPaTXyx" /></figure><p>Let’s view chain in light of what a CL approach looks like.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Hj6zWZXQFETpxdvxZuxmlg.png" /></figure><p>Every step we train on the interaction. Say this works and we insert the information easily, the model can now remember this previous reasoning chain.</p><p>Again, go see my much more technical article for a deeper understanding of how.</p><p>You now have this “paramater memory reasoning chain.” This will behave exactly like any other internal memory the model has and allow us to basically use this reasoning at no cost, much like we don’t need it to relearn what Iran was for that essay example.</p><p>With this reasoning freed up the next step can now add or grow this chain as it sees fit not only with this previous chain of understanding but now with less context giving it more reasoning ability overall.</p><p>The overall concept of this is that a continuous and remembered reasoning chain can unlock true AGI very quickly and potentially without any need of massive AI models.</p><p>Yes the model may not be the smartest per step but the fact that it know all its previous steps and a lot of general knowledge, it’s much more similar to how we operate on a task.</p><p>Imagine it like a shovel digging a hole. The shovel size and strength of the shoveler is like the size and power of the model. Currently our only idea on how to dig our hole is to get a MASSIVE shover and a crazy strong shoveler to pull it out one go. In this analogy that’s because it only has a single shot at digging that hole.</p><p>However a reasoning chain allows a model to eat away at a problem little by little, shovel some and let the pile grow.</p><h4>Scared or Excited?</h4><p>The argument I’m making here is that the AI models we all fear and are excited about are already released into the wild. All it takes to turn an open source model into a forever AI agent is for us to figure and and mature the method I spoke about in my article.</p><p>You’ll know that true AGI is unlocked when all sized models can perform near infinite tasks.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2c5cb0df2ee9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AI itself will become content]]></title>
            <link>https://medium.com/@charles.curt/ai-itself-will-become-content-99ca414c5960?source=rss-f8a9438f1510------2</link>
            <guid isPermaLink="false">https://medium.com/p/99ca414c5960</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[llm]]></category>
            <dc:creator><![CDATA[Charles Curt]]></dc:creator>
            <pubDate>Mon, 04 Mar 2024 16:13:16 GMT</pubDate>
            <atom:updated>2024-03-04T16:20:38.981Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*20_46vr19aQzDQQ18x3hxw.png" /></figure><p>Pure AI models will soon dominate our internet lives; a large majority of the content you see, whether it is funny cat pictures or educational videos, will, in the future, be the direct raw output from an AI model.</p><p>What does this mean for content creators? Will anyone who makes videos, pictures, or articles online quit and start learning a trade?</p><p>I think the opposite. Instead, we are already starting to see the truth of AI.</p><h3>AI is a human force multiplier, not a replacement.</h3><p>Writers can now quadruple their output, and I’ve met several who use it as an editor. Could you argue that articles are direct outputs of an AI model? Maybe, but that’s not what I’m arguing, as a human still creates and manipulates those articles. I’m saying that the model itself will raw output precisely what the person reads.</p><p>How would a content creator survive if their direct output is not consumed?</p><blockquote>One Model. One Dataset. One Person.</blockquote><h3>AI is content</h3><p>We’ll soon see that most creatives will move from working on the content itself to a different form of content creation. My prediction is that the future will be dominated by custom trained AI models created by individuals to behave in a certain unique way.</p><blockquote>How will non technical people create custom AI for their fans?</blockquote><p>Here’s a simple example. Let’s say Taylor Swift creates a custom chatbot that talks and thinks exactly like Taylor Swift. On top of that, Taylor Swift owns all rights to this model for any monetization.</p><p>Ok, well, Taylor Swift is wealthy and can spend a lot of money on engineers for this. How about everyone else? I want a me chatbot. Or let’s say I want a YouTube generation AI to create full-length videos in your custom style and method.</p><p>Will a massive general AI do this work, or will it be targeted AI models made only for the task? It will be the latter. We’ll need massive AI models for super intelligence tasks, but the Taylor Swift bot is not required to be able to solve quantum mechanics and code better than 95% of all humans.</p><h3>The answer is synthetic data</h3><p>Soon, we’ll get a new explosion of AI, a V2 of AI, if you will. This AI will rely on synthetic data to create custom small AI models that content creators will use for targeted tasks. The creators of the models will pay for inference costs but will own the intellectual rights of the generated data and the parameters of that model.</p><p>This is what I’m working on, let me know your thoughts!</p><p>Info@Sliced-ai.com</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=99ca414c5960" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why don’t our heads explode thinking about stop signs and my thoughts on Squirrels]]></title>
            <link>https://medium.com/@charles.curt/why-dont-our-heads-explode-thinking-about-stop-signs-and-my-thoughts-on-squirrels-fe5e997440e1?source=rss-f8a9438f1510------2</link>
            <guid isPermaLink="false">https://medium.com/p/fe5e997440e1</guid>
            <category><![CDATA[synthetic-data]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[agi]]></category>
            <category><![CDATA[llm]]></category>
            <dc:creator><![CDATA[Charles Curt]]></dc:creator>
            <pubDate>Mon, 04 Mar 2024 15:08:24 GMT</pubDate>
            <atom:updated>2024-04-02T17:09:56.126Z</atom:updated>
            <content:encoded><![CDATA[<p>Close your eyes and think of a stop sign. Really think of it in your head, perhaps something like this below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GEunEhhSfSimm1BB7iX-HA.jpeg" /></figure><p>Let’s start with a simple question.</p><p>Would you ever lose your mind if you closed your eyes and simply think of that stop sign in your head without the picture? Will stop signs start looking like these below?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*BkFad0ypCr0Cb1Owpe_S5A.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*KuZSC5ASn3iM2CGaKnCO2Q.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*Tm7GGg_g4IgEFGZomlnrZA.jpeg" /></figure><p>I hope the answer is no.</p><p>Then how about meditation? Would anyone argue that meditation hurts the way we think? Many believe it is the opposite effect.</p><p>Why?</p><blockquote><strong>How are these scenarios any different than an AI generating and then training on it’s own data?</strong></blockquote><blockquote>How can we allow models to think inside their own head?</blockquote><p>There’s a great visual for framing this discussion from the paper linked.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1010/1*zTRBuHtmcUJQjNoZ4sAsuw.png" /><figcaption><a href="https://arxiv.org/abs/2307.01850">Self-Consuming Generative Models Go MAD</a></figcaption></figure><p>You can think of the above as what happens if a current AI system “thinks” about something for too long. The above shows how a model&#39;s complex structure collapses over 20 loops of generating data and then training on its own output.</p><p>It’s straightforward to understand this intuitively. Every time you ask a model to generate something, it is “sampling” its internal structure. While its internal structure is a “sample” of the original dataset. You can never perfectly sample the original structure. There is always some error either in generation or training.</p><p>Perhaps the closest you could get to sample the entire LLM fully would be to have it generate the entirety of its original dataset. While entirely useless, it’s probably the closest approximation you could achieve to the original dataset. If you were to train a model on the regenerated dataset, you would likely get a model that is very close to the original but still not as potent due to the errors involved.</p><p>I talked about this in a separate argument in a bit more depth by thinking of how we could more accurately “sample” a person&#39;s internal model in my article:</p><p><a href="https://medium.com/@charles.curt/are-humans-deterministic-and-should-llms-make-spelling-mistakes-c47debc5c13b">Are Humans Deterministic and Should LLMs Make Spelling Mistakes</a></p><p>On top of this concept is that generating ANY information from an LLM causes an error the longer it goes. Based simply on the properties of the attention mechanism. See my article in the section <a href="https://medium.com/@charles.curt/strong-vs-weak-ai-agents-b9f7e2379ba9">Abitrary Task Strong AI Agent</a> for a visual and discussion on this.</p><h3>Loving and Hating Data</h3><p>Data is annoying; there isn’t enough of it, and it takes most of my effort to make it work in my algorithms. On top of this annoyance, there never seems to be a dataset that precisely aligns with what I am trying to do. Maybe I can find something and change it, but nothing exactly matches it.</p><p>Companies have the resources to produce a dataset. They will pay millions of dollars to individuals to create a human-generated dataset. It’s costly, so the concept that anyone but the largest can do it isn’t realistic.</p><p>There are currently no options available if you have a completely novel idea with no dataset. Let’s say you wrote a huge detailed book, you would like an LLM to behave like one of the characters in the book. Unless you manually create the data, getting an LLM to behave and remember everything in the book is very difficult, if not impossible, to do.</p><h3>What about a larger context?</h3><p>While this is possible, it has massive drawbacks. Imagine if you are an LLM with a massive context size for a moment. Someone slaps an entire book on the table and has you read it to respond to a question as simple as “Tell me a bit about yourself.” The current alternative we do is to, instead of handing the entire book to the model at once we, hand it sections of the book.</p><p>That’s what we are doing currently, and if you’ve read my other articles, you’ll know I think this is ridiculous.</p><h3>What if we could make our data?</h3><p>Well, that’s a great idea! Let’s try that out.</p><p>Let’s think of an idea and then generate a large synthetic dataset around it for training, what happens?</p><p>Painful things happen.</p><p>Having a model generate a dataset for you is a challenging problem, the real issue is how can you produce data without causing error. Generating a large amount of data leads to much data error within the set created.</p><p>The closest way I can describe generating data and working with LLMs is like playing infinite wack-a-mole with the input and output. Task coherence is still tricky to master, with constant, completely novel errors arising every time you fix something.</p><p>Even worse, you have a percentage chance of error every generation, and if you trained on those outputs, the training itself has errors.</p><p>Current thinking around LLM is to decrease this error for an infinite amount. This does work, as we have seen from massive models like chatgpt4, but it still has the same fundamental issues. It just becomes smaller. You cannot create a better chatgpt4 by simply making chatgpt4 produce “better” data from itself and training.</p><p>It’s interesting how difficult this problem is for current AI when the animal kingdom easily does this in some of the simplest animals.</p><h3>Enter the Squirrel</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/894/1*fhA_tFM-pKXfDs8Ha6Qicw.jpeg" /></figure><p>Squirrels have around 450M neurons in their brain. <a href="https://en.wikipedia.org/wiki/List_of_animals_by_number_of_neurons">wiki</a></p><p>Can squirrels think internally? Do they dream? I haven’t a clue. However, the prestigious <a href="https://thesquirrelboard.com/forums/archive/index.php/t-28305.html">thesquirrelboard.com</a> thinks so. My dog dreams for sure, as do many mammals.</p><blockquote>How can a squirrel that possesses &lt;0.045% the number of neurons as gpt4 not lose its mind while thinking and dreaming to itself?</blockquote><h4>It is not a factor of size that determines if a AI model can break through this issue.</h4><p>Let’s now ask the opposite question: are there any situations in which a natural brain can fall apart similarly to a model collapsing?</p><p>We could look at the effects of <a href="https://en.wikipedia.org/wiki/Sensory_deprivation">sensory deprivation</a> or, as an extreme example, the case of <a href="https://en.wikipedia.org/wiki/Genie_(feral_child)">Genie</a> (warning), in which a person was essentially locked in a room without stimulation for many years, as a potential comparison.</p><blockquote>extended or forced sensory deprivation can result in extreme <a href="https://en.wikipedia.org/wiki/Anxiety">anxiety</a>, <a href="https://en.wikipedia.org/wiki/Hallucination">hallucinations</a>,<a href="https://en.wikipedia.org/wiki/Sensory_deprivation#cite_note-3">[3]</a> <a href="https://en.wikipedia.org/wiki/Delusion">bizarre thoughts</a>, and <a href="https://en.wikipedia.org/wiki/Depression_(mood)">depression</a>.<a href="https://en.wikipedia.org/wiki/Sensory_deprivation#cite_note-4">[4]</a></blockquote><p>Could we reproduce the model collapse we saw in the first visual with a human by simply sensory isolating them and giving them an SAT once a week?</p><p>This is the future of AI, solving these problems will lead to a true AGI model. There will be a significant market shortly for small (maybe squirrel sized) AI models that are strong agents for their goals.</p><h3>Thanks for Reading!</h3><p>Email me if you are interested in these concepts and want to help build systems that follow these ideas.</p><p>Info@Sliced-AI.com</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fe5e997440e1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Are Humans Deterministic and Should LLMs Make Spelling Mistakes]]></title>
            <link>https://medium.com/@charles.curt/are-humans-deterministic-and-should-llms-make-spelling-mistakes-c47debc5c13b?source=rss-f8a9438f1510------2</link>
            <guid isPermaLink="false">https://medium.com/p/c47debc5c13b</guid>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[data]]></category>
            <category><![CDATA[chatgpt]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Charles Curt]]></dc:creator>
            <pubDate>Thu, 22 Feb 2024 21:31:40 GMT</pubDate>
            <atom:updated>2024-02-22T21:35:26.636Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/788/1*mS9hG3DaLQW1EuJeAVbOYA.png" /><figcaption>DALL-E</figcaption></figure><h3>Are you random?</h3><p>If I challenged you to type out several paragraphs of something completely random, could you?</p><p>For example:<br>ouwefnowuefbwoeubfcat is a big hair beast of no land from persian decent where the interest of the empire had no say in funny hats osnfowsnfe.</p><p>Were the random characters or words I typed random? If you read hundreds of pages of my random typings, would you find patterns, or are humans sufficiently complex that we cannot see the internal deterministic nature as anything but random?</p><h3>Structured vs Random Sampling</h3><blockquote>Your goal is to train a new LLM that acts as human as possible.</blockquote><p>Imagine you have a large dataset of text. Take the C4 dataset or anything these LLM companies have created lately. The company you are building this for only has the funds to train on around 10% of the data you can access.</p><p>What data should you choose?</p><p>You could do a naive random sample across the data and then train. Is this better than finding the &quot;best&quot; data from the dataset? Let&#39;s put an additional fictional restriction: You can select anything but are limited in training to a small maximum length.</p><p>This becomes tricky; we intuitively understand that a larger paragraph of information is more complex on average than a smaller one simply because the size adds higher dimensions.</p><blockquote>We are now forced to determine the densest information in the dataset to maximize returns on training.</blockquote><p>Perhaps riddles and complex math problems are the densest information humans produce. It would be extremely tricky to balance the different abilities of this model while not sampling everything in the dataset.</p><blockquote>You need to select not only the densest information but also the most diverse.</blockquote><h3>What&#39;s the fundamental goal here?</h3><p>Back to the original goal, we are to build a model that best reflects a human. This means we want to sample data that perfectly matches how a human acts. We essentially want a sample of the &quot;Human Distribution,&quot; not the C4 or anything else.</p><p>What&#39;s the best way to sample a human? What would you have someone make if you could pay someone 24/7/365 to create a dataset?</p><p>Would you run a gambit of QA? Make them answer a million SAT questions. Or have them summarize and write about a book. That&#39;s the current thinking, at least.</p><p>If I were to ask you what the majority of your thoughts are, do they center around QA pairs? Do you navigate the world by thinking of everything you do as a set of QA pairs? That&#39;s currently how we are trying to create AGI. We shoehorn every situation in pairs and try to model all the problems around us.</p><p>How would you describe your thoughts at a high level?</p><p>I would describe mine as an endless stream, slowly changing as my environments and knowledge change. It would be nearly impossible to type out all your thoughts and feelings in real-time as it happens. It’s also because we, as humans, truly know what all our thoughts are. You cannot determine what your brain is thinking in the background. The best way to get a sample of not only your foremost thoughts but also your background would be to sample your own brain in a diverse as possible fashion.</p><blockquote>I believe the absolutely densest, most diverse, and most similar to a “Human Distribution” data we could possibly create is a large string of random thoughts exactly like the very first paragraph I created.</blockquote><h3>How can we test this?</h3><p>Imagine we had millions of dollars to test this theory above. Let&#39;s pay different people in the world 100$ each to write pages of random strings and words.</p><p>To make it as unbiased as possible, we could follow these rules:<br>- Spend 5 minutes writing randomness every 2 hours exactly.<br>- Do this once a day every other week for one month.<br>- Sample all demographics evenly<br>- Some people create significantly more random content while others make much less.</p><p>Now, let&#39;s make an LLM pre-train on this data alone. What might we find?</p><h3>Humans are Random</h3><p>If human thoughts are random or because of a random environment, we are random enough, then no model of any size would ever be able to determine this. It would forever fail to be able to predict what you would be typing.</p><p>This would imply deeper and more powerful structured sampling is the only way forward to improve AI. Interestingly, it would also mean that our brains do an advanced structured sampling of our thoughts to become more advanced.</p><h3>Humans are Deterministic</h3><p>If humans are deterministic a model of sufficient power and with enough training data of random typings in the correct depth and breadth would eventually be able to predict your stream of thoughts of held out data given only the first starting characters and perhaps an identifier.</p><p>If this were true, the new model we created would now have the world&#39;s most accurate model of a human&#39;s thoughts.</p><p>After this, what would happen if we then fine-tuned or pre-trained it into the current chatbots?</p><p>Would it outperform other ML techniques if fine-tuned to human brain signals?</p><h3>Conclusion</h3><p>If humans are deterministic, I would argue that LLM training should be done on as raw, pure human data as possible. AI should make grammatical errors as close to how humans do as it keeps the distribution of training closest to the original source, us.</p><p>Thanks for reading!</p><p>I’m working on thoughts around these and if you have any thoughts or are interested in building new AI methods contact me.</p><p>Info@Sliced-AI.com</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c47debc5c13b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Strong vs. Weak AI Agents]]></title>
            <link>https://medium.com/@charles.curt/strong-vs-weak-ai-agents-b9f7e2379ba9?source=rss-f8a9438f1510------2</link>
            <guid isPermaLink="false">https://medium.com/p/b9f7e2379ba9</guid>
            <category><![CDATA[chatgpt]]></category>
            <category><![CDATA[aı]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[llm]]></category>
            <dc:creator><![CDATA[Charles Curt]]></dc:creator>
            <pubDate>Mon, 19 Feb 2024 22:49:13 GMT</pubDate>
            <atom:updated>2024-02-19T22:49:13.819Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/792/1*4-IhsPy1CSmS8eHcBYMRFw.png" /><figcaption>DALL-E</figcaption></figure><p>If (reader == lazy):<br> GoTo: “the core problem is”</p><h3>Introduction</h3><p>Current AI systems are a marvel of engineering. We can use them for many general purpose tasks and have them behave as arbitrary task agents. However, having our AI agents succeed in all tasks is a deep issue. They forget, or get lost, cause errors or give outcomes that do not follow the original goal. Anyone who has tried to give a command to a recursive LLM like “create all the code to replicate Facebook” will know this pain.</p><p>I want to discuss this branch of general-purpose AI. Specifically, around what constitutes a “Strong” AI agent and what that problem looks like.</p><h3><em>First off, what is an agent?</em></h3><blockquote><em>An autonomous AI LLM agent is a self-operating system that can make decisions and perform tasks independently, utilizing a large language model to understand and generate human-like language in order to interact with users. It combines autonomous decision-making with advanced language processing capabilities to provide independent and intelligent responses without constant human intervention. This implies advanced task coherence abilities.</em></blockquote><h3>Current AI Systems:</h3><p>Current LLM models are strong agents in one task and one task only. They are strong <strong>chatbot</strong> agents. No matter what you do or say to these bots they will behave as a chatbot, it is (to my knowledge) impossible to break a current LLM to behave outside of a chatbot. What it would even mean for one to not behave as a chatbot is as confusing of a question as asking how a car can behave as a motorcycle.</p><p>Why is this?</p><p>First off, we have framed the entire AI agent using LLM category as based off of the concept that every task can be framed as a chatbot session. Every single piece of training data for a chatbot is specifically formatted to facilitate the chat bot method.</p><p>Yet even if we frame our autonomous requests as a chatbot it will vere off and crash at some point. I now suggest you see my work on agent coherence and my own test on a meeting where I studied this deeper.</p><p><a href="https://medium.com/@charles.curt/llm-agent-depth-coherence-study-incomplete-547a4dcd289a">Coherency Study</a></p><p><a href="https://medium.com/@charles.curt/llm-meetings-a-study-on-multi-agent-coherency-cee91fd663b2">LLM Meeting Study</a></p><p>How are we to overcome the seemingly impossible task of an AI agent without supervision permanently staying on task?</p><p>Most people, companies, and systems have gone down the traditional path of giving this new tool methods to simulate a strong agent method. This may look like having a search engine hooked up to all its previous conversations and task definitions. This does work don’t get me wrong however it is supplementing a weak AI agent, not creating a strong one.</p><p>This is now where we get to the meat of the concepts I’ve been working on for quite some time now. That is the concept of creating strong AI agents using weak ones.</p><p>Let me frame the problem in its full extent so it can be appreciated why this hasn’t occurred yet.</p><h3><strong>Abitrary Task Strong AI Agent</strong></h3><p>These tasks look like:<br>- “Behave as a software engineer in my company forever, fulfill all duties.”<br>- “Be my personal assistant, remember every person, place, and word I say”</p><p>These tasks are truly massive, the current race of ADD MORE LAYERS will not solve these problems by simply being able to insert ALL context into an input. If anyone reading this hasn’t yet I suggest you go chat with a massive context LLM. While these no doubt work there is a core tradeoff as the more context inserted means it has less “power” to solve the problems within. This is a core limitation of our methods of famed attention algorithm as it tries to compare every component to every other component of an input. You may try a special attention mechanism but it fundamentally is putting lipstick on a pig. Check out this graphic to see what I mean as these are all different methods to try to solve this above problem.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oNN2nFIW4ocpb0FawCwPcg.png" /><figcaption>“ETC: Encoding Long and Structured Inputs in Transforme”</figcaption></figure><h3>The core problem is:</h3><blockquote>We currently mix problem space with memory space. Our AIs take away problem space power by requiring insertion of relevant information into the same space.</blockquote><p>This is why we can’t make arbitrary strong AI agents yet. In order to be strong it must remember everything even if it is a very complex problem AND it must pay attention to the current. My study of LLM meetings is a great example of this. As the previous problems to remember grew larger the current problem has a proportional “power” that decreases with every step.</p><p>Now is it possible to build a “perfect” search engine on top of this? Perhaps, it’s another path to this such as the RAG method. However, if you think like me, maybe you’ve realized, that it is fundamentally the same problem. In order to have a search engine bring in the “EXACT” required information it must in itself be a perfect finding relevant data agent. It’s a recursive problem we are simply trying to solve with bigger models.</p><h3>Conclusion</h3><p>Thanks for reading, if you have any idea what I’ve been talking about, I really would like to hear your thoughts.</p><p>Email me at: Info@Sliced-AI.com</p><p>I’ve started a company around these concepts in this blog and I truly believe I’m onto a path of strong AI agents. My first product is around building a strong character agent. I want a strong agent that literally cannot act like anything but the character you created.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b9f7e2379ba9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[LLM Meetings a Study on Multi-Agent Coherency]]></title>
            <link>https://medium.com/@charles.curt/llm-meetings-a-study-on-multi-agent-coherency-cee91fd663b2?source=rss-f8a9438f1510------2</link>
            <guid isPermaLink="false">https://medium.com/p/cee91fd663b2</guid>
            <category><![CDATA[chatgpt]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[large-language-models]]></category>
            <dc:creator><![CDATA[Charles Curt]]></dc:creator>
            <pubDate>Fri, 28 Jul 2023 00:35:15 GMT</pubDate>
            <atom:updated>2023-07-28T00:35:15.984Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1006/1*5hkSsGAWZeEz8vyk2NVtUg.png" /><figcaption>deepai.org</figcaption></figure><p><strong>SUMMARY OF THIS WORK </strong>(you&#39;re welcome)</p><ul><li>It doesn’t work (see my rough equation below)</li><li>Building filters and checks works to extend the depth of the discussion, but it will eventually become a pointless ramble of the models.</li><li>Occasional human injection intuitively makes the group behave much more focused.</li><li>I need to fine tune each model individually before a meeting.</li></ul><p>I am interested in orchestrating LLM agents in a large distributed setting. How could you get not one or two but hundreds and thousands of LLM agents to work together?</p><p>My concept is to have them meet as we do in a work setting. Let them figure out the next steps and then specify their tasks. Once they have their tasks, let them go off to solve them, then return and meet on the results.</p><p>I had initially planned two main studies in this work:</p><ol><li>A single-depth LLM meeting where agents need to solve a task</li><li>Three depth LLM meetings are where agents first meet, and then their task is to organize the next layer of LLM meetings and their tasks.</li></ol><p>I have example prompts and the agent discussions at the bottom of this article.</p><p><strong>Nobody is surprised, though, that this idea didn’t work very well.</strong></p><h3>How would you accomplish this?</h3><p>There are a lot of challenges to this method, namely how to herd LLMs to prevent massive loss of coherence.</p><p><a href="https://medium.com/@charles.curt/llm-agent-depth-coherence-study-incomplete-547a4dcd289a">My solution is based on my previous study into agent models and task coherence.<br></a><br>I continued the work above and studied more phenomena in this system. Here are some methods I found to keep agents more coherent.</p><p>Definitions:</p><p><strong>Depth:</strong> A task created by another agent passed down.</p><p><strong>Steps:</strong> The number of steps an individual agent needs to perform.</p><p><strong>Coherence: </strong>How close a model sticks to its original goal.</p><ol><li>Retry</li></ol><blockquote>I found that each stage of a tree of agents calls has a certain percentage chance of failure based on how close it was to the origin. So if there is a certain percentage chance of failure, build in strict filters that define your task or coherence threshold and have a model retry until they reach it. I also setup a final layer of filters in the form of annother agent to check all outputs that would always be a simple zero depth agent. Depending on the depth of the agent chain, you have a lower or high chance of sticking to your original task.</blockquote><p>2. Agent Coherence depth manipulation</p><blockquote>If you inject good context into an agent chain like human, optimized structured requirements, or real world feedback like code errors you can artificially manipulate the depth the agent is at. For my LLM meeting this is setting myself as an individual team member in the meeting, namely the manager and allowing the agents to ask me questions.</blockquote><p>3. Manipulating the input parameters to the model inferencing</p><blockquote>I think it as these models hitting valleys that cause them to fail catastrophically. And just like in training, if a model is getting stuck in a specific area, a very common method of fixing it is to apply a dropout rate (retrying) or a different learning rate to pop it out (temperature).</blockquote><p>The depth here implies the number of agents creating agent tasks. Steps is the number of iterations a single agent performs to complete a task. Overall I think there are some things to learn from this.</p><p><strong>The more complex your task is and the more agents you need to spawn to accomplish it, the more model outputs you will need to throw away.</strong></p><p>This intuitively makes sense, even with humans. The larger the task and less exact rules we are given, the lower our chance of following those rules apply. When your boss gives a single “get it done” command, it often happens that we will screw up. The game of telephone is a powerful example of these systems. So if the same is true with LLMs, then we can create a simple back-of-the-hand formula to define the inefficiencies we will experience as we grow our task.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*72f54FY48qX0cqpvJV26Cg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/424/1*GncUNe0LdSZiAg6QvKuBqw.png" /></figure><p>With this, we can see a lot of ideas, first, let’s take the example of what happens when you ask a LLM a question directly without follow-up.</p><p>In that scenario:</p><ul><li>There is only one step</li><li>There is no depth</li><li>There is only one agent</li></ul><p>This is what the vast majority of LLMs are good at doing right now.</p><p>You should check out <a href="https://arxiv.org/abs/2305.16291">Nvidia Voyager</a> for a good example of agents working.</p><p>I would argue that this system functions because the real-world feedback keeps the depth of these systems high quality.</p><h3>Onto this recent work!</h3><p>This work aims not to make a fully autonomous system of agents but to study another system of agent interactions like my previous one. If you were hoping for a silver bullet here, sorry!</p><p>So I ran into a lot of issues with this work to boil it down, it would be these:</p><ul><li>Each agent did not think of itself as an individual but as everyone in the conversation. They would regularly answer themselves.</li><li>Building rules to filter data works but is an infinite game of whack-a-mole. You will never have enough filters to make this work.</li><li>The more context I gave each individual in the meeting, the better they performed.</li><li>As the conversation grew, the number of retries grew at an above-linear rate.</li><li>The model did not really “get” the point of the meeting, and the overall discussions just made it passed the filters, but they did not work in producing meaningful results.</li></ul><p><strong>Future Ideas:</strong></p><p>You need an individual model for each “person” in this meeting. The training data itself needs to reinforce who that individual is. My next goal is to fine-tune multiple models so that each model knows without reminding that it is X person in the conversation.</p><p>Here is the example prompt of one agent for the entire meeting:</p><blockquote>The team: Name: Charles, Role: Manager: friendly, helpful, wants you to be independentName: Alice, Personality: Detail-oriented and organizedName: Brad, Personality: Innovative and adaptableName: Cassandra, Personality: Efficient and communicative<br>This is My Background I am the following description: Name: Brad, Personality: Efficient and communicative<br>####<br>Example 1:<br>name: Meeting Response: Post Reply:<br>My Task: This is where I write my task <br>Output: I must responsd with something<br>Example 2:<br>name: Meeting Response: Question for::<br>My Task: This is where I write my task <br>Output: I must ask a question<br>Example 3:<br>name: Meeting Response: No Comment:<br>My Task: This is where I write my task <br>Output: I can not write anything here <br>####</blockquote><blockquote>Meeting Rules: your response must have one of the following:<br>Question for: (Team member name)<br>No Comment:<br>Post Reply:<br>You must always have this:<br>Meeting Response: (one of these Question for: No Comment: Post Reply:)<br>My Task: (your task as of now in less than 4 sentences)<br>Output: (Your question or reply, if No Comment this must be nothing)<br>If you have a question for a particular team member use question for.<br>If you have no additional information to add or general question then say no comment.<br>If you have a general reply adding context or a question for the group use Post Reply.<br>Your questions and tasks should be very focused and task oriented. <br>Once the timer ends the meeting is over.<br>A no comment does not count towards the meeting timer which means the best team member should reply at the most important part.</blockquote><blockquote>Meeting Time Limit: (0/50)Meeting Time Limit: (1/50)Meeting Time Limit: (2/50)Meeting Time Limit: (3/50)Meeting Time Limit: (4/50)Meeting Time Limit: (5/50)Meeting Time Limit: (6/50)Meeting Time Limit: (7/50)Meeting Time Limit: (8/50)Meeting Time Limit: (9/50)Meeting Time Limit: (10/50)Meeting Time Limit: (11/50)Meeting Time Limit: (12/50)Meeting Time Limit: (13/50)Meeting Time Limit: (14/50)Meeting Time Limit: (15/50)Meeting Time Limit: (16/50)Meeting Time Limit: (17/50)Meeting Time Limit: (18/50)Meeting Time Limit: (19/50)Meeting Time Limit: (20/50)Meeting Time Limit: (21/50)Meeting Time Limit: (22/50)Meeting Time Limit: (23/50)Meeting Time Limit: (24/50)Meeting Time Limit: (25/50)Meeting Time Limit: (26/50)Meeting Time Limit: (27/50)Meeting Time Limit: (28/50)Meeting Time Limit: (29/50)Meeting Time Limit: (30/50)Meeting Time Limit: (31/50)Meeting Time Limit: (32/50)Meeting Time Limit: (33/50)Meeting Time Limit: (34/50)Meeting Time Limit: (35/50)Meeting Time Limit: (36/50)Meeting Time Limit: (37/50)Meeting Time Limit: (38/50)Meeting Time Limit: (39/50)Meeting Time Limit: (40/50)<br> <br>Hi everyone we are here to discuss this new task we will be working on help me divy up the work amoungst you: <br> this is pretty free form so everyone help divy up the work between each other and clarify with each other everything you are all doing and how you will work together.<br> <br> COMPLEXITY: medium<br>TIMEFRAME: medium</blockquote><blockquote>Create an end-to-end Machine Learning (ML) pipeline involves several stages. <br>It starts with data collection, cleaning, and annotation, followed by feature engineering, model selection, and training. <br>The model is then tested and validated to check its performance and potential issues like overfitting or underfitting. <br>Post-validation, the model is deployed into a production environment with monitoring systems to observe for drifts. <br>A user interface and API are developed for easy interaction with the ML platform. <br>Finally, the underlying infrastructure is built with CI/CD pipelines for smooth updates, and comprehensive documentation and training are provided for end-users and stakeholders.</blockquote><blockquote>Cassandra: Meeting Response: Post Reply:<br>My Task: I can work on data collection and cleaning. I have experience in data management and can ensure that the collected data is accurate and well-documented. I will also take care of data annotation to provide labeled data for training the model.<br>Output: How are we planning to collect the data? Are there any specific sources we should consider?<br>Alice: Meeting Response: Question for: Cassandra<br>My Task: I can work on feature engineering and model selection. I have a strong background in statistics and machine learning algorithms. I can analyze the data and engineer relevant features for model training. I will also evaluate different models and select the most suitable one based on performance metrics.<br>Output: Cassandra, can you provide some details on the data collection process? Are there any specific data sources we should consider?<br>Cassandra: Meeting Response: Question for: Alice<br>My Task: I can work on data cleaning and annotation. I will ensure that the collected data is free from any inconsistencies or errors. I will also annotate the data to provide labeled examples for model training. I have experience in data preprocessing techniques and can handle this stage efficiently.<br>Output: Alice, do you have any specific feature engineering techniques in mind that we should consider?<br>Alice: Meeting Response: Post Reply:<br>My Task: I can work on feature engineering and model selection. I have a strong background in statistics and machine learning algorithms. I can analyze the data and engineer relevant features for model training. I will also evaluate different models and select the most suitable one based on performance metrics.<br>Output: How are we planning to validate the model’s performance? Are there any specific metrics we should focus on?<br>Cassandra: Meeting Response: Question for: Charles<br>My Task: I can work on testing and validation of the trained model. I have experience in designing experiments and evaluating ML models. I will ensure that the model’s performance is thoroughly tested and validated before deployment.<br>Output: Charles, how are we planning to handle potential issues like overfitting or underfitting during the model validation process?<br>Charles: Lets just use best practices for this project. Have all components of this project been discussed and split up amoungst us?<br>Cassandra: Meeting Response: Post Reply:<br>My Task: I can work on the deployment of the model into a production environment. I have experience in setting up monitoring systems to detect and mitigate model drifts. I will ensure that the model is deployed securely and efficiently, and that it remains performant in a production setting.<br>Output: Have we considered the user interface and API development for easy interaction with the ML platform?<br>Alice: Meeting Response: Post Reply:<br>My Task: I can work on creating a user interface and API for easy interaction with the ML platform. I have experience in front-end development and API integration. I will ensure that the interface is user-friendly and intuitive, and that the API provides smooth communication between the ML platform and external systems.<br>Output: How are we planning to handle updates and version control of the ML model in the production environment? Are there any specific CI/CD pipelines we should consider?<br>Cassandra: Meeting Response: Question for: Brad</blockquote><blockquote>My Task: I can work on building the underlying infrastructure with CI/CD pipelines. I have experience in setting up automated build and deployment processes. I will ensure that the ML model updates can be smoothly integrated into the production environment with minimal downtime.</blockquote><blockquote>Output: Brad, do we have any specific requirements or preferences for the CI/CD pipelines?<br>Alice: Meeting Response: Question for: Charles<br>My Task: I can work on creating comprehensive documentation and training materials for end-users and stakeholders. I have experience in technical writing and can ensure that the documentation is clear, concise, and user-friendly. I will also develop training materials to help users understand and utilize the ML platform effectively.<br>Output: Charles, do we have any specific guidelines or templates for the documentation and training materials?<br>Charles: This system is going to be for engineers so it should be very technical let’s not worry about training materials. <br>Alice: Meeting Response: Post Reply:<br>My Task: I can work on creating comprehensive documentation for end-users and stakeholders. I will ensure that the documentation is clear, concise, and technical. <br>Output: Should we include any code examples or tutorials in the documentation to help users understand the ML platform better?<br>Brad: Meeting Response: Question for: Alice</blockquote><blockquote>My Task: I can work on monitoring systems to observe for drifts in the production environment. I have experience in setting up monitoring tools and alert systems. I will ensure that any potential model drifts are detected early and addressed promptly.<br>Output: Alice, do you have any specific recommendations for monitoring systems that we should consider?<br>Cassandra: Meeting Time Limit: (35/50)</blockquote><blockquote>Meeting Response: Post Reply:</blockquote><blockquote>My Task: I can work on the data collection and cleaning for this ML pipeline. I have experience in managing and organizing data, and I can ensure that the collected data is accurate and well-documented. <br>Output: How are we planning to handle any missing or incomplete data during the cleaning process? Are there any specific data sources or APIs we should consider for data collection?<br>Alice: Meeting Response: Question for: Charles</blockquote><blockquote>My Task: I can work on creating a user interface and API for easy interaction with the ML platform. I have experience in front-end development and API integration. I will ensure that the interface is user-friendly and intuitive, and that the API provides smooth communication between the ML platform and external systems.</blockquote><blockquote>Output: Charles, do we have any specific requirements or preferences for the user interface design?<br>Charles: I do not. Everyone respond with your final task you want to do and let me know if you are ready to work. If you think this meeting has accomplished our goal for task dividing say you are ready to work.<br>Brad: Meeting Response: Post Reply:</blockquote><blockquote>My Task: I can work on building the underlying infrastructure with CI/CD pipelines. I have experience in setting up automated build and deployment processes. I will ensure that the ML model updates can be smoothly integrated into the production environment with minimal downtime.</blockquote><blockquote>Output: I am ready to work. Are there any specific tools or technologies we should consider for the CI/CD pipelines?<br>Cassandra: Meeting Response: Post Reply:<br>My Task: I can work on testing and validation of the trained model. I have experience in designing experiments and evaluating ML models. I will ensure that the model’s performance is thoroughly tested and validated before deployment.<br>Output: I am ready to work. How should we handle potential issues like overfitting or underfitting during the model validation process? Is there a specific validation framework or methodology we should follow?<br>Brad: Meeting Response: Post Reply:</blockquote><blockquote>My Task: I can work on monitoring systems to observe for drifts in the production environment. I have experience in setting up monitoring tools and alert systems. I will ensure that any potential model drifts are detected early and addressed promptly.</blockquote><blockquote>Output: I am ready to work. Are there any specific monitoring tools or metrics we should focus on for detecting model drifts?<br>Alice: Meeting Response: Post Reply:</blockquote><blockquote>My Task: I can work on feature engineering and model selection. I have a strong background in statistics and machine learning algorithms. I can analyze the data and engineer relevant features for model training. I will also evaluate different models and select the most suitable one based on performance metrics.<br>Output: I am ready to work. Do we have a designated testing dataset for evaluating the model’s performance?</blockquote><blockquote>My name is: Brad</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cee91fd663b2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cuda OOM? Learn the Basics of Larger-Than-Memory Models]]></title>
            <link>https://medium.com/@charles.curt/cuda-oom-learn-the-basics-of-larger-than-memory-models-482767ac33d6?source=rss-f8a9438f1510------2</link>
            <guid isPermaLink="false">https://medium.com/p/482767ac33d6</guid>
            <category><![CDATA[chatgpt]]></category>
            <category><![CDATA[llm]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[gpu]]></category>
            <dc:creator><![CDATA[Charles Curt]]></dc:creator>
            <pubDate>Thu, 15 Jun 2023 00:07:08 GMT</pubDate>
            <atom:updated>2023-06-15T00:07:08.635Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*ncuxPeAunWlTiA_J6LqD6g.jpeg" /><figcaption>deepai.org</figcaption></figure><p>Thinking about training a machine-learning model? Is it a gigantic model eating up all your GPU’s memory? Or perhaps it’s a smaller model, but you’re attempting to feed it an ocean of data.</p><p>These problems will increasingly pop up as we push LLMs further into everything. I’ll give a general overview and links to the papers about these so you can dig deeper into what you find interesting.</p><p><strong>I’m sure there are many methods I am missing in this, but I will only be covering techniques I have personally studied or tested out.</strong></p><p><a href="https://arxiv.org/pdf/2207.00032.pdf">Also, here’s one of my favorite papers on how ChatGPT is inferencing.</a></p><p><em>Rough calculations for GPU requirements: Transformer Models</em></p><pre>###<br># Training<br>###<br><br>Model_Parameters_Memory = Params * Precision<br>Intermediate_Activations_Memory = Seq_Length * Seq_Length * Attention_Heads * Precision<br>Optimizer_Memory = Params * Optimizer_Requirement<br>Gradient_Memory = Params * Precision<br>Input_Memory = Input_Size * Batch_Size * Precision<br><br>Total_Memory_Training = Model_Parameters_Memory + Intermediate_Activations_Memory + Optimizer_Memory + Gradient_Memory + Input_Memory<br><br>###<br># Inference<br>###<br><br>Model_Parameters_Memory = Params * Precision<br>Intermediate_Activations_Memory = Seq_Length * Seq_Length * Attention_Heads * Precision<br>Input_Memory = Input_Size * Batch_Size * Precision<br><br>Total_Memory_Inference = Model_Parameters_Memory + Intermediate_Activations_Memory + Input_Memory</pre><p><a href="https://www.microsoft.com/en-us/research/uploads/prod/2020/09/dnnmem.pdf">Here’s a Microsoft paper that tries to do this a lot more accurately</a></p><p>There are two core concepts when dealing with larger-than-memory models.</p><ol><li>Splitting the Model up into different components across different machines.</li><li>Offloading the Model onto the computer until you need to process it.</li><li>They are shrinking the Model by reducing certain aspects while trying to keep it as similar as possible.</li></ol><h3>Splitting the Model</h3><p>Splitting a model up is as simple as it sounds. How do you divide a model up to part certain parts on specific computers? I won’t discuss minor details like row or column division methods.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1008/1*RkEzzKlSWcUvLcbJjITwWg.png" /><figcaption><a href="https://www.deepspeed.ai/tutorials/pipeline/">Deepspeed Pipeline parallelism</a></figcaption></figure><p><strong>Data Parallelism: one Model of many data </strong><a href="https://arxiv.org/pdf/2006.15704.pdf">Paper</a></p><p>Here, we split the data across GPUs on different machines. The gradients are communicated between the devices, letting us update our model parameters efficiently.</p><p><strong>Model Parallelism: one data many models </strong><a href="https://arxiv.org/pdf/2201.12023.pdf">Automatic Model Parallel</a></p><p>Let’s say our Model is too large to fit onto a single GPU. Enter Model Parallelism. We split the Model across multiple GPUs, which can be on a single machine or various devices. This way, we can train even larger models efficiently.</p><p><strong>Pipeline Parallelism: one data many models (but different) </strong><a href="https://arxiv.org/pdf/1811.06965.pdf">Paper</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WTwEMbHGbYunAdMOdQSILg.png" /></figure><p>Think of an assembly line. That’s what Pipeline Parallelism is like. We place different layers of the Model on different GPUs, executing the layers pipelined. This increases our computational efficiency and GPU utilization.</p><h3><strong>Offloading the Model</strong></h3><p>Model offloading refers to techniques that allow parts of a model to be stored off the primary device during training to save memory. Here are some standard model offloading techniques:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hTV6nZxhl2GsmMEkOIOYTA.png" /><figcaption>Microsoft Deepspeed</figcaption></figure><p><strong>Gradient Checkpointing: </strong><a href="https://arxiv.org/abs/1604.06174">Paper</a></p><p>This technique reduces memory usage by discarding intermediate outputs in the forward pass and recomputing them during the backward pass. This can significantly reduce memory usage at the cost of increased computation. There are also a lot of variations on what you calculate and when in this method.</p><p><strong>Activation Offloading:</strong></p><p>This is a more advanced form of Model offloading where the activation tensors (the outputs of each layer) are offloaded to CPU memory or disk during training. This can significantly reduce GPU memory usage, but it requires efficient management of the unpacked data to minimize the impact on training speed.</p><p><strong>Parameter Offloading:</strong></p><p>This technique offloads the model parameters to CPU memory or disk. This is typically used in conjunction with activation offloading to reduce GPU memory usage further.</p><h3>Shrinking the Model</h3><p>The core concept here is to find a way to reduce the model size itself. This is used, for example, to get a model running on your cellphone.</p><p><strong>Mixed Precision Training: </strong><a href="https://arxiv.org/pdf/1710.03740v3.pdf">Paper</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NsoyYbn85ze6-Fj_JzZlNQ.png" /></figure><p>Mixed precision training can significantly reduce memory usage using lower-precision (e.g., half-precision) data types for certain model parts. This can be combined with other offloading techniques for even more significant memory savings.</p><p><strong>IMPORTANT NOTE:</strong></p><p>Mixed Precision is a critical key component to speed up training and the way GPUs are made nowadays. If you are wondering why big companies are “wasting” their money on these expensive GPUs almost as fast as your at-home GPU, you must watch this video on why that is untrue.</p><p><a href="https://www.youtube.com/watch?v=x_RfyVkGBvg&amp;t=192s">Check out the graphic to understand and hopefully you’ll connect the dots on these “absurd” costs from Nvidia.</a></p><h3>Combination of Methods</h3><p><strong>Out-of-Core Training: </strong><a href="https://arxiv.org/pdf/2104.07857.pdf">Paper</a></p><p>Methods: Optimizer offloading, Gradient offloading, Parameter offloading</p><p>This is a more extreme form of model offloading where the entire Model is stored on disk, and only small parts are loaded into GPU memory as needed. This allows for the training of huge models that would not fit into the memory of a single machine, even with other offloading techniques. However, it requires a fast storage system to minimize the impact on training speed.</p><p><strong>Offloading: </strong><a href="https://arxiv.org/pdf/1910.02054.pdf">Paper</a>,</p><p>Methods: Optimizer offloading, Gradient offloading, Parameter offloading</p><p>Developed by Microsoft, ZeRO is a memory optimization technique that reduces the memory footprint of model parameters, gradients, and optimizer states. It does this by partitioning these elements across data parallel processes, effectively allowing the model size to scale linearly with the number of GPUs.</p><p><strong>Sharding: </strong><a href="https://arxiv.org/pdf/2304.11277.pdf">Paper</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sTbqqBnZvqlGUhYOFwck6A.png" /></figure><p>Methods: Optimizer offloading, Gradient offloading, Parameter offloading, and data parallel</p><p>Truly massive models and datasets; we have Sharding. We split the Model and the data across multiple machines, each responsible for different parts of the Model and data subsets. Among the more recent methods shown here, and is inspired by Deepspeed’s offload mechanisms.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=482767ac33d6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Training Self-Supervised Vision Transformers]]></title>
            <link>https://medium.com/@charles.curt/training-self-supervised-vision-transformers-incomplete-2ec14b434d8a?source=rss-f8a9438f1510------2</link>
            <guid isPermaLink="false">https://medium.com/p/2ec14b434d8a</guid>
            <dc:creator><![CDATA[Charles Curt]]></dc:creator>
            <pubDate>Sun, 11 Jun 2023 19:16:56 GMT</pubDate>
            <atom:updated>2023-06-15T20:25:27.022Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*0L-zVCjuPzK9Zr9gHo_-bg.jpeg" /><figcaption>deepai.org</figcaption></figure><p>For the theory buildup to this, see my last post. You’ll get everything you need to understand the theory of this application.</p><p><a href="https://medium.com/@charles.curt/towards-large-scale-vision-transformers-incomplete-67e5adcc097">Towards Large-Scale Vision Transformers</a></p><p>In this post, I will go over how you might practically implement a large-scale training system for a vision transformer on vast gobs of data.</p><h3><strong>Topics:</strong></h3><ul><li><strong><em>Translating Theory into Action</em></strong></li><li><strong><em>Data Data Data</em></strong></li><li><strong><em>Big Computation</em></strong></li><li><strong><em>Communications</em></strong></li><li><strong><em>Systems in Action</em></strong></li></ul><h3>Application</h3><p><strong><em>Translating Theory into Action</em></strong></p><p>From my last post, you should know how these systems are trained and what performing self-supervision on images means.</p><p>Go read it.</p><p>In a practical sense, these models are massive but not Language model size quite yet. DinoV2 is what we’ll go over today, and its best model choice is “only” 1.1 Billion parameters. However, because of the Dino method, you are looking at more than double those parameters in reality.</p><p>The biggest issues when you deal with a model this size are:</p><ul><li>How to handle &gt;1B parameters (Another blog on this topic).</li><li>How to handle hundreds of millions of images or even 1B.</li><li>How to communicate between multiple machines effectively (which is critical for FSDP). <a href="https://medium.com/pytorch/pytorch-data-parallel-best-practices-on-google-cloud-6c8da2be180d">Check out this post on why high-end communications are important for this method.</a></li></ul><p>The method used in the paper is FSDP, a method of offloading similar to Deepspeed’s tools by Microsoft’s Zero-3.</p><p>So let’s set up a situation and determine how we will perform this training.</p><p><strong>Situation:</strong></p><ul><li>You have a Billion Images</li><li>You want to perform self-supervision.</li><li>You want to use this on your own custom data.</li><li>Maybe you want to play with a method like <a href="https://arxiv.org/abs/2209.07819">WS-Dino</a></li></ul><p>Let’s dig into the method used by DinoV2: <a href="https://github.com/pytorch/tutorials/blob/0ef9a65c8d3a995fcb97c9d09be7a39418051c4f/intermediate_source/FSDP_tutorial.rst">FSDP</a>, <a href="https://engineering.fb.com/2021/07/15/open-source/fsdp/">FSDP Blog</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M4UZrWBVZAeYGf26AS-RPA.png" /><figcaption>FSDP (blog link)</figcaption></figure><p>Here’s a chatgpt prompt to help you dig even deeper as you read those links above. Plugins used: (AskYourPDF, ChatWithGit)</p><p>Prompt #1</p><blockquote>I am trying to learn more about Facebook’s FSDP method. Can you give me some summaries to better understand it? Askmypdf: https://arxiv.org/pdf/2304.11277.pdf ChatwithGit: https://github.com/facebookresearch/fairscale ML Paper Reader: read these above systems and give me a list of similar papers. Go read those papers and try out the GitHub of fair scale to better understand it. Give me a few different descriptions of it in different ways. I also want you to take what you read and learned about it and see if there are more papers similar by facebook you can fine.</blockquote><p>Prompt #2</p><blockquote>Read the paper again and give me an overview of the topics covered in it. Tell me what you think is the most critical component to understand in this system. Topics I want you to read for this understanding: — First reading: model replication, partitioning, sharding — Second Reading: System Design — Third Reading: Communications Note I want you to read this paper 3 times in different ways as the above suggests before you give me an overview of these topics and the most important parts of it. I also want you to read fairscale’s architecture for FSDP and give me a few code examples from the repo that you think are important based on the readings you previously did to help me understand it better.</blockquote><p><strong><em>Data Data Data</em></strong></p><p>Now that we understand how this stuff is working let’s move on to how you deal with so many images for training.</p><p>The rough idea is to implement an efficient data storage method. You can give read my blog specifically on this.</p><p><a href="https://medium.com/@charles.curt/three-questions-answered-in-deep-learning-research-at-scale-for-the-swe-2-3-46192f1ab870">How to handle tens to hundreds of TBs of data for training?</a></p><p>When it comes to Dino, in particular, you have some work cut out for you to implement your own custom data in the framework. The first question to ask is what kind of data you are trying to put into the system. An open-source dataset? You’re in luck. That’s pretty easy. If not, I suggest implementing DinoV2 first with ImageNet setup and trying an Epoch of training, and then rewriting the data class and data loader for yourself.</p><p>The best method I found to learn the DinoV2 framework was ChatWithGit plugin on GPT4. Ask it in particular about the data class setup.</p><blockquote>Use ChatWithGit and go to Dinov2 by facebook Here is the link: <a href="https://github.com/facebookresearch/dinov2">https://github.com/facebookresearch/dinov2</a></blockquote><p><strong><em>Computation</em></strong></p><p>This is another big topic of which my first suggestion is to use Slurm, not Kubernetes, for orchestrating this big of a job.</p><p>I suggest you dig into Slurm, as it will make your life significantly easier for this initial debugging stage (personal experience). If you want to switch over to Kubernetes training after that’s fine. Understand it is a layer of complexity on top of a complex system.</p><p>What kind of system will you need for this training? The paper said they used 22000 GPU hours. Now if you want to do that yourself, be my guest. I suggest taking their pre-trained backbone and fine-tuning it on your own dataset. When running this, We did exactly that, take their pre-trained model and pass all of our images through the self-supervision method. It allowed us to train far fewer epochs than required by the full training.</p><p>An interesting thing to note is that this model used 3.7 tons of C02, for context, an average car generates about 4.5 tons of C02 per year. That’s a lot of model!</p><p>Here are some rough steps you’ll need to do in an AWS environment to get this.</p><ul><li>Talk to your AWS rep. If you haven’t tried already, note that getting your hands on these larger and more advanced GPU computers is nearly impossible. Let alone getting a tightly clustered system of them. You need to talk to them to get a particular solution offered internally (hush hush).</li><li>AWS Parallel Cluster (Slurm) setup. <a href="https://www.hpcworkshops.com/01-hpc-overview.html">AWS Workshop to start you off</a>.</li><li>Lustre Filesystem testing.</li><li>Understanding of distributed communications and EFA.</li></ul><p><strong><em>Communications</em></strong></p><p><a href="https://medium.com/@charles.curt/hpc-networking-for-deep-learning-f058d9240735">See my post specifically on the theory behind HPC communications.</a></p><p>I am now assuming you know this.</p><p>Here are the documentation links you’ll need to know:</p><ul><li><a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/placement-groups.html">Placement Groups</a></li><li><a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/efa.html#efa-instance-types">EFA</a></li><li><a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/enhanced-networking-ena.html">ENA</a></li></ul><p>Step one, get your nodes in a tightly bound deployment on AWS.</p><ul><li>Make a placement group</li><li>You also need to ensure your nodes are in the same VPC and AZ</li><li>Ensure your node supports EFA and ENA.</li></ul><p>Read my original post on this, but the summary for EFA and ENA is that EFA is the software that enables bypass, and ENA is the hardware.</p><p><strong><em>Systems in action</em></strong></p><p>So let’s summarize one last time all the steps to get here.</p><ul><li>Know Dino</li><li>Know the distributed training methods</li><li>Get access to advanced computational systems</li><li>Setup SLURM in AWS Parallel Cluster</li><li>Setup tightly clustered nodes</li><li>Test your Dinov2 model on a small scale and learn the data class</li><li>Update Dino data class for your own data</li><li>Deploy and monitor in small increments to ensure quality</li></ul><p>What can you expect when training such large models?</p><ul><li>Communication initialization can hang if you mess up the setup</li><li>Sometimes cross traffic may reduce your communications between these nodes due to other heavy jobs on the cluster.</li><li>You will need to plan ahead of time before running anything</li><li>Test a lot of things on a small scale. A failure after you set up a massive cluster is NOT cheap.</li><li>Using something like Nvidia Nsights when testing small scale is helpful not only for learning the distributed method but also for finding your parameters.</li></ul><p><strong><em>Review</em></strong></p><p>If you&#39;re stuck in there and actually read my rambles, you’re a pro. These systems have a fundamental advantage in allowing the researchers you support to reduce their cycle time from days to hours.</p><p>When researchers can answer multiple questions in a single day, they can exponentially move their research faster.</p><p>In this post, I covered DinoV2, its methods, and how you can go about implementing them.</p><figure><img alt="Deepai.org attempting to say goodbye" src="https://cdn-images-1.medium.com/max/1024/1*eN_jxOnmlZhrL0yHosd7bg.png" /></figure><p>If you have any thoughts or want to complain about my article, shoot me an email! If there are any grammar mistakes, complain to Grammarly.</p><p>Curt.Charles.EE@gmail.com</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2ec14b434d8a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>