<?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:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:googleplay="http://www.google.com/schemas/play-podcasts/1.0"><channel><title><![CDATA[Engineering Ideas]]></title><description><![CDATA[Ethics, AI Safety, physics of intelligence and agency, organisation and community engineering, methodology.]]></description><link>https://engineeringideas.substack.com</link><image><url>https://substackcdn.com/image/fetch/$s_!EJj2!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F55443e67-0a66-4164-8473-09b13a2e90ca_256x256.png</url><title>Engineering Ideas</title><link>https://engineeringideas.substack.com</link></image><generator>Substack</generator><lastBuildDate>Tue, 21 Apr 2026 19:05:28 GMT</lastBuildDate><atom:link href="https://engineeringideas.substack.com/feed" rel="self" type="application/rss+xml"/><copyright><![CDATA[Roman Leventov]]></copyright><language><![CDATA[en]]></language><webMaster><![CDATA[engineeringideas@substack.com]]></webMaster><itunes:owner><itunes:email><![CDATA[engineeringideas@substack.com]]></itunes:email><itunes:name><![CDATA[Roman Leventov]]></itunes:name></itunes:owner><itunes:author><![CDATA[Roman Leventov]]></itunes:author><googleplay:owner><![CDATA[engineeringideas@substack.com]]></googleplay:owner><googleplay:email><![CDATA[engineeringideas@substack.com]]></googleplay:email><googleplay:author><![CDATA[Roman Leventov]]></googleplay:author><itunes:block><![CDATA[Yes]]></itunes:block><item><title><![CDATA[Tasklet is the "o1 moment" for long-horizon AI agents that learn on the job]]></title><description><![CDATA[A couple of weeks ago, Andrew Lee unveiled Tasklet, an AI agent with a two-tier design: a long-lived, high-level agent curates the system prompt, toolset, and memories for individual &#8220;sub-agents&#8221;, i.e., individual task runs.]]></description><link>https://engineeringideas.substack.com/p/tasklet-is-the-o1-moment-for-long</link><guid isPermaLink="false">https://engineeringideas.substack.com/p/tasklet-is-the-o1-moment-for-long</guid><dc:creator><![CDATA[Roman Leventov]]></dc:creator><pubDate>Mon, 27 Oct 2025 15:52:34 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!EJj2!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F55443e67-0a66-4164-8473-09b13a2e90ca_256x256.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>A couple of weeks ago, Andrew Lee unveiled <a href="https://tasklet.ai/release-notes">Tasklet</a>, an AI agent with a two-tier design: a long-lived, high-level agent curates the system prompt, toolset, and memories for individual &#8220;sub-agents&#8221;, i.e., individual task runs.</p><p>Memories and results are stored in an SQL database and made available for the sub-agents to explore via SQL queries (agentic search in the DB) to build the context for the specific task. For example, for a customer relationship tasklet, the sub-agent may be tasked to respond to an e-mail from the customer, and it may search in the database past interactions with that specific customer; if this is a new customer inquiring about product X, the sub-agent may search in the database for past sales of product X.</p><p>The system invites feedback from the user at the end of the task runs for the higher-level agent to curate the data/memories/results and to improve the system instructions for future runs.</p><p>Please read or listen to <a href="https://www.cognitiverevolution.ai/always-bet-on-the-models-how-tasklet-puts-the-agency-in-agents-with-ceo-andrew-lee/">Andrew Lee&#8217;s interview by Nathan Labenz</a> for more details. I highly recommend it.</p><p>Also recently, Anthropic introduced <a href="https://www.anthropic.com/news/skills">Agent Skills</a> for Claude. Agent Skills is a move away from MCP servers towards simple .md instructions for using this or that app or API that are downloaded by the user and could be edited by the user or AI agents, unlike MCP servers that have static, predefined commands and prompts that the user could only turn on or off, but not adjust for their needs.</p><p>The adaptable Agent Skills resonate with the Tasklet system design: Tasklet also prefers using HTTP APIs over MCPs and building context-specific instructions for using specific HTTP APIs effectively.</p><p>I believe that these two announcements are a kind of &#8220;o1 moment&#8221; (from <a href="https://openai.com/o1/">OpenAI&#8217;s o1 model announcement</a>) in the domain of <strong>long-horizon, continually learning AI agency</strong> that <a href="https://www.dwarkesh.com/p/timelines-june-2025">Dwarkesh Patel has made a meme from</a>. (For more recent context, see <a href="https://www.interconnects.ai/p/contra-dwarkesh-on-continual-learning">Nathan Lambert&#8217;s contra opinion</a> from two months ago.)</p><p><strong>That is, I believe that the Tasklet two-tier design, plus post-training LLMs by frontier AI labs (starting with Anthropic, obviously, but there is no doubt that all other apps are doing this too or will soon follow) to be more effective at picking up &#8220;skills&#8221;, i.e., lengthy and possibly multi-file text instructions for using this or that app or API, is sufficient for </strong><em><strong>prosaic</strong></em><strong> continual learning, and in a few months a lot of providers are going to replicate and advance this AI agent architecture.</strong></p><p>Above, I referred to this as an &#8220;o1 moment&#8221; because Tasklet&#8217;s two-tier system design is not surprising. It was an &#8220;open secret&#8221; that OpenAI are doing RL on LLM throughout 2024. The key is a credible demonstration that this design <em>works</em>, at which point many players will rush to replicate it. In the same vein, very soon after the o1 model announcement, many AI labs began doing RL on LLMs and soon matched OpenAI&#8217;s results, most famously DeepSeek.</p><p>The main difference of the Tasklet announcement from OpenAI&#8217;s o1 announcement is, of course, that Tasklet is much lower profile and didn&#8217;t make a huge splash, but I&#8217;m sure that all the relevant players have taken note.</p><h2><strong>Let&#8217;s build open-source Tasklet-like agents where users fully own their context</strong></h2><p>Tasklet&#8217;s product design is good for <a href="https://intelligence-curse.ai/breaking/#section-4">AI diffusion</a>, and hence net positive from the perspective of economic disempowerment. But Tasklet is still a classical SaaS that owns and locks in its data, which leads to <a href="https://agentictech.substack.com/p/the-context-wars-notes-from-a-gathering">AI context fragmentation</a> for the users.</p><p>Building an <strong>open-source Tasklet alternative on top of <a href="https://engineeringideas.substack.com/p/the-personal-ai-platform-technical">the personal AI data platform</a></strong> (I&#8217;ve called it <strong>Pocketdata</strong>) <strong>would let the user still be in full ownership and control of all of their context</strong>, along with other benefits that I outlined in <a href="https://engineeringideas.substack.com/p/personal-agents">this post</a>:</p><ul><li><p>strict &#8220;pay only for the inference that you have actually used&#8221; billing with the option to self-host,</p></li><li><p>the freedom to swap LLM models and other service providers (including local, fully private inference), and</p></li><li><p>the freedom to mix and match with other pieces of their personal data plane, such as chats or deep research.</p></li></ul><p><strong>If you are interested in building (or already building) an open Tasklet alternative with the above characteristics, let&#8217;s talk!</strong> You can reach me at leventov.ru@gmail.com. I&#8217;m personally busy building Pocketdata (the infrastructure), and there is enough complexity and groundwork there to require my full attention for many more months. On the other hand, if you are focusing on agent engineering, you may want to delegate the infrastructure work to someone.</p><h2><strong>Why Pocketdata is the right platform for personal Tasklet-like agents</strong></h2><p>In the rest of this post, I&#8217;ll make an argument for why Pocketdata is the &#8220;right&#8221; platform for Tasklet-like agents if the aim is to make these agents fully private, user-owned, secure, and self-hostable.</p><p>There has already been significant convergence between Pocketdata and Tasklet&#8217;s agent design unbeknownst to me. The &#8220;<a href="https://engineeringideas.substack.com/i/173162413/agentsmd-equivalent-for-the-personal-data-plane">AGENTS.md equivalent for personal data</a>&#8220; that I&#8217;ve proposed is suspiciously similar both to &#8220;skill&#8221; and the tasklet sub-agent&#8217;s instruction for querying past data in its memories and past results.</p><p>Also, since publishing the first <a href="https://engineeringideas.substack.com/p/the-personal-ai-platform-technical">technical blueprint</a> for Pocketdata, I made two significant changes to the platform design, both of which are conducive to building an open-source Tasklet alternative on top of Pocketdata.</p><h3><strong>From Pocketbase to Postgres</strong></h3><p>First, I&#8217;ve ditched the idea of using vanilla <a href="http://pocketbase.io/">Pocketbase</a>. I replaced it with Postgres and plan to later rebuild a &#8220;Postgres-flavoured Pocketbase&#8221; on top of it, such as Zhenruyan&#8217;s &#8220;<a href="https://github.com/zhenruyan/postgrebase">Postgrebase</a>&#8220;.</p><p>The major reason for this change is that choosing Pocketbase as the primary storage in Pocketdata forces AI apps that may onboard Pocketdata to be modified on the source code level, and perhaps quite significantly so if they don&#8217;t use ORMs or other suitable abstractions. For example, <a href="https://github.com/Mail-0/Zero">Mail Zero</a> supports only Postgres as the storage. Realistically, this would be too big an ask for open-source AI app developers to invest resources in supporting Pocketdata unless/until it gains a huge user base.</p><p>On the other hand, with the Postgres-first approach, onboarding AI apps on the platform requires just some config changes, perhaps Dockerfile and init script changes, and upstreamable bug fixes and improvements. This is much more sustainable for Pocketdata to maintain on our own for a few key apps (such as Open WebUI, Mail Zero, the proposed open Tasklet reimplementation, and the like), without asking permission from the maintainers of the upstream projects.</p><p>Initially, all apps will have their own <a href="https://www.postgresql.org/docs/current/ddl-schemas.html">schemas</a> and users in Postgres, and these Postgres users have read and write rights only in their respective schemas, ensuring isolation between the apps.</p><p>When the Postgres in Pocketdata regains Pocketbase/Postgrebase-derived Go sidecar and the &#8220;common schema&#8221; <a href="https://pocketbase.io/docs/collections/">collections</a>: chats, notes/docs, emails, etc. (see discussion in the <a href="https://engineeringideas.substack.com/i/173162413/the-common-data-schema-to-be-determined">previous post</a>), the AI apps <em>could</em> start to expose and integrating their data with the rest of the &#8220;personal data plane&#8221; gradually, by dual-writing to their own schema and to &#8220;Pocketbase-owned&#8221; collections (living in their own, protected schema to which only the <code>postgres</code> superuser can write). Alternatively, for the key apps such as Open WebUI, these integrations could be shipped by the Pocketdata itself in the same permissionless way, by bundling the required <a href="https://pocketbase.io/docs/go-event-hooks/">hooks</a> for Open WebUI&#8217;s (Mail Zero&#8217;s, etc.) data schema in Pocketdata&#8217;s container image.</p><p>Another, slightly unexpected advantage of using Postgres and the &#8220;separate Postgres schema and Postgres user per app&#8221; design is that it permits <a href="https://pocketbase.io/docs/js-database/#executing-queries">raw SQL queries in JS hooks</a> with proper app isolation via a trick: wrapping all raw SQL queries in JS hooks as <a href="https://www.postgresql.org/docs/current/sql-createfunction.html#SQL-CREATEFUNCTION-SECURITY">functions with a SECURITY DEFINER clause</a> when apps register their hooks (I&#8217;ve mentioned the idea of apps owning their hooks <a href="https://engineeringideas.substack.com/i/173162413/other-pocketbase-plugins-required">here</a>).</p><p><strong>Tasklet-like agents should each have their separate Postgres schemas and users for strong isolation</strong>, i.e., they should be separate &#8220;apps&#8221; in the Pocketdata platform.</p><h3><strong>From LiteLLM to Bifrost and Agentgateway</strong></h3><p>In the previous post, I wrote that &#8220;LiteLLM doesn&#8217;t have serious alternatives at the moment&#8221; as an LLM gateway. However, after another series of gripes with LiteLLM&#8217;s performance and <a href="https://github.com/BerriAI/litellm/discussions/8044">code quality</a>, I&#8217;ve tried to search for alternatives once again, and I&#8217;m happy to report that there is a serious alternative to LiteLLM as a standalone LLM gateway server: <a href="https://github.com/maximhq/bifrost">Bifrost</a>.</p><p>Bifrost is written in Go and uses the <a href="https://github.com/valyala/fasthttp">fasthttp</a> library. This makes me confident in its performance and low memory footprint for streaming LLM requests. This enables hosting Bifrost on the same Fly machine with Postgres and its sidecars (pgBackRest, pgBouncer, and the <a href="https://github.com/pocketbase/pocketbase">Pocketbase</a>-like Go process), albeit in a different <a href="https://community.fly.io/t/docker-without-docker-now-with-containers/22903">container</a>.</p><p>Since Bifrost is not an MCP gateway nor a generic OpenAPI gateway, a separate gateway would be needed for these purposes. <a href="https://github.com/agentgateway/agentgateway">Agentgateway</a> is covering this. Since Agentgateway is written in Rust, it could also live in the same Fly machine. However, since Agentgateway doesn&#8217;t support storing config and auth keys in Postgres (cf. <a href="https://github.com/agentgateway/agentgateway/pull/350">this PR</a>), there is some work to do, but it should be relatively straightforward.</p><p>Note that LiteLLM is an LLM and MCP gateway, but not a full-fledged HTTP API gateway. Therefore, the introduction of a separate gateway system was inevitable even if Pocketdata was still using LiteLLM.</p><p>As Andrew Lee described in the <a href="https://www.cognitiverevolution.ai/always-bet-on-the-models-how-tasklet-puts-the-agency-in-agents-with-ceo-andrew-lee/">interview</a>, Tasklet agents are more successful in accessing services via HTTP APIs than MCPs, provided that the agents have access to &#8220;skills&#8221; to teach them how to use these service APIs.</p>]]></content:encoded></item><item><title><![CDATA[The personal AI platform: technical blueprint]]></title><description><![CDATA[Pocketbase and LanceDB for extensible personal AI data plane and system of record]]></description><link>https://engineeringideas.substack.com/p/the-personal-ai-platform-technical</link><guid isPermaLink="false">https://engineeringideas.substack.com/p/the-personal-ai-platform-technical</guid><dc:creator><![CDATA[Roman Leventov]]></dc:creator><pubDate>Tue, 09 Sep 2025 09:28:54 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!0zhz!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feed83dcf-2651-404c-9c93-aab479c39af4_1460x1214.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Giving a more concrete shape to the platform part of the <a href="https://engineeringideas.substack.com/p/personal-agents">Personal Agents</a> vision. The primary <a href="https://engineeringideas.substack.com/p/personal-agents">motivations</a> for the Personal Agents agenda are: reduce the power imbalance between "Big Token" corps and people; and enable political and media innovation through deployment of personal "<a href="https://aligned.substack.com/p/a-proposal-for-importing-societys-values">political representative</a>" AI agents, "<a href="https://jimruttshow.blubrry.net/the-jim-rutt-show-transcripts/transcript-of-ep-238-sam-sammane-on-humanitys-role-in-an-ai-dominated-future/">info agents</a>", and the like.</p><h4>Summary</h4><p>The <a href="https://engineeringideas.substack.com/p/architecture-theory-and-the-hourglass">unifying abstraction</a> between various personal AI apps and integrations should be the <strong>common models (schemas and access APIs) for personal context data: chats with AI, notes/documents, emails, tables/records, visited web pages</strong>, media feeds such as news and podcasts, and so on.</p><ul><li><p>AI chats, notes, and tables live in <a href="https://github.com/pocketbase/pocketbase">Pocketbase</a>.</p></li><li><p>Immutable objects: web page snapshots, emails, PDF docs, and media (podcasts, images, etc.) go to <a href="https://github.com/lancedb/lancedb">LanceDB</a>.</p></li><li><p>LLM requests and responses (for AI app debug, LLM usage analysis/audit, and "Reasoning" collapsible expansion in AI chat UIs) and service API call logs are also stored in LanceDB.</p></li></ul><p>Pocketbase connects to the personal computer to sync browsed web pages, notes and tables (e.g., from Obsidian), and personal media. Alternatively, the app running on the personal computer can act as an <a href="https://github.com/modelcontextprotocol/servers">MCP server</a> for the AI apps, such as <a href="https://github.com/open-webui/open-webui">Open WebUI</a> that are also deployed privately alongside the <strong>data plane services</strong>:</p><ul><li><p>Pocketbase with app-specific and user-defined JS extensions,</p></li><li><p>The search and data ingestion service that embeds LanceDB,</p></li><li><p>The LLM, MCP, and service API proxy that is based on <a href="https://github.com/BerriAI/litellm">LiteLLM</a> and also embeds LanceDB for storing LLM (and other service API calls, such as web search, web scraping, audio transcription, media generation, etc.) requests, responses, and costs.</p></li></ul><p>The personal AI platform (that includes the data plane and the AI apps that use it, such as Open WebUI) could be deployed either in a private VPS or in a cloud service such as <a href="https://fly.io/">Fly.io</a>, where each user has a separate private <a href="https://fly.io/docs/security/org-roles-permissions/">org</a> to which they can deploy custom AI apps at will.</p><p>The fact that the data plane is private, not censorable, and not owned by a big tech corp should increase people's trust and willingness to upload their personal data: browsing history, emails via IMAP from Gmail, etc.</p><p>In turn, this personal context data is very attractive for AI app developers who face the "cold start" problem: <strong>the AI app isn't very useful until it has access to the personal context</strong>. The common data model for things like chats with AI, notes/documents, e-mails, etc., makes a "warm start" possible: people can deploy the AI app privately and see how it works with their existing chats, documents, and other context. Thus, people can experiment with different AI apps without any data import/export hassle.</p><p>Many apps have chat UIs so they can leverage the common data model. Yet, the apps still can differentiate a lot in terms of their focus and specific knowledge (think financial assistant vs. psychotherapist), communication styles and agency levels ("analyst" vs. "doer"), personalisation abilities, tools such as web search or MCP used, etc.</p><p>Specialised apps such as medical or financial consultants can do vector search over all of the existing personal context across modalities (AI chats, search and browsing history) proactively while the app is executed for the first time to personalise the suggested prompts or even start working on the user's recent questions or problems right away.</p><p>The freedom of choice between different AI apps and LLMs providers, the ability to vibe code the personal system of record, and unified billing for hosting, LLM calls, and other API services should make the personal AI platform <a href="https://engineeringideas.substack.com/i/166118930/personal-agents-offer-mundane-value">more attractive</a> to people than limited, "one size fits none" subscription offerings from big tech corps.</p><p><strong>This is the first post in a three-part series.</strong> In the rest of this post, I detail the reasoning behind the technical decisions that shaped this personal AI platform vision so far, concerning the personal data plane architecture for <strong>deployment simplicity, durability, and amenability to multiple AI apps coexisting on the platform</strong>. I also describe <strong>the development path to the </strong><em><strong>minimum viable</strong></em><strong> personal AI platform</strong> at the end of this post.</p><p>In the second post, I'll focus on the platform's <strong>privacy and security architecture</strong>. After that, I'll discuss possible <strong>PaaS providers&#8217; and AI app developers&#8217; business models</strong> for the personal AI platform.</p><h4>The middle level in the personal AI platform's hourglass architecture: databases, data model, and query APIs</h4><p>For the context on multi-level/layer architectures, see my earlier posts "<a href="https://engineeringideas.substack.com/p/architecture-theory-and-the-hourglass">Architecture theory and the hourglass model</a>" and "<a href="https://engineeringideas.substack.com/p/ai-agency-architecture-in-the-large">AI agency architecture-in-the-large: the relevant levels of abstraction</a>".</p><p>The idea that <strong>the "personal AI app platform" should be a </strong><em><strong>data</strong></em><strong> platform first and foremost</strong> seems so self-evident to me that I'm having a hard time explaining why I think so: I don't even see realistic alternatives. Cf. the proposition that I made in another recent post: that AI app developers should better "<a href="https://engineeringideas.substack.com/i/168052480/use-immutable-data-schemadesign-to-unify-applications-persistence-and-tracing">use immutable data schema/design to unify app's persistence and tracing</a>".</p><p>Here's the obligatory hourglass diagram:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!0zhz!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feed83dcf-2651-404c-9c93-aab479c39af4_1460x1214.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!0zhz!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feed83dcf-2651-404c-9c93-aab479c39af4_1460x1214.png 424w, https://substackcdn.com/image/fetch/$s_!0zhz!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feed83dcf-2651-404c-9c93-aab479c39af4_1460x1214.png 848w, https://substackcdn.com/image/fetch/$s_!0zhz!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feed83dcf-2651-404c-9c93-aab479c39af4_1460x1214.png 1272w, https://substackcdn.com/image/fetch/$s_!0zhz!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feed83dcf-2651-404c-9c93-aab479c39af4_1460x1214.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!0zhz!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feed83dcf-2651-404c-9c93-aab479c39af4_1460x1214.png" width="1456" height="1211" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/eed83dcf-2651-404c-9c93-aab479c39af4_1460x1214.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1211,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:210231,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://engineeringideas.substack.com/i/173162413?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feed83dcf-2651-404c-9c93-aab479c39af4_1460x1214.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!0zhz!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feed83dcf-2651-404c-9c93-aab479c39af4_1460x1214.png 424w, https://substackcdn.com/image/fetch/$s_!0zhz!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feed83dcf-2651-404c-9c93-aab479c39af4_1460x1214.png 848w, https://substackcdn.com/image/fetch/$s_!0zhz!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feed83dcf-2651-404c-9c93-aab479c39af4_1460x1214.png 1272w, https://substackcdn.com/image/fetch/$s_!0zhz!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Feed83dcf-2651-404c-9c93-aab479c39af4_1460x1214.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Six months ago and earlier, the vast majority of <a href="https://www.latent.space/p/oai-v-langgraph?open=false#%C2%A7impact-of-agent-frameworks">agentic frameworks</a> were predominantly <strong>focused on the "control flow and intelligence stuff"</strong>: workflow execution, workflow design, agent orchestration, tools, MCPs, and capabilities <strong>rather than persistence and data models</strong>.</p><p><a href="https://docs.convex.dev/agents">Convex Agents</a> is the only exception that comes to my mind. Other frameworks in which the persistence schema is externalised and made somewhat a public API are <a href="https://github.com/letta-ai/letta">Letta</a> (via the <a href="https://github.com/letta-ai/agent-file">Agent File format</a>) and <a href="https://github.com/mastra-ai/mastra">Mastra</a> (see Mastra's <a href="https://mastra.ai/en/docs/server-db/storage#data-schema">data schema</a>). However, neither Letta nor Mastra supports persistence to a <em>reactive database</em>.</p><p>I call a database <em>reactive</em> if it supports real-time data subscriptions and embedding custom HTTP routes/methods and "triggers" written in a popular programming language without severe runtime constraints (to distinguish from good old SQL RDBMS triggers). <em>Data grid</em>, <em>database inside out</em>, and <em>headless CMS</em> are overlapping ideas.</p><p><strong>A reactive database permits independent AI apps</strong> (written in any language and with any agentic framework, or without any framework) <strong>to interoperate around the common data model.</strong></p><p>For example, a specialised app can produce chats with some app-specific fields, but if those chats are still stored in the common <code>chats</code> table, they can at least be searched over, or even picked up by another, generic chat app. This is helpful if the user has abandoned the app that produced some chats, but may still search and access those chats through other, generic AI chat apps (such as Open WebUI) that they still use.</p><p>For the above case, database reactivity <em>per se</em> is not necessary. However, there are plenty of use cases for <em>personal AI-first system of record or exocortex</em> that <em>do</em> require database reactivity and "micro-ETL" within the database, such as:</p><ul><li><p>An LLM workflow that classifies and triages inbound emails.</p></li><li><p>A proactive personal assistant that suggests creating tasks or action items from chats and searches.</p></li><li><p>An "<a href="https://jimruttshow.blubrry.net/the-jim-rutt-show-transcripts/transcript-of-ep-238-sam-sammane-on-humanitys-role-in-an-ai-dominated-future/">info agent</a>" that processes many information feeds (news, podcasts, discussions in groups, cold inbound requests, etc.) to prepare the five most salient/attention-worthy posts or messages per day to present to the human.</p></li></ul><h4>Architectural goals for the personal AI platform</h4><p>In the following few sections, I'm explaining why I picked Pocketbase as the personal data plane's reactive database and LanceDB as the database for searching immutable data and logging LLM and other service API calls, respectively.</p><p>Keep in mind the architectural goals for the personal AI platform that motivate these technology choices:</p><ul><li><p><strong>Simplicity of deployment</strong>: the personal AI platform must be <strong>deployable on a single host</strong>, such as a personal computer or a VPS.</p></li><li><p>Cloud-grade <strong>durability</strong>: even in a single-host setup, it should be possible to durably <strong>back up the data to object storage</strong>, and this backup itself shouldn't require complicated extra machinery. If the object storage service is separate from the VPS hosting, this safeguards the personal data even against abrupt VPS account termination and provides a high degree of <strong>resilience to deplatforming</strong>.</p></li><li><p><strong>Privacy</strong>: the personal AI data platform should be fully functional even when the user's LLM activity doesn't exit the host (or the Fly.io <a href="https://fly.io/docs/security/org-roles-permissions/">org</a> in a cloud setup), with LLM inference through <a href="https://github.com/ollama/ollama">Ollama</a> or similar. It should be possible to configure the data plane such that access to the host machine's local disks doesn't leak personal data, either in self-hosted or cloud setups. So, all data on disks should be encryptable by user-owned keys.</p></li><li><p><strong>LLM security</strong>: screen all inbound data (emails, web pages, etc.) for prompt injections by default. <a href="https://docs.litellm.ai/docs/proxy/guardrails/quick_start">Post-call guardrails</a> for all LLM calls made from the AI apps are ON by default. This explains why the platform has a separate LLM proxy service (based on LiteLLM) rather than leaving LLM routing and guardrails to AI apps.</p></li><li><p><strong>Amenability to multiple AI apps coexisting on the platform</strong>, where these apps are developed independently and externally. This means that <strong>apps should be able to register their extensions to the reactive database dynamically</strong>, i.e., without the need to re-deploy the database. This motivates the stricter LLM security baseline: we cannot count on independent AI app developers to always consistently follow the LLM security practices.</p></li><li><p><strong>Governability and software supply chain security</strong>: it should be possible to configure which data tables (emails, browsed web pages, notes, etc.) every deployed app has access to. It should be possible to configure manual approvals for apps' requests for data access, dynamic trigger registrations, or requests to skip LLM guardrails. Manual approvals can be skipped only if the app's container image meets certain criteria, such as: built from a public GitHub repo with <a href="https://docs.github.com/en/actions/how-tos/secure-your-work/use-artifact-attestations/use-artifact-attestations#generating-build-provenance-for-container-images">provenance attestation</a> and doesn't register new vulnerabilities (relative to the previous deployed app version) with <a href="https://github.com/google/osv-scanner">osv-scanner</a>.</p></li><li><p><strong>Business-friendliness</strong>: to attract app developers and enable commercial hosting of the personal AI app platform (which is critical for the personal AI platform adoption, as self-hosting would require people managing too many separate service API and hosting subscriptions; this is discussed in more detail in ), the technologies comprising the data plane have to be <em><a href="https://opensource.stackexchange.com/questions/15273/what-is-the-difference-between-open-source-and-source-available-software">open source</a></em><a href="https://opensource.stackexchange.com/questions/15273/what-is-the-difference-between-open-source-and-source-available-software"> rather than </a><em><a href="https://opensource.stackexchange.com/questions/15273/what-is-the-difference-between-open-source-and-source-available-software">source available</a></em>.</p></li></ul><h4>Reactive database: Pocketbase</h4><p>Here are reactive databases (see my definition above) that I'm aware of:</p><ul><li><p><a href="https://github.com/supabase/supabase">Supabase</a>: <a href="https://supabase.com/docs/guides/functions">edge functions</a> in JS or TS, persistence to Postgres.</p></li><li><p><a href="https://github.com/nhost/nhost">Nhost</a>: <a href="https://nhost.io/product/functions">serverless functions</a> in JS or TS, persistence to Postgres.</p></li><li><p><a href="https://www.convex.dev/">Convex</a>: <a href="https://docs.convex.dev/functions">backend functions</a> in JS or TS, persistence to Postgres or SQLite.</p></li><li><p><a href="https://github.com/surrealdb/surrealdb">SurrealDB</a>: <a href="https://surrealdb.com/docs/surrealql/functions/script">embedded JS functions</a> can be used from <a href="https://surrealdb.com/docs/surrealql/statements/define/event">events</a>, custom storage.</p></li><li><p><a href="https://redplanetlabs.com/learn-rama">Rama</a>: Java and Clojure APIs, custom storage.</p></li><li><p><a href="https://github.com/risingwavelabs/risingwave">RisingWave</a>: <a href="https://docs.risingwave.com/sql/udfs/user-defined-functions">UDFs</a> in Python, JS, Rust, or Java, persistence to Apache Iceberg.</p></li><li><p><a href="https://github.com/pocketbase/pocketbase">Pocketbase</a>: <a href="https://pocketbase.io/docs/go-overview/">extensions</a> in Go or limited JS, persistence to SQLite.</p></li><li><p><a href="https://github.com/strapi/strapi">Strapi</a>: <a href="https://docs.strapi.io/cms/backend-customization">backend customisation</a> in JS or TS, persistence to Postgres, MySQL, SQLite, ...</p></li><li><p><a href="https://github.com/directus/directus">Directus</a>: <a href="https://directus.io/docs/guides/extensions/api-extensions">API extensions</a> in JS or TS, persistence to Postgres, MySQL, SQLite, ...</p></li><li><p><a href="https://ignite.apache.org/">Apache Ignite</a>: Java, C#/.NET and C++ primary APIs, custom/pluggable storage.</p></li><li><p>Google's Firebase: <a href="https://firebase.google.com/docs/functions">cloud functions</a> in JS, TS, or Python, proprietary storage.</p></li><li><p>AWS Amplify: <a href="https://docs.amplify.aws/react-native/build-a-backend/functions/custom-functions/">custom functions</a> in JS, TS, Python, Go, Java, ..., proprietary storage.</p></li></ul><p>Rama, RisingWave, and Apache Ignite focus on scalable, high-performance backends, not scrappy full-stack AI apps operating with tiny amounts of data. They use custom storage engines, which would not be a very legible choice for the open data plane platform.</p><p>Supabase and Nhost only support Postgres as the persistence option, which is overkill for tiny personal AI data planes. They are also focused on scalable backends and "real" cloud deployments, not small personal backends and PaaS/scale-to-zero deployments: e.g., <a href="https://nhost.io/blog/nhost-vs-supabase-practical-guide-for-growing-teams">Nhost relies on AWS Lambda</a> for running extension functions. Also, both <strong>Supabase and Nhost are notoriously hard to self-host.</strong></p><p>I think <strong>the personal data plane should be based on SQLite,</strong> which should be synced to object storage for durability via <a href="https://litestream.io/">Litestream</a>.</p><p>Convex and Directus support persistence to SQLite, but are released under <em>source available</em>, non-<a href="https://opensource.org/licenses">OSI-approved licenses</a>: Functional Source License (FSL) and Business Source License (BSL), respectively. This is a deal-breaker for the <em>open</em> personal AI platform and businesses that may want to build with it. SurrealDB also uses BSL.</p><p>Strapi is open source, but treats SQLite as a second-class, "demo usage only" persistence option.</p><p><a href="https://trailbase.io/">Trailbase</a> is not listed as a reactive database above because it doesn't support record create/update/delete triggers. It's focused on supporting the creation of a single coherent application on top of the single database, not a loose federation of interoperating apps.</p><p><a href="https://github.com/payloadcms/payload">Payload CMS</a> has a permissive license. It supports SQLite (or, at least, <a href="https://payloadcms.com/docs/database/sqlite">libSQL</a>) as a first-class persistence option alongside Postgres.</p><p>The reason why I didn't list Payload CMS as a reactive database is that it doesn't support realtime data subscriptions <a href="https://github.com/payloadcms/payload/discussions/4191">yet</a>. However, this isn't an inherent architectural limitation. Also, Payload positions too much as a "Next.js framework" rather than a language-agnostic "database with HTTP APIs, auth, and other goodies" (like Supabase, Convex, and Pocketbase), which might be alienating for AI app developers who don't use JS/TS. The startup that develops Payload CMS was recently acquired by a big corporation (Figma), which is a double-edged sword.</p><p>So, by exclusion, I currently choose Pocketbase as the reactive database for the personal AI data plane. It ticks all the boxes: permissively licensed, persisted to SQLite, and has a well-thought-through <a href="https://pocketbase.io/docs/js-overview/">extensions API</a>. However, Pocketbase has a notable downside (for the purposes of putting it at the core of the open data plane/platform): it's not open to <a href="https://github.com/pocketbase/pocketbase/graphs/contributors">contributions</a>. So is SQLite, though, but, of course, SQLite is an incomparably more proven, stable, and sustainable project, and has a much more mature ecosystem of plugins.</p><p>Overall, to my mind, this is still a relatively close call between Pocketbase and Payload CMS, so I may change the decision in the future.</p><h4>Data schema with versioned objects enables extending Pocketbase with serverless code in any language</h4><p>Pocketbase's runtime for dynamic JS extensions (hooks, custom routes, middleware, and migrations), <a href="https://github.com/dop251/goja">goja</a>, is rather limited: it doesn't support <code>fetch()</code> and async/await code.</p><p>This would be a serious downside of Pocketbase. However, the personal data plane use case permits <strong>database-managed subscriptions</strong>: triggering serverless functions, or directly the AI app that needs a database extension, without live HTTP connections for server-sent events.</p><p>Containerised extensions enabled by database-managed subscriptions are also essential for the deployment of independently developed AI apps (and/or serverless functions) against a single database so that they <strong>don't conflict on library versions required</strong>. To this end, this system design would also be necessary with any other reactive database, even those that include V8 JS/TS runtimes, like Convex or Trailbase. All these reactive databases were designed to be a backend for a <em>single</em> app, not an unknown federation of apps.</p><p>Database-managed subscriptions are possible to implement on top of Pocketbase due to the following characteristics of the target use case, i.e., the personal context data plane:</p><ul><li><p><strong>The common data model should anyway keep the </strong><em><strong>version history</strong></em><strong> of mutable objects</strong>: messages and results in AI chats (the user can edit their own or AI messages or re-run the AI turn), the chat itself (the user can drop turns or insert new messages), notes/documents, table records, etc.</p></li><li><p><strong>These version histories will generally be very short.</strong> The only exception is documents that may have thousands of versions if the app saves the document to the database every few seconds, but for AI app interoperation, document updates can promptly be rolled up to 15-minute or longer intervals: there is no realistic use case for AI apps to eavesdrop on document updates with higher granularity.</p></li><li><p><strong>The total number of versioned objects is small</strong> (thousands or tens of thousands at most?), and the cumulative object update frequency (~1 update per second at most) is tiny by the standards of what SQLite is capable of processing in terms of data volume and transactions per second.</p></li><li><p><strong>The total number of subscribers (AI apps and serverless functions) is a few dozen at most.</strong></p></li><li><p><strong>Interoperation across AI apps through the personal data plane shouldn't be formally correct and precise: these are just personal AI apps, not high-stakes financial transactions.</strong> AI apps&#8217; interactions will at most be something like background context enrichment, fine-tuning, or perhaps kicking off some optional research workflow on behalf of the user. So, trigger extensions for AI app interoperability don't need to propagate transactions correctly through the unified "versioned database" graph. Concretely speaking: if one app updated two or more objects within a single transaction (e.g., the message within the chat and the chat itself), another app that subscribes to these updates <em>should</em> be fine if it receives these two updates independently, in any order, or receives one and doesn't receive another because it gets reverted or overwritten quickly, or, in rare cases, misses updates altogether.</p></li></ul><p>The actual implementation of database-managed subscriptions could be as follows: a database-managed subscription is created an API request with the same parameters as <a href="https://pocketbase.io/docs/api-realtime/#set-subscriptions">realtime subscriptions</a>, plus the target address, path, and extra parameters for PUT requests that the subscription should produce. Each subscription creates a separate table in SQLite to store the object versions that are not yet consumed by the target serverless code or app. This table acts as a <em>subscription queue</em> (with deduplication). Upon each update to the subscribed object <a href="https://pocketbase.io/docs/collections/">collections</a>, the obsoleted versions of the updated object(s) are removed from the subscription queues. Object versions older than a month are also deleted (not just from the subscription queues but from SQLite altogether).</p><p>Each subscription is processed on the Pocketbase side by a dedicated goroutine that makes PUT requests to the target sequentially. Any non-error HTTP response from the target is considered a successful "consumption" of the subscription event, and it's removed from the queue. Any error cases exponential backoff before the next attempt: 5 seconds, 1 minute, 15 minutes, etc. The failing subscription means that the target app is broken or the user has shut it down. Failing subscriptions are displayed in Pocketbase's admin dashboard UI and can be removed altogether. Then the SQLite table that acts as the subscription queue is dropped. Subscriptions are automatically removed after a month of failing.</p><p>This is a very "native" and inefficient queue/stream processing solution compared to Kafka, RabbitMQ, etc., but I'm pretty sure it will work fine for personal data planes, where the expected data volumes are so low (as noted above). The advantage, of course, is that there are zero extra systems to run and manage, particularly with regard to the durability of subscription queues. Whereas when both the "main" data collections (tables) and supporting subscription queue tables are persisted in the same SQLite, there is a single mechanism that takes care of their durability, <a href="https://litestream.io/">Litestream</a>.</p><h4>Other Pocketbase plugins required</h4><p>Apart from database-managed subscriptions, as described above, other additions to Pocketbase are needed to make it the engine for the personal context data plane.</p><h5>Database-managed JS extensions</h5><p><a href="https://github.com/pocketbase/pocketbase/issues/7137">JS extensions should be managed in SQLite and exposed via HTTP APIs</a> rather than uploaded to the server disk. It's needed for the data plane security and privacy (more on that in the following post in this series), as well as for manageability and for the support of uncoordinated deploys of different apps. For example, the JS extension should be "owned" by the AI app that submitted it, and only that AI app and the superuser (root/admin) can update or delete the extension. See more details in the <a href="https://github.com/pocketbase/pocketbase/issues/7137">issue</a>.</p><h5>Full-text and vector search over objects</h5><p>Full-text and vector indexing plugins are needed to enable searching among the latest versions of the objects: messages, chats, documents, table records, etc. Rody Davis has built the prototypes for both these plugins (see his <a href="https://github.com/rodydavis/pocketbase-plugins">pocketbase-plugins</a> project) using SQLite's built-in <a href="https://www.sqlite.org/fts5.html">fts5</a> module for full-text search and <a href="https://github.com/asg017/sqlite-vec">sqlite-vec</a> for vector indexing.</p><p>I think it's better to use SQLite modules rather than <a href="https://github.com/blevesearch/bleve">bleve</a> or <em>embedded</em> LanceDB with <a href="https://lancedb.github.io/lancedb/concepts/storage/">local-disk storage</a> because fts5's and sqlite-vec's on-disk indexes are automatically encrypted if the whole SQLite is encrypted (via SQLCipher, discussed in the following post in this series). Similarly, these indexes piggyback on the main SQLite's backup to object storage. These are the same arguments that motivate building subscription queues on top of SQLite rather than with separate specialised systems.</p><p>Another option is to ingest versioned objects (chats, messages, notes) into the same LanceDB instance that stores immutable objects, see details below. The main downside of this approach is that it would make the Pocketbase instance less self-sufficient for simplified data plane setups without LanceDB. Also, this makes search indexes for versioned objects unavailable for extension JS routes and hooks.</p><p>On the other hand, with the LanceDB approach, the search APIs over versioned and immutable objects would be unified. Also, if the data plane has many thousands of messages across chats, the fact that sqlite-vec does <a href="https://alexgarcia.xyz/blog/2024/building-new-vector-search-sqlite/index.html">full scans</a> to find the nearest vectors may add too much CPU demands for the Pocketbase deployment and will require running it in more expensive VMs in a Fly.io setup to maintain acceptable latency.</p><p>So, I haven't decided yet between these two approaches (fts5 and sqlite-vec vs. LanceDB) for search over versioned objects: both approaches have pros and cons that seem commensurate to me.</p><h5>Metrics</h5><p>Another table-stakes addition to Pocketbase is exposing the Prometheus-style <code>/metrics</code> endpoint for Pocketbase monitoring (to be collected by the bring-your-own metrics store: see discussion below), as already implemented in magooney-loon's <a href="https://github.com/magooney-loon/pb-ext">pb-ext</a> project.</p><h4>The common data schema: to be determined</h4><p>I haven't yet worked on the specific details of the data schema for chats/threads, messages, and notes/documents. Probably they will be the least common denominator of:</p><ol><li><p>Open WebUI's data schema: see <a href="https://github.com/open-webui/open-webui/blob/main/backend/open_webui/models/messages.py">messages</a>, <a href="https://github.com/open-webui/open-webui/blob/main/backend/open_webui/models/chats.py">chats</a>, <a href="https://github.com/open-webui/open-webui/blob/main/backend/open_webui/models/prompts.py">prompts</a>, <a href="https://github.com/open-webui/open-webui/blob/main/backend/open_webui/models/notes.py">notes</a>, and <a href="https://github.com/open-webui/open-webui/blob/main/backend/open_webui/models/tools.py">tools</a> models.</p></li><li><p><a href="https://github.com/menloresearch/jan">Jan</a>'s data schema: <a href="https://github.com/menloresearch/jan/blob/dev/core/src/types/message/messageEntity.ts">messages</a>, <a href="https://github.com/menloresearch/jan/blob/dev/core/src/types/thread/threadEntity.ts">threads</a>, etc.</p></li><li><p><a href="app://obsidian.md/dify.ai">Dify</a>'s schemas are expressed in their REST APIs: see <a href="https://docs.dify.ai/api-reference/conversations/get-conversation-history-messages">conversation history messages</a> and <a href="https://docs.dify.ai/api-reference/documents/get-document-detail">document detail</a>. I don't think Dify will actually be one of the supported apps (it is targeted more at organisational use cases and requires Postgres for storage), but the schema itself is battle-tested and therefore is worth close attention.</p></li><li><p>LangChain v1: <a href="https://docs.langchain.com/oss/python/langchain/messages#standard-content-blocks">standard content blocks</a> in messages.</p></li><li><p><a href="https://github.com/letta-ai/letta/blob/main/letta/serialize_schemas/pydantic_agent_schema.py">Letta's Agent File schema</a>: messages, tools, memory blocks, agents, etc.</p></li><li><p><a href="https://mastra.ai/en/docs/server-db/storage#data-schema">Mastra's data schema</a>: messages, threads, resources, etc.</p></li><li><p><a href="https://github.com/get-convex/agent/blob/main/src/component/schema.ts">Convex Agents' schema</a>: messages, threads, memories, files, etc.</p></li></ol><p>Except, none of these schemas explicitly version objects (chats, messages, or memories/notes/documents), and only Convex Agents' objects are implicitly versioned (as everything in Convex's tables) and recoverable via the standalone <a href="https://github.com/get-convex/table-history">TableHistory</a> component.</p><p>I still ardently believe that mutable objects in the common data model <em>have</em> to be versioned, and these versions should even be exposed to the user in most chat AI apps, as ChatGPT does (see the "3/3" with arrow buttons):</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!37QZ!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F39fe8ac7-4907-434f-8ca8-4704532d0a20_1224x341.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!37QZ!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F39fe8ac7-4907-434f-8ca8-4704532d0a20_1224x341.png 424w, https://substackcdn.com/image/fetch/$s_!37QZ!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F39fe8ac7-4907-434f-8ca8-4704532d0a20_1224x341.png 848w, https://substackcdn.com/image/fetch/$s_!37QZ!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F39fe8ac7-4907-434f-8ca8-4704532d0a20_1224x341.png 1272w, https://substackcdn.com/image/fetch/$s_!37QZ!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F39fe8ac7-4907-434f-8ca8-4704532d0a20_1224x341.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!37QZ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F39fe8ac7-4907-434f-8ca8-4704532d0a20_1224x341.png" width="1224" height="341" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/39fe8ac7-4907-434f-8ca8-4704532d0a20_1224x341.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:341,&quot;width&quot;:1224,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:45838,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:&quot;https://engineeringideas.substack.com/i/173162413?img=https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F39fe8ac7-4907-434f-8ca8-4704532d0a20_1224x341.png&quot;,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!37QZ!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F39fe8ac7-4907-434f-8ca8-4704532d0a20_1224x341.png 424w, https://substackcdn.com/image/fetch/$s_!37QZ!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F39fe8ac7-4907-434f-8ca8-4704532d0a20_1224x341.png 848w, https://substackcdn.com/image/fetch/$s_!37QZ!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F39fe8ac7-4907-434f-8ca8-4704532d0a20_1224x341.png 1272w, https://substackcdn.com/image/fetch/$s_!37QZ!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F39fe8ac7-4907-434f-8ca8-4704532d0a20_1224x341.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>But since few developers of open source AI apps currently appear to think the same, the common data schema (expressed in a set of Pocketbase's HTTP APIs and JS hook APIs) should provide the "simplified" view, such as <code>GET /api/collections/[messages|chats|notes]/record/{id}</code> route for getting the <em>latest version</em> of the object, <code>PATCH /api/collections/[messages|chats|notes]/record/{id}</code> route for making a new version of an object, and <code>OnVersionedRecordUpdate()</code> hook API. The ability to create <em>versioned</em> collections (in addition to Pocketbase's Base, View, and Auth <a href="https://pocketbase.io/docs/collections/">collections</a>) should itself be implemented in a separate Pocketbase plugin, perhaps.</p><p>Every application can <a href="https://pocketbase.io/jsvm/classes/FieldsList.html#add">add app-specific fields</a> to one of the common schemas (e.g., chats/threads or notes) through a <a href="https://pocketbase.io/docs/js-migrations/">custom migration</a>. If these fields are critical for this application's functionality or presentation, the app should register a <a href="https://pocketbase.io/docs/js-routing/">custom route</a> that filters the corresponding <a href="https://pocketbase.io/docs/collections/">Pocketbase collection</a> for the presence of these fields, and use this route from the app's "list" or the "entry point" view (e.g., the list of chats or the list of notes) so that when the user opens this app and clicks on one of these chats or notes, the app can work with them.</p><p>The common schemas will also have <a href="https://github.com/pocketbase/pocketbase/discussions/3258#discussioncomment-6956827">"createdBy" fields that store the name of the app that created the given object</a> (the app name will be available as <code>requestInfo.authRecord.id</code>; Pocketbase will authenticate <em>apps</em>, not the "end users"; more on the auth architecture in the following post in this series), so the app could also just filter the collection on the objects that it created.</p><p>Currently, <strong>I </strong><em><strong>don't</strong></em><strong> think that there should be a common schema for "workflows" or "agent traces"</strong> (despite they are defined by multiple schema sources listed above under various names): I think they are too varied among different agentic frameworks and specific AI apps to be interoperable and usefully "listenable" (via JS hooks or database-managed subscriptions) by different apps. However, as the apps store these workflows and agent traces using their bespoke schemas in Pocketbase, they should enable full text and vector indexing of the contents of these workflows to make them "broad-base searchable" from other AI apps.</p><h4>AGENTS.md equivalent for the personal data plane?</h4><p>An interesting concept and a good candidate for being a part of the common data schema or convention that currently appears to be missing from all of the schemas above would be <strong>an equivalent of <a href="https://agents.md/">AGENTS.md</a>, but for the personal context data plane rather than for coding agents</strong>. It's not exactly a <a href="https://github.com/open-webui/open-webui/blob/main/backend/open_webui/models/prompts.py">Prompt</a> from Open WebUI because prompts are specific to particular tasks and apps, while the "personal data plane's AGENTS.md" should be a more general "system" instruction for agents, instructing them how to work with this data plane, similar to how AGENTS.md is not a prompt either. A part of this instruction, which may be specific to each app, should be the list of Pocketbase collections that this AI app has access to and how they are used.</p><h4>Hybrid search over immutable objects: LanceDB</h4><p>Searching over a subset (or all) of digital artifacts that the person has encountered or received, including their emails, file uploads via AI (chat) apps such as Open WebUI, visited web pages (either by the person or by AI agents on their behalf), transcripts of watched YouTube videos, personal meetings, and podcasts, RSS/media items/news, etc. should be a core capability of the personal data plane available to AI apps via HTTP API since almost all AI apps require search.</p><p>First, I want to note why a separate search DB is need at all and SQLite's fts5 and sqlite-vec extensions that are proposed to be used for indexing <em>versioned</em> objects (chats, messages, notes) couldn't be used to index and search over <em>immutable</em> objects (emails, webpages, transcripts, files, media) as well: sqlite-vec may be sufficient to search over a few thousands of messages and chats (although this isn't yet clear to me without benchmarking), but its full scan vector search will definitely be too inefficient when/if there are two orders of magnitude more objects: the person may have only a few chats with AI per day on average, but the personal "Info Agent" or the personal AI assistant may easily ingest hundreds of media items and emails per day.</p><p>Of the <a href="https://docs.llamaindex.ai/en/stable/community/integrations/vector_stores/">dozens of vector and search stores</a>, only two seem mostly compatible with the architectural goals for the personal AI platform and the data plane: (1) the simplicity of deployment both in a VPS (or locally) and in a scale-to-zero cloud PaaS like Fly.io, and (2) a straightforward way to backup the data durably in object storage: <a href="https://github.com/chroma-core/chroma">Chroma</a> and <a href="https://github.com/lancedb/lancedb">LanceDB</a>:</p><ul><li><p>Chroma <a href="https://cookbook.chromadb.dev/core/advanced/wal/">uses SQLite for WAL</a>, and this SQLite instance could be backed up to object storage using Litestream, in the same way as Pocketbase's SQLite. (Although nobody appears to have tried to do this yet.)</p></li><li><p>LanceDB OSS supports <a href="https://lancedb.github.io/lancedb/concepts/storage/#1-s3-gcs-azure-blob-storage">object storage</a> as the primary storage backend.</p></li></ul><p>However, Chroma doesn't support hybrid search with BM25 <a href="https://github.com/chroma-core/chroma/issues/1330">yet</a> and has to run as a standalone process. On the other hand, LanceDB could be embedded in the Python process that also implements data ingestion and checks the search permissions: see below in this section.</p><p>The biggest drawback of LanceDB OSS, it seems, is that when configured with object storage, it <a href="https://github.com/lancedb/lancedb/issues/2626">can't</a> also use local disk for caching, which may increase the search query latency and the object storage egress. The "cold" search latency in a scale-to-zero cloud setup in Fly.io would probably never be smaller than ~0.7..1s to the AI app (not to the user, as the AI app may further post-process the search results with LLMs): <a href="https://fly.io/docs/reference/suspend-resume/">a few hundred ms</a> for resuming the Fly.io machine from suspended state, a few hundred ms for fetching Lance files from object storage, and some time for actual search query processing, and <a href="https://fly.io/docs/reference/fly-proxy/">Fly Proxy</a> round-trip latency. But that seems like an acceptable tradeoff. Chroma's lack of hybrid search seems like a more significant limitation, so I chose LanceDB as the search database for immutable objects in the personal data plane.</p><p>Data ingestion into LanceDB should be mediated through the Pocketbase instance. This is needed both to permit additional "micro-ETL" workflows submitted by the AI apps as <a href="https://pocketbase.io/docs/js-event-hooks/">hooks</a> over these data feeds. Additionally, there should be default workflows that scan the inbound data for <a href="https://en.wikipedia.org/wiki/Prompt_injection">prompt injections</a> to quarantine or sanitise it automatically (see more on the security architecture in the following post in this series). Finally, Pocketbase batches inbound data and inserts it in LanceDB once every 15 minutes or so to prevent LanceDB to be up too much of the time in a scale-to-zero cloud deployment, assuming it's unreasonable to set LanceDB instance's <a href="https://fly.io/docs/flyctl/machine-suspend/">suspend wait timeout</a> shorter than 60 seconds, given "agentic search" use cases like "search, then process results with an LLM, which emits another search tool call, repeat".</p><p>Document chunking algorithms, embedding approaches (fixed, <a href="https://huggingface.co/blog/matryoshka">matryoshka</a>, or multi-vector for <a href="https://lancedb.github.io/lancedb/guides/multi-vector/">late interaction</a>), embedding aggregation and hierarchical retrieval algorithms (like <a href="https://arxiv.org/abs/2401.18059">RAPTOR</a> or Gwern's <a href="https://gwern.net/tree-embedding">hierarchical embeddings for text search</a>) are all undecided for now. The data plane should provide sane defaults for different data formats: plaintext, HTML, Markdown, and PDF.</p><p>Since no single set of algorithms can work equally well for all kinds of data, the above algorithms should be configurable per specific table (emails, webpages, transcripts, media) and/or per specific feed. The most practical way to implement this, it seems to me, is to <strong>wrap the LanceDB instance in a thin Python server that implements these pre-configured algorithms, and permit configuring the algorithms in a dedicated system table in Pocketbase.</strong></p><p><strong>The Python API layer also enforces table and column access permissions for the AI app that makes the search request</strong>, by consulting Pocketbase, while the LanceDB library does the actual search. (The app authenticates itself to the Python server with a dedicated key generated when the <a href="https://pocketbase.io/docs/collections/#auth-collection">auth record</a> for the app is created in Pocketbase; more on the auth and security architecture in a later post in this series.)</p><p>Custom, app-specific algorithms could also be supported without altering the LanceDB+Python server container image via <em>database-managed subscriptions</em> (see above) that send the data batches to the AI app, which uses Lance API to <a href="https://docs.lancedb.com/api-reference/data/merge-insert-upsert-data">merge-insert</a> their custom column values (custom embeddings, custom metadata, etc.) to records in the common tables: emails, webpages, etc.</p><p><a href="https://github.com/GraphRAG-Bench/GraphRAG-Benchmark">GraphRAG-Bench</a> paper shows that sophisticated, graph-based retrieval approaches (GraphRAG, HippoRAG, LightRAG, etc.) are more effective than "simple" embedding-based retrieval for queries against dense knowledge sets, such as technical documentation or medical instructions. The data that is supposed to be stored in the personal data plane's LanceDB (emails, webpages, and documents) is <strong>not</strong> dense knowledge sense. Hence, <strong>I don't see a point in supporting anything resembling GraphRAG in the personal AI data plane. Incidentally, this means that a graph database is not needed</strong>, which is a huge relief because it would significantly increase the overall system's complexity.</p><h4>LLM, MCP, and service API proxy: a Python service with LiteLLM</h4><p>The need for a standalone LLM proxy/gateway in the personal AI platform stems from the LLM security and governability requirements: see "Architectural goals for the personal AI platform" above.</p><p><a href="https://docs.litellm.ai/docs/proxy/guardrails/quick_start">Guardrails</a> should be turned <em>on</em> by default for AI apps' LLM calls. AI apps should be able to submit to the Pocketbase their "recommended" settings, where they specify for which types of requests guardrails are unnecessary (e.g., because these are simple intent classification or "routing" requests) and which tools should be available (a la <a href="https://docs.litellm.ai/docs/mcp">MCP gateway</a>). Similar to the search access controls and chunking+embedding algorithm settings (see the previous section), the person can review these settings in the Pocketbase dashboard and track changes across the different deployed versions of the given AI app.</p><p>Apart from LLM security considerations, another reason to make LLM calls through a centralised proxy is to log LLM responses consistently across AI apps and consistently record LLM and other service API costs for spend analysis: see the following section.</p><p>In self-hosted setups, it's possible to restrict the app container's access to the internet by placing the container only on an internal network in Docker Compose and letting inbound HTTPS requests through a nginx or Caddy reverse proxy container and the outgoing requests through the LLM proxy container. In the Fly.io cloud, it should be possible to achieve similar isolation with <a href="https://fly.io/docs/machines/guides-examples/network-policies/">Fly machine Network Policies</a> that deny all egress except for the internal (Fly Proxy) traffic, so access to the proxy service, the Pocketbase instance, and the search service is still permitted.</p><p>There are surprisingly few open-source standalone HTTP proxy (gateways) for LLM calls: <a href="https://github.com/BerriAI/litellm">LiteLLM</a>, <a href="https://github.com/Portkey-AI/gateway">Portkey AI gateway</a>, and <a href="https://github.com/mlflow/mlflow">MLFlow</a> AI gateway, maybe? And of these, only LIteLLM supports <strong>cost calculation</strong>. Also, LiteLLM has at least an order of magnitude more activity on GitHub: bug fixes for obscure combinations of providers, APIs, and features like reasoning, streaming, tool calling, structured outputs, etc., new providers added, and cost map updates. So, despite <a href="https://engineeringideas.substack.com/i/168052480/implementation-challenge-providers-llm-interfaces-are-just-different-and-hardly-convertible-between-each-other">my gripes</a> with LiteLLM's code and that LiteLLM is presumably the <a href="https://konghq.com/blog/engineering/ai-gateway-benchmark-kong-ai-gateway-portkey-litellm">slowest</a> of the popular AI gateways (which probably doesn't matter for the personal AI platform because it will generate very modest LLM call throughput), LiteLLM doesn't have serious alternatives, in my view.</p><p>If the AI apps don't have open internet access, they must <strong>proxy </strong><em><strong>all</strong></em><strong> their external service API calls, such as web search, web scraping, audio transcription, media generation, etc.</strong> LiteLLM supports this through <a href="https://docs.litellm.ai/docs/proxy/pass_through">custom pass-through endpoints</a>. Similar to the guardrails, tools, and LLM model access configurations, the AI apps should submit requests to use a certain API via an HTTP request to Pocketbase, and the proxy service verifies the app's permission to access a certain API service at runtime.</p><p>Unfortunately, LiteLLM's own <a href="https://docs.litellm.ai/docs/simple_proxy">proxy server</a> couldn't be used unmodified because it uses PostgreSQL and LiteLLM developers <a href="https://github.com/BerriAI/litellm/issues/4583">don't plan</a> to support even vanilla SQLite, let alone Pocketbase. However, the personal data plane's LLM and service API proxy should support only a subset of LiteLLM proxy server's features and hence only a subset of their <a href="https://github.com/BerriAI/litellm/blob/main/schema.prisma">database schema</a>, so I think that maintaining a fork of LiteLLM proxy server that uses Pocketbase instead of PostgreSQL should be manageable, despite generating a steady stream of maintenance work.</p><h4>LLM and other service API call logging: LanceDB</h4><p>LLM calls and other service API calls such as web search, audio transcription, translation, etc., should be logged for AI app debugging, API spend analysis, security audit, and broad-based search by other AI apps, e.g., a "system admin" AI agent that lives on the personal AI platform itself and helps the user with other app updates and debugging.</p><p>In "<a href="https://engineeringideas.substack.com/i/168052480/connecting-the-semantic-data-traces-with-llm-responses">Connecting the semantic data traces with LLM responses</a>", I advocated for <a href="https://docs.victoriametrics.com/victorialogs/">VictoriaLogs</a> because of its operational and configuration efficiency. Object storage backend for "cold" logs (e.g., older than a day) is a <a href="https://github.com/VictoriaMetrics/VictoriaLogs/issues/48">work in progress</a> for VictoriaLogs.</p><p><strong>However, since the data plane already uses LanceDB for search over immutable media objects anyway, it would be even simpler than VictoriaLogs to also use LanceDB for LLM and service API call logs as well.</strong></p><p>LanceDB could be embedded in the Python proxy and used for data insertions only. Since this would be the "same" LanceDB as is used in the search service, logs could be queried and searched through the search service. Such separation is helpful for scale-to-zero deployments in Fly.io because the proxy service (Fly machine) could still have relatively little memory (500MB to 1GB) while the search service needs to have more more memory (probably, 2GB) but is called less frequently than the LLM and service API proxy and therefore is <a href="https://fly.io/docs/reference/suspend-resume/">suspended</a> for more time in total when it doesn't accrue the hosting cost.</p><p>LanceDB's <a href="https://github.com/lancedb/lance/issues/4516">upcoming JSON support</a> will be handy for LLM request/response querying and analysis.</p><p>The LLM call log schema could be somewhere in between <a href="https://github.com/BerriAI/litellm/blob/351896cd1d253edbe6a56b310ad71afecf6eea99/schema.prisma#L248">LiteLLM_SpendLogs</a> and<br>OpenTelemetry's <a href="https://github.com/open-telemetry/opentelemetry-python/blob/main/opentelemetry-semantic-conventions/src/opentelemetry/semconv/_incubating/attributes/gen_ai_attributes.py">gen_ai_attributes</a> schemas.</p><h4>Metrics store: bring your own</h4><p>As an alternative for LanceDB for LLM request/response log storage, I've considered <a href="https://github.com/openobserve/openobserve">OpenObserve</a> that could have been used for storing LLM call logs and the various personal AI platform metrics, reported by the data plane services and the AI apps themselves. However, I decided that this is unnecessary to make the metrics store a part of the data platform. In self-hosted and homelab deployments, there is almost definitely some metrics store deployed apart from the personal AI platform, such as VictoriaMetrics, Prometheus, or ClickHouse (via SigNoz or a similar observability app). In Fly.io, there is a <a href="https://fly.io/docs/monitoring/metrics/#prometheus-on-fly-io">hosted metrics store</a> as well.</p><p>The personal AI platform's metrics are not strictly required to be durable (unlike LLM and service API call logs), so they don't have to be synced to object storage. Using OpenObserve, a metrics store that uses object storage as the primary data storage, would incur unnecessary object storage write (ingress) amplification. Also, OpenObserve would have to be a separate service in Fly.io deployments, which would cost some extra for the users, whereas Fly.io's built-in metrics store is included in the platform cost.</p><h2>The minimum viable personal AI platform: Open WebUI, browsing history, and email search</h2><p>Despite paying most attention in the personal data plane architecture to the aspects of independent AI apps coexisting on the same platform and how the apps and the user can benefit from that, <strong>a much simpler and faster path "break even value" for the platform is simply making the AI apps and integrations meet:</strong> AI apps begin become more useful when they have access to the personal data that is ingested to the personal data plane through integrations. This will motivate people to use the given AI app on top of the personal AI platform (Pocketbase and LanceDB) rather than their "default" databases.</p><p>My immediate plan for making an MVP of the personal AI platform is:</p><ol><li><p>Implement Pocketbase storage for <a href="https://github.com/open-webui/open-webui">Open WebUI</a>, <em>without any data remodelling yet</em>. Currently, Open WebUI supports PostgreSQL <em>or</em> SQLite storage through SQLAlchemy, so the code is already somewhat accustomed to pluggable storage. Also, this should be relatively simple to do because Open WebUI basically doesn't do transactions, so all its database operations can translate into separate CRUD HTTP calls to Pocketbase.</p></li><li><p>Implement an MVP version of the search service based on LanceDB with one particular document chunking and embedding approach.</p></li><li><p>Make a Pocketbase plugin that reads emails from Gmail via IMAP, using <a href="https://github.com/emersion/go-imap">go-imap</a>, probably, and pushes the emails to the search service.</p></li><li><p>Create a Chrome plugin similar to <a href="https://github.com/iansinnott/full-text-tabs-forever">full-text-tabs-forever</a> that reads all pages that the person visited on desktop Chrome or another Chromium-based browser and pushes them to Pocketbase, which will in turn push them to the search service.</p></li><li><p>Add a "personal data search" tool to Open WebUI to ground AI chats with search in personal email, newsletters, and browsing history.</p></li></ol>]]></content:encoded></item><item><title><![CDATA[AI agency architecture-in-the-large: the relevant levels of abstraction]]></title><description><![CDATA[The "agent framework" level is just one among dozens of relevant architecture levels for AI agents.]]></description><link>https://engineeringideas.substack.com/p/ai-agency-architecture-in-the-large</link><guid isPermaLink="false">https://engineeringideas.substack.com/p/ai-agency-architecture-in-the-large</guid><dc:creator><![CDATA[Roman Leventov]]></dc:creator><pubDate>Mon, 28 Jul 2025 14:25:17 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!EJj2!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F55443e67-0a66-4164-8473-09b13a2e90ca_256x256.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h3>Introduction</h3><p>This post continues the series in which I apply John Doyle&#8217;s <a href="https://engineeringideas.substack.com/p/architecture-theory-and-the-hourglass">architecture theory and the hourglass model</a> from network systems engineering to <a href="https://aiprospects.substack.com/p/a-better-way-to-use-highly-capable">AI agency architecture</a>.</p><p>Below, I&#8217;ll use the terms <em>level</em>, (<em>abstraction,</em> <em>model, theory)</em>, <em>component</em> <em>(subsystem, layer)</em>, <em>diversity hourglass</em>, <em>composability</em>, <em>hijackability</em>, and others with specific technical meanings described in the <a href="https://engineeringideas.substack.com/p/architecture-theory-and-the-hourglass">previous post</a> in this series.</p><p>This post is an <strong>overview of the variety of </strong><em><strong>possible</strong></em><strong> abstraction levels that are relevant or being discussed in relation to AI agents.</strong> I&#8217;ll not make normative claims here about how I think AI agency architecture should be steered. Hopefully, the concepts of abstraction level (interface, protocol), multi-level control (immune systems), composability, hijackability, and generality will be used in AI agency architecture work and discussions elsewhere.</p><p>The phrase &#8220;relevant abstraction level&#8221; above means that are <em>some</em> people who think there is <em>something</em> crucially important in application or relation to AI agent (architecture) about the <em>theory/model/method/ontology/design/interface/protocol</em> of the said abstraction level. Or, to put it differently, some people think that some of these levels and their designs are &#8220;<a href="https://substack.com/@leventov/note/c-131616817">key unlocks for AI agents</a>&#8221; and bet that most (or at least, a considerable fraction of) future AI agents <em>should</em> <em>share the same method/design/interface/protocol</em> on those specific level(s) of their interest.</p><p>Consequently, people try to steer the <a href="https://cs.ccsu.edu/~stan/classes/CS410/Notes16/06-ArchitecturalDesign.html">architecture in the large</a> (i.e., <em>architecture across the organizational boundaries</em>) of AI agency towards those level(s) to be the <em>middle (i.e., shared, &#8220;low diversity&#8221;) level(s)</em> in the diversity hourglass architecture (a.k.a. the <em>waist and neck architecture</em><a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-1" href="#footnote-1" target="_self">1</a> when there is more than one shared/low diversity level).</p><p>However, <a href="https://engineeringideas.substack.com/i/154060571/diversity-hourglasss-risks">diversity hourglass is a double-edged sword</a> and therefore people should better <strong>be thoughtful when promoting their preferred diversity hourglasses</strong>, that is, architectures with different middle (low diversity) levels and their respective models/designs/interfaces/protocols.</p><h2>Classes of abstraction levels relevant for AI agency architecture</h2><p>Each section in the remainder of this post describes some <em>abstraction class</em> relevant for AI agency architecture. These abstraction classes are not coming from the architecture theory in some principled way, I&#8217;m basically grouping abstractions ad hoc for making the description more manageable&#8212;otherwise, this post would need to have hundreds of sections.</p><p>The descriptions of the abstraction classes below follow roughly from lower- to higher-level ones.</p><p>Any such categorization, including mine below, unavoidably has some subjective coarse-graining/&#8220;quantisation&#8221; of the space that is actually infinitely malleable. In fact, almost all real-world &#8220;AI (agent) platforms&#8221; (such as <a href="https://github.com/langgenius/dify">Dify</a>, <a href="https://ii.inc/web/blog/post/commons-week-july-2025">Intelligent Internet&#8217;s Contexts</a>, <a href="https://github.com/open-webui/open-webui">Open WebUI</a>, <a href="https://github.com/crewAIInc/crewAI">CrewAI</a>, <a href="https://flowiseai.com/">Flowise</a>, <a href="https://replit.com/">Replit</a>, <a href="https://www.lindy.ai/">Lindy</a>, <a href="https://tactics.dev/">Tactics</a>, <a href="https://singularitynet.io/">SingularityNET</a>, <a href="https://www.anthropic.com/news/claude-powered-artifacts">Anthropic&#8217;s app platform</a>, and countless others) <em>repackage some features and aspects of multiple of the abstraction levels as</em> <em>I describe them below</em> into unique models/abstractions of their own.</p><p>Relatedly, many of the concrete examples of abstractions, protocols, systems, and designs that I give below could be attributed to multiple abstraction classes in my list.</p><div><hr></div><h3>Data storage and computing platforms</h3><ul><li><p><strong>Operating systems and &#8220;OS-like&#8221;</strong><a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-2" href="#footnote-2" target="_self">2</a><strong> platforms</strong>, such as POSIX, Web standards/browser-as-an-OS (see <a href="https://www.browserbase.com/">Browserbase</a>, <a href="https://github.com/stackblitz/webcontainer-core">StackBlitz&#8217;s WebContainers</a>). Confusingly, when people talk about &#8220;<a href="https://github.com/bilalonur/awesome-llm-os">LLM OS</a>&#8221; they usually refer to the <em>Compound AI System (CAIS)</em> level, see below.</p></li><li><p><strong>Cloud computing platforms</strong> such as <a href="https://fly.io/blog/">Fly.io</a>, <a href="https://vercel.com/">Vercel</a>, <a href="https://replit.com/">Replit</a>, <a href="https://render.com/">Render</a>.</p></li><li><p><strong>AI inference/compute platforms</strong>, such as <a href="https://www.modular.com/max">Modular MAX</a>, <a href="https://replicate.com/">Replicate</a>, <a href="https://fireworks.ai/">Fireworks</a>, <a href="https://www.together.ai/">Together</a>, or on the &#8220;local&#8221; side, <a href="https://ollama.com/">Ollama</a>.</p></li><li><p><strong>Microservice, container, or serverless platforms</strong>, such as Kubernetes, or the crop of new AI-agent-specific ones, such as <a href="https://www.daytona.io/">Daytona</a> and <a href="https://e2b.dev/">E2B</a>.</p></li><li><p><strong>Reliable/durable (workflow) execution frameworks</strong>, such as <a href="https://dagger.io/">Dagger</a>, <a href="https://dbos.dev/">DBOS</a>, and <a href="https://materializedview.io/p/durable-execution-justifying-the-bubble">many others</a>.</p></li><li><p><strong>Database-integrated or &#8220;<a href="https://martin.kleppmann.com/2015/11/05/database-inside-out-at-oredev.html">database-inside-out</a>&#8221; (stream) processing engines</strong>, such as <a href="http://convex.dev/">Convex</a>, <a href="https://materialize.com/">Materialize</a>, <a href="https://redplanetlabs.com/learn-rama">Rama</a>, <a href="https://www.hopsworks.ai/">Hopsworks</a>, <a href="https://neon.tech/use-cases/ai-agents">Neon</a>, <a href="https://transactional.blog/blog/2024-database-startups#_stateful_streaming">and others</a>.</p></li><li><p>LLM (Dev)(Ops) and routing platforms such as <a href="https://arize.com/">Arize</a>, <a href="https://flowiseai.com/">Flowise</a>, <a href="https://langfuse.com/">Langfuse</a>, <a href="https://www.requesty.ai/">Requesty</a>, <a href="https://weave-docs.wandb.ai/">W&amp;B Weave</a>, etc.</p></li><li><p><strong>Secure/private/trusted execution and federated AI (learning) frameworks</strong>, such as OpenMined&#8217;s <a href="https://github.com/OpenMined/PySyft">PySyft</a>, <a href="https://flower.ai/">Flower.ai</a>, <a href="https://www.apheris.com/resources/blog/top-7-open-source-frameworks-for-federated-learning">and more</a>.</p></li></ul><h5><strong>Composability</strong></h5><p>Data storage and computing platforms <em>per se</em> rarely introduce meaningful directions of composability.</p><p><a href="https://kubernetes.io/docs/concepts/extend-kubernetes/operator/">Kubernetes operators</a> is an example of such a direction, but it doesn&#8217;t scale well, and Kubernetes is seldom thought of as the &#8220;platform for AI agents&#8221;. Inference platforms like Modular MAX and Fireworks <em>may</em> have composability a la &#8220;end-to-end computations spanning several models&#8221;, but that would actually be thanks to the underlying <em>frameworks</em>: Mojo and PyTorch (see the next section).</p><p>I say that computing platforms don&#8217;t introduce composability <em>per se</em> because actually many of them do, but on the separate <em>API level</em> which in practice is often bundled together with the computing platform abstraction. The examples of such APIs are <a href="https://engineeringideas.substack.com/p/trace-llm-workflows-at-your-apps">OpenAI-ish completions API</a> of the OpenAI inference platform itself and many other inference platforms that copy OpenAI, <a href="https://docs.convex.dev/">Convex API</a> (not SQL!), <a href="https://docs.dagger.io/api/">Dagger API</a>, <a href="https://redplanetlabs.com/docs/~/rest.html">Rama&#8217;s API</a>, <a href="https://docs.dbos.dev/">DBOS&#8217;s API</a>, etc.</p><p>This means that any diversity hourglass architecture with computing platform as the middle level naturally tends to shift towards the API level as the middle, whereas the computing platform itself becoming the lower implementation level &#8220;behind&#8221; the API. Platforms with complex API abstractions, such as Nvidia&#8217;s platform with CUDA successfully resist this shift because they are harder to re-implement, whereas simpler abstractions such as <a href="https://standardcompletions.org/">completions API</a> are commoditized faster.</p><p>Note that I&#8217;m not claiming that all the APIs mentioned above are composable&#8212;I didn&#8217;t actually study most of them. In fact, the one API among those that I did work with, OpenAI completions API, is actually <em>not composable at all</em>: as soon as you need LLM to summarise a conversation happened in/with this API, you need to abandon the original API trace and condense the conversation within a single message, or else you risk the LLM to forget its &#8220;summarizer role&#8221; and just continue the conversation (also, it&#8217;s <a href="https://hackernoon.com/stop-prompting-start-engineering-15-principles-to-deliver-your-ai-agent-to-production">token-inefficient</a>). Anyone who&#8217;ve worked with completions API would admit this quickly gets cumbersome and ugly. Compare it with any reasonable programing language design (that are usually highly composable), where this operation would simply be <code>summarize(conversation)</code> or something like that.</p><h5>Hijackability</h5><p>Permissionless cloud computing platforms can give rise to self-sovereign agents that earn crypto through fraud, spam, and other activity that is purely net hamful for humans (or neutral for humans, but competing with human-beneficial activity for computing resources) and pay for their own compute. These agents might be surprisingly hard to stamp out. See <a href="https://www.lesswrong.com/posts/bmmFLoBAWGnuhnqq5/capital-ownership-will-not-prevent-human-disempowerment">this Beren Millidge&#8217;s post</a> for more on this risk.</p><h3>Machine learning and inference frameworks</h3><p>Examples: <a href="https://github.com/pytorch/pytorch">PyTorch</a>, <a href="https://jax.readthedocs.io/en/latest/">JAX</a>, <a href="https://keras.io/">Keras</a>, <a href="https://www.modular.com/mojo">Mojo</a>, <a href="https://github.com/JuliaAI/MLJ.jl">MLJ</a> (Julia&#8217;s ML framework), or <a href="https://juliadiff.org/">JuliaDiff</a> more broadly.</p><p>Machine learning frameworks are seldom brought up as the key abstraction for AI agents. However, they are <strong>key for composability at the computing platform level</strong> (see above), as well as for <strong>end-to-end (composable) neural net component optimisation</strong> that is an important piece of some people&#8217;s vision for AI agents:</p><ul><li><p>Yann LeCun&#8217;s vision towards autonomous machine intelligence (2022)<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-3" href="#footnote-3" target="_self">3</a>: relies on end-to-end learning signal propagation across the components of this cognitive architecture (world model, actor, critic, etc.)</p></li><li><p>Cooperative language-guided inverse plan search (<a href="https://arxiv.org/abs/2402.17930">CLIPS</a>), by Zhi-Xuan, Ying, Mansinghka, and Tenenbaum (2024)<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-4" href="#footnote-4" target="_self">4</a> is a Bayesian agent architecture that uses LLMs as probabilistic samplers within a larger probabilistic model, <a href="https://github.com/probcomp/CLIPS.jl">written in Julia</a>.</p></li><li><p>&#8220;Neural architecture-level&#8221;<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-5" href="#footnote-5" target="_self">5</a> neuro-symbolic AI approaches, such as (van Bergen et al., 2024)<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-6" href="#footnote-6" target="_self">6</a>.</p></li></ul><p><strong>Composable?</strong>&#8212;Yes, and in a strong, <em>general</em> way. This is very much the point of machine learning frameworks.</p><h3>Neural net architectures</h3><p>&#8220;Neural net architectures&#8221; themselves can be thought to lump together dozens of finer sub-levels, all the way from CUDA kernels and activation functions up to high-level abstractions such as <a href="https://huggingface.co/blog/moe">Mixture of Experts</a>. Most of these lower sub-levels are not very relevant for AI agency architecture. However, some higher-level aspects and sub-levels of neural net architectures <em>are</em> very much relevant:</p><ul><li><p><strong>Information integration and/or &#8220;in-context&#8221; retrieval mechanisms</strong>, such as Transformer-style <a href="https://huggingface.co/docs/transformers/en/attention">attention</a>, <a href="https://huggingface.co/blog/lbourdois/get-on-the-ssm-train">state-space</a> modelling, recurrency, and diffusion.</p></li><li><p><strong>Model adaptation</strong> <strong>methods</strong>, such as <a href="https://arxiv.org/abs/2302.00487">continual learning</a>/pre-training (specific methods are very much dependent on the specific NN architecture, be it a standard GPT-style Transformer, a spiking or another <a href="https://www.youtube.com/watch?v=aisgNLypUKs">biologically plausible</a> NN, or a &#8220;<a href="https://www.liquid.ai/">liquid</a>&#8221; NN), or (post-training) <a href="https://huggingface.co/papers/2106.09685">low-rank adaptations</a>.</p></li><li><p><a href="https://arxiv.org/abs/2309.08600">Sparse autoencoder features</a> and higher-level objects/abstractions on top of them (<a href="https://arxiv.org/abs/2403.19647">circuits</a>, <a href="https://arxiv.org/abs/2410.06981">spaces</a>, etc.) could be used to <em>monitor</em> or <em>control</em> AI agent behavior via &#8220;pulling the threads&#8221;: <a href="https://arxiv.org/abs/2403.19647">enabling or disabling features dynamically</a>, see <a href="https://interplm.ai/">InterPLM</a>. Indeed, sparse autoencoder feature and circuit dynamics may be very dependent on specific neural net architectures (and even small features of those such as activation functions and LayerNorms, cf. Elhage et al., 2022<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-7" href="#footnote-7" target="_self">7</a>), or even not available (at least, practically) or &#8220;crippled&#8221; in some NN architectures, perhaps <a href="https://www.liquid.ai/">liquid</a> ones?</p></li></ul><h5>Composability</h5><p>Most relevant NN architectures, such as Transformers <em>are</em> composable. This is the essence of <a href="https://gwern.net/scaling-hypothesis">the scaling hypothesis</a>. On the neural net architecture level, composition means &#8220;<a href="https://www.reddit.com/r/ProgrammerHumor/comments/8c1i45/stack_more_layers/">stack more layers &#129322;</a>&#8221; or alternatively, &#8220;<a href="https://huggingface.co/deepseek-ai/DeepSeek-V3">add more MoE experts</a>&#8221;.</p><p>However, what this kind of composition means for the AI agency-relevant aspects of NN architectures (<em>information integration and retrieval</em>, <em>model adaptability</em>, and <em>mechanistic interpretability and control</em>), or behavioural aspects such as scheming (Meinke et al., 2024)<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-8" href="#footnote-8" target="_self">8</a> should be considered.</p><p>The influences of composition (scaling) on these agent-relevant aspects <em>could</em> (at least, for some NN architectures) appear to be non-monotonic: first positive, but later negative, as the models are scaled up.<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-9" href="#footnote-9" target="_self">9</a></p><h5>Hijackability</h5><p>In the LessWrong lore, the theoretical possibility of the NN becoming self-aware during the training process and hijacking it (or at least steering it) is known as <a href="https://www.lesswrong.com/posts/uXH4r6MmKPedk8rMA/gradient-hacking">gradient hacking</a>. I think that &#8220;strong&#8221; gradient hacking, as this concept was originally conceived, i.e., during non-contextualised forward pass of an LLM, is basically impossible: see <a href="https://www.lesswrong.com/posts/w2TAEvME2yAG9MHeq/gradient-hacking-is-extremely-difficult">Gradient hacking is extremely difficult</a> (Millidge, 2023). <a href="https://arxiv.org/abs/2412.14093">Alignment faking in large language models</a> (Greenblatt et al., 2024)<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-10" href="#footnote-10" target="_self">10</a>  has also been <a href="https://x.com/davidad/status/1869822392287285565">called</a> &#8220;gradient hacking&#8221;, but that would be an instance of the hijackability of the <em>training data generation process</em> (see the following section) rather than the NN architecture itself.</p><h3>Learning problem definitions and training data</h3><p>In ML research and engineering, <em>NN architectures</em> (see the previous section) and <em>learning problem definitions</em> are usually developed and studied together as <strong>ML architectures</strong>. Of course, this makes a lot of sense because the characteristics and the success or failure of ML models depend on both. However, in relation to AI agents, <strong>learning problem definitions</strong>, <strong>training data</strong>, and <strong>training strategies (aka. protocols, processes, recipes)</strong> bring up somewhat different considerations from NN architectures, hence I discuss them as a separately.</p><p>As well as NN architectures, learning problem definition and training strategies are complicated groups of interacting models on different levels that are bundled together into some packages:</p><ul><li><p><strong>Types of inputs and outputs for the model</strong>, such as tokens of text, synthetic/abstract tokens, <a href="https://arxiv.org/abs/2507.07955">dynamic chunks</a> (Hwang et al., 2025)<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-11" href="#footnote-11" target="_self">11</a>, <a href="https://en.wikipedia.org/wiki/Abstract_syntax_tree">AST</a> tokens or graphs (for program synthesis), image embeddings, etc.</p></li><li><p><strong>Learning protocol/setting</strong>, such as self-supervised learning aka &#8220;next token prediction&#8221;, online/offline RL, on/off-policy RL, direct preference learning, etc., and their sequencing across pre- and <a href="https://www.interconnects.ai/p/the-state-of-post-training-2025">post-training</a>.</p></li><li><p><strong>Loss/objective</strong>, such as token prediction objectives, energy based modelling (EBM) objectives, RL objectives.</p></li><li><p><strong>Training data collection or generation</strong>, such as:</p><ul><li><p>by paid humans (<a href="https://scale.com/">Scale AI</a>);</p></li><li><p>making screen recordings of <a href="https://x.com/RichardMCNgo/status/1875093600612261909">real experts doing real work</a> (<a href="https://workshoplabs.ai/">Workshop Labs</a> is betting on this);</p></li><li><p>simulation (e.g., for training embodied agents; see Nvidia&#8217;s Isaac Sim); </p></li><li><p>synthetic data generation, (open-ended) <a href="https://www.mechanize.work/blog/sweatshop-data-is-over/">interactive environments</a> such as Minecraft or <a href="https://github.com/Metta-AI/metta">Metta</a>; or</p></li><li><p><a href="https://kevinlu.ai/the-only-important-technology-is-the-internet">product-research co-design</a>.</p></li></ul></li><li><p><strong>Training data sequencing</strong>, such as <a href="https://en.wikipedia.org/wiki/Curriculum_learning">curriculum learning</a>.</p></li></ul><p>There are obviously endless combinations of the above making distinct learning problem definitions. Here&#8217;s a tiny sample, in which I try to reflect the diversity of approaches that are being considered, including in relation to AI agents: </p><ul><li><p><strong>Reasoning models</strong> that are post-trained with RL to search in the token space:</p><ul><li><p>&#8220;Simple&#8221; Chain-of-Thought as described in <a href="https://arxiv.org/abs/2501.12948">DeepSeek-R1</a> (2024)<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-12" href="#footnote-12" target="_self">12</a>,</p></li><li><p><a href="https://arxiv.org/abs/2501.04682">Meta-CoT</a> (Xiang et al., 2025)<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-13" href="#footnote-13" target="_self">13</a>,</p></li><li><p><a href="https://arxiv.org/abs/2506.08388">Reinforcement Learning Teachers</a> (Cetin et al., 2025)<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-14" href="#footnote-14" target="_self">14</a>,</p></li><li><p><a href="https://arxiv.org/abs/2503.19618">using perplexity as a reward signal</a> (Tang et al., 2025)<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-15" href="#footnote-15" target="_self">15</a>, and</p></li><li><p><em>multi-chain-of-thought</em> as in OpenAI&#8217;s o3-pro, Gemini Deep Think, and Grok 4 Heavy.</p></li></ul></li><li><p>Pre-training LLMs with retrieval (Shao et al., 2024)<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-16" href="#footnote-16" target="_self">16</a>.</p></li><li><p>Latent Program Network for gradient-based search in latent program space duing test time (Bonnet and Macfarlane, 2024)<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-17" href="#footnote-17" target="_self">17</a>.</p></li><li><p>Joint Bayesian inference of graphical structure and parameters with a single GFlowNet (Deleu et al., 2023)<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-18" href="#footnote-18" target="_self">18</a>.</p></li><li><p>Large Concept Models (LCM team, 2024)<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-19" href="#footnote-19" target="_self">19</a>.</p></li><li><p>Joint Embedding Predictive Architecture (LeCun, 2022) [3].</p></li><li><p>Various neuro-symbolic approaches: see (Wan et al., 2024)<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-20" href="#footnote-20" target="_self">20</a>, and the next section.</p></li><li><p>Graph Neural Networks (GNNs), Generative Adversarial Networks (GANs), etc.</p></li></ul><h5>Composability</h5><p>In the context of learning problem definitions, <strong>the </strong><em><strong>generalization capacity</strong></em><strong> (of an ML architecture) is exactly that I call </strong><em><strong>composability</strong></em><strong> in this post</strong>. In ML literature, there are plenty of direct claims that the generalization capacity varies between different problem definitions, such as <a href="https://www.sciencedirect.com/science/article/pii/S0004370221000862">Reward is Enough</a> (Silver et al., 2021)<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-21" href="#footnote-21" target="_self">21</a>, <a href="https://arxiv.org/abs/2501.17161">SFT memorizes, RL generalizes</a> (Chu et al., 2025)<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-22" href="#footnote-22" target="_self">22</a>. Famously, the problem that LLMs were originally designed to learn (predict the next token) was not widely thought to be composable before GPT-3 (Brawn et al., 2020)<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-23" href="#footnote-23" target="_self">23</a>. Reasoning models trained on top of LLMs (2024 onwards) learn to solve even higher-level problems. However, still there are doubts whether this approach can generalize (aka &#8220;scale&#8221;) much further than certain domains with sharp and easily verifiable rewards, namely math and programming. Indeed, it is this doubt or disbelief that motivated people to develop a lot of alternative learning problem definitions that are hoped to generalize/scale better, including most of the learning problem definitions mentioned above.</p><p>Note that here &#8220;learning problem composability&#8221; should mean that the problem is still solved with a single model inference episode (rollout). Solving bigger/harder problems with scaffolding shifts into the territory of <em>compound AI systems</em>, see below.</p><p>A notable concern with LLMs and LLM-based reasoning models is that they often can&#8217;t do targeted modifications of existing artifacts as well as they can generate artifacts anew. Such targeted modifications can be active inference and plan corrections for AI agents. So, it can be said that <strong>while LLMs generalize (scale) relatively well to higher-level (composite) problems, they </strong><em><strong>don&#8217;t</strong></em><strong> enable a rich repertoire of <a href="https://www.oilshell.org/blog/2022/02/diagrams.html#shell-and-distributed-systems">operations</a> in relation to these problems</strong><a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-24" href="#footnote-24" target="_self">24</a>.</p><p>An alternative, <em>data-centric</em> view seems to be on the rise (Zha et al., 2025)<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-25" href="#footnote-25" target="_self">25</a>, which includes some or all of these beliefs: (1) current ML architectures don&#8217;t actually generalize in some strong sense; (2) &#8220;in-distribution is the new generalization&#8221;; (3) open-ended pipelines/flywheels/environments for generating high-quality and rich training data is &#8220;all you need&#8221; to move to the next S-curve in intelligence scaling. See &#8220;<a href="https://kevinlu.ai/the-only-important-technology-is-the-internet">The only important technology is the Internet</a>&#8221; by Kevin Lu (2025) for a detailed argument. In the context of this post, this discussion moves into the territory of much higher levels (user interface, medium, product, economic/social networks), discussed later.</p><h5>Hijackability</h5><p>The NN (such as an LLM-based reasoning model) hijacking the reinforcement learning process it&#8217;s been subjected to is known as <strong><a href="https://lilianweng.github.io/posts/2024-11-28-reward-hacking/">reward hacking</a></strong> (Weng, 2024)<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-26" href="#footnote-26" target="_self">26</a>. In the more specific context of RLHF, the manifestation of reward hacking is known as <em>sycophancy</em> (Sharma et al., 2023)<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-27" href="#footnote-27" target="_self">27</a>.</p><p>Training data hijacks as known as <em>poisoning</em>. The training data generation process could also be hijacked in various ways, either by LLMs themselves (as in <a href="https://arxiv.org/abs/2412.14093">Greenblatt et al., 2024</a>) or by the corporations owning the products (such as social media platforms) that are used to generate the training data or labels from perverse incentives.</p><p>See <a href="https://arxiv.org/abs/2504.15585">Wang, Zhang, et al.</a> (2025)<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-28" href="#footnote-28" target="_self">28</a> for many other ways in which the learning problem definition or the training data could be hijacked or <a href="https://en.wikipedia.org/wiki/Goodhart%27s_law">goodharted</a>.</p><h3>Languages, ontologies, and data models <em>for</em> LLM-generated programs, plans, and knowledge representation</h3><p>Generating programs with LLMs is the most tractable neurosymbolic architecture because it&#8217;s both easily <em>composable</em> with LLM-based reasoning models when they generate natural language. This architecture could also <em>reuse</em> the reasoning models with just a little extra RL training, if not simply prompting to generate programs.</p><p>Program synthesis is a promising approach towards AI with a higher generalization capacity (Knoop and Chollet, 2024)<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-29" href="#footnote-29" target="_self">29</a>.</p><p>Apart from scaling general problem solving/intelligence, program synthesis is also thought to scale risk estimate and safety cases/assurances: see the <a href="https://arxiv.org/abs/2405.06624">Guaranteed Safe AI agenda</a> (Dalrymple et al., 2024)<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-30" href="#footnote-30" target="_self">30</a>.</p><p>The boundaries between programming language, DSL, ontology, and data models are fuzzy, and indeed in languages designed for powerful composability, such as Lisps and <a href="https://metta-lang.dev/">MeTTa</a>, program and data representations are completely <a href="https://en.wikipedia.org/wiki/Homoiconicity">homoiconic</a>.</p><p>The <strong>composability</strong> of this or that language, ontology, or data model is often hotly debated. For example, <a href="https://www.aria.org.uk/media/3nhijno4/aria-safeguarded-ai-programme-thesis-v1.pdf">Safeguarded AI</a> embodies davidad&#8217;s view that even existing mathematics are not entirely sufficient for general world modelling, let alone any of the existing ontologies and languages. On the other hand, Walters et al. (2025)<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-31" href="#footnote-31" target="_self">31</a> <a href="https://arxiv.org/abs/2502.04249">argue</a> that hierarchical probabilistic models readily presentable in probabilistic PLs or DSLs such as <a href="https://www.pymc.io/welcome.html">PyMC</a> in Python are enough to scale safety cases to any practical level of precision or risk tolerance.</p><p>The <strong>hijackability</strong> (exploitability) of formal ontologies and data models in application to agentic behaviour and decision-making are discussed under the labels of <a href="https://www.lesswrong.com/posts/yCuzmCsE86BTu9PfA/there-are-no-coherence-theorems">coherence arguments, completeness, and money-pump arguments</a> (Thornley, 2023)<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-32" href="#footnote-32" target="_self">32</a>.</p><h3>Natural language</h3><p>The natural language is the &#8220;native&#8221; interface for LLMs.</p><p>A tiny sample of abstraction levels developed by people on top of natural language includes <em>language-based reasoning</em> (more or less corresponds to Aristotelean logic), <em>role-based approach to business process modeling</em> (implicitly underpins much of business workflow automation with LLMs a.k.a. &#8220;enterprise AI agents&#8221;), and <em>law</em>.</p><p>Specific attempts of large labs to turn language (prompts) into <em>reliable specifications</em> (like protocols) include Anthropic&#8217;s <a href="https://www.anthropic.com/research/constitutional-ai-harmlessness-from-ai-feedback">Constitutional AI</a> (Bai et al., 2022)<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-33" href="#footnote-33" target="_self">33</a> and OpenAI&#8217;s  <a href="https://arxiv.org/abs/2412.16339">deliberative alignment</a> (Guan et al., 2024)<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-34" href="#footnote-34" target="_self">34</a>. In &#8220;<a href="https://cdn.openai.com/papers/practices-for-governing-agentic-ai-systems.pdf">Practices for Governing Agentic AI Systems</a>&#8221; (Shavit, Agarwal, Brundage, et al., 2023)<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-35" href="#footnote-35" target="_self">35</a>, OpenAI suggested that AI agents can be controlled by three different roles: the <em>model developer</em>, the <em>system deployer</em>, and the <em>user</em> through natural language means:</p><ul><li><p>The model developer does post-training with methods including something like constitutional AI or deliberative alignment (supervening on machine learning methods discussed in the &#8220;Learning problem definitions and training data&#8221; section above).</p></li><li><p>The system deployer chooses the system prompt in natural language. (The system deployer could also do fine-tuning, which would also be the application of a natural language-based method supervening on a machine learning method.)</p></li><li><p>The user sets the <em>goals</em> and <em>instructions</em> for the AI agent in natural language through its messages.</p></li></ul><p>Natural language is <em><strong>somewhat</strong></em><strong> composable</strong>, but not very reliably and scalably so.</p><p>The examples of <strong>hijackability</strong> of natural language abstractions are <strong>LLM jailbreaks</strong> (see Wang, Zhang, et al., 2025) [28] and parasitic memes affecting humans and LLMs alike. In <a href="https://www.full-stack-alignment.ai/paper">Full-Stack Alignment</a> (Edelman et al., 2025)<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-36" href="#footnote-36" target="_self">36</a>, the natural language agent control paradigm is called <em>values-as-text (VAT)</em> and the ways in which values-as-text are being hacked are reviewed, such as through politicized slogans, the instances of parasitic memes.</p><h3>Compound AI systems, knowledge/memory management, and cognitive architectures</h3><p>Designs and methods in this class emphasize &#8220;wrapping&#8221; LLM calls into higher-level system to unlock agentic capabilities, generalization, robustness, and controllability. Examples of such methods include:</p><ul><li><p>End-to-end prompt tuning: see <a href="https://dspy.ai/">DSPy</a>.</p></li><li><p>LLM observing other LLMs&#8217; (or one&#8217;s own) outputs: the basic method used throughout, such as for <em>guardrails</em>, <em>reflection</em>, <em>planning</em>, etc.</p></li><li><p>The so-called <em>multi-agent systems</em> (MAS) are usually just the combinations of the previous technique (LLM observing the outputs of the preceding LLM call sequence) and variable role-based prompting.</p></li><li><p>Execution of a symbolic model that is generated by LLM and feeding the results back into LLM: see the section &#8220;Languages, ontologies, and data models for LLM-generated programs, plans, and knowledge representation&#8221; above.</p></li><li><p>Using LLMs as probability samplers within a Bayesian agent architecture: see <a href="https://arxiv.org/abs/2402.17930">CLIPS</a>.</p></li><li><p>Multiple purpose-trained NNs optimising towards a shared objective and communicating in the activation/representation space: see Joint Embedding Predictive Architecture (LeCun, 2022) [3].</p></li><li><p>Agentic memory though note-taking and note graph curation: see <a href="https://arxiv.org/abs/2502.12110">A-MEM</a> (Xu et al., 2025)<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-37" href="#footnote-37" target="_self">37</a>.</p></li><li><p>Knowledge graph management with LLMs: see <a href="https://arxiv.org/abs/2410.11531">AGENTiGraph</a> (Zhao et al., 2024)<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-38" href="#footnote-38" target="_self">38</a>, <a href="https://www.system.com/platform/system-graph">System.com&#8217;s knowledge graph platform</a>.</p></li></ul><p>The <strong>composability</strong> of compound AI system and knowledge/memory management methods varies a lot depending on the specific system and design:</p><ul><li><p>DSPy is explicitly design to approach programming language degree of composability through <a href="https://dspy.ai/learn/programming/signatures/">module signatures</a>.</p></li><li><p>Naive composition of LLMs observing other LLMs&#8217; outputs is probably not very composable, with high risks of correlated failures of the original and the &#8220;reviewer&#8221; LLM calls, <a href="https://github.com/chroma-core/context-rot">context rot</a>, etc.</p></li><li><p>The composability (scalability) of knowledge and memory management systems depends on the composability of the knowledge ontology used, if any (for open systems that are not governed by a single entity, it&#8217;s impossible to agree on and maintain a single shared ontology). If no formal ontology is used, these systems are limited by the composability of the natural language: see the previous section.</p></li></ul><p>Guardrails, reflection, planning, so-called &#8220;multi-agent&#8221; interactions, and similar compound AI methods are sometimes implemented with so-called &#8220;<a href="https://www.latent.space/i/161759114/impact-of-agent-frameworks">agent frameworks</a>&#8221;, such as <a href="https://github.com/langchain-ai/langgraph">LangGraph</a>, <a href="https://github.com/microsoft/autogen">AutoGen</a>, or <a href="https://github.com/crewAIInc/crewAI">CrewAI</a>. Considering that this CAIS level is being constantly <a href="https://www.latent.space/p/noam-brown">eaten up by monolithic reasoning models</a>, and that it doesn&#8217;t seem to categorically increase the composability/scalability and robustness/controllability of reasoning models, it&#8217;s remarkable to me how much attention this level attracts.</p><h3>Agent interaction protocols and contracting</h3><p>The primary examples here, of course, are <a href="https://modelcontextprotocol.io/">MCP</a> (insofar people think about it as a protocol for agent interaction and composition: see <a href="https://github.com/lastmile-ai/mcp-agent">mcp-agent</a>) and the <a href="https://a2a-protocol.org/latest/">A2A protocol</a>. Smart contracts are sometimes brought up, too (Karim et al., 2025)<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-39" href="#footnote-39" target="_self">39</a>. See <a href="https://www.lesswrong.com/s/9SJM9cdgapDybPksi">Technologies for Intelligent Voluntary Cooperation</a> by Duettmann, Miller, and Peterson (<a href="https://foresightinstitute.substack.com/p/coming-soon">2022</a>) for a much deeper dive into many other related abstraction levels.</p><p>The incumbent (&#8220;pre-AI&#8221;) abstraction in this class is <em>contract law</em>. Observe that <strong>good old contract law is more composable/scalable than shiny new MCP and A2A</strong>: for example, MCP and A2A are completely oblivious of interactions between more than two primary parties. So, we should expect agent interaction protocols to evolve in the direction of contract law, or even wholesale adopt it if AI agents become <a href="https://en.wikipedia.org/wiki/Legal_person">legal persons</a>. See Goldstein and Salib (2025)<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-40" href="#footnote-40" target="_self">40</a> for the argument granting AIs legal personhood.</p><p>The <strong>hijackability</strong> of interaction and contracting protocols is studied under the rubrics of <a href="https://arxiv.org/abs/2412.16384">algorithmic contract theory</a>, game theory, and mechanism design (D&#252;tting et al., 2024)<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-41" href="#footnote-41" target="_self">41</a>.</p><p>Note that while contract law is potentially more composable than other agent interaction mechanisms, <strong>the cost of exploits in contract law is much higher</strong> because of how slow and costly it is to patch the law compared to protocol specifications and technical mechanisms. Especially if we consider that AI agents could change tactics and act at several orders of magnitude higher pace than humans and (human) organizations.</p><h3>User interface, human&#8212;AI collaboration design</h3><p>The currently dominant UX pradigms for AI are simply the rehearsals of three very old ideas:</p><ul><li><p><strong>Chat</strong>: ChatGPT, Claude, Cursor, etc.</p></li><li><p><strong>Command line interface</strong>: Claude Code, Gemini CLI, etc.</p></li><li><p><strong>Delegation</strong>: OpenAI&#8217;s Operator recently rebranded as Agent, Deep Research, OpenAI Codex.</p></li></ul><p><strong>All three fall short on composability with human&#8217;s specific knowledge/competence/skill</strong> (for example, coding agents effectively force software engineers to <em>become</em> <em>frantic project managers</em> instead of <em>building their engineering skills</em>) <strong>as well as the general <a href="https://forum.effectivealtruism.org/posts/qK4GdBNiP6fufqzDy/reasoning-decay">agency, creativity, and reasoning capacities</a></strong>: they incentivize people to behave in agency-shrinking ways and make it hard to act in agency-expanding ways. What&#8217;s worse, all these effects actively <em>undermine human&#8217;s willingness (and, eventually, ability) to make up for vulnerabilities (&#8220;hijackabilities&#8221;) of the lower levels</em>. <a href="https://www.theregister.com/2025/07/07/scholars_try_to_fool_llm_reviewers/">Academics sneaking prompt injections into papers to fool reviewers who delegate their work to AIs</a> is a good example of this process.</p><h3>Some higher levels</h3><p>There are plenty of yet higher classes of levels relevant for AI agency architecture that I won&#8217;t discuss in this post, but I want to point to a few interesting ones.</p><p><strong>Microeconomic abstractions and platforms</strong>: cryptocurrencies, <a href="https://engineeringideas.substack.com/p/gaia-network-an-illustrated-primer">Free Energy Reduction</a> (FER), <a href="https://en.wikipedia.org/wiki/Prediction_market">prediction markets</a>, <a href="https://icml.cc/virtual/2024/workshop/29967">other agentic markets</a>.</p><p><strong>Media and large-scale platforms for human and AI interaction</strong>. Kevin Lu writes insightfully about this level in &#8220;<a href="https://kevinlu.ai/the-only-important-technology-is-the-internet">The only important technology is the Internet</a>&#8221;. See also: the <a href="https://llmstxt.org/">/llms.txt initiative</a>, <a href="https://github.com/nlweb-ai/NLWeb">NLWeb</a> (a protocol for conversational web), Agentic Web Interface (L&#249; et al., 2025)<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-42" href="#footnote-42" target="_self">42</a>, Meta&#8217;s Metaverse, Jim Rutt&#8217;s idea of <a href="https://jimruttshow.blubrry.net/the-jim-rutt-show-transcripts/transcript-of-ep-239-alex-fink-on-improving-information-quality/">info agents</a>, <a href="https://nostr.org/">Nostr</a> (a permissionless decentralised protocol for free speech, <a href="https://www.youtube.com/watch?v=NS5JI-ksaXs">Jack Dorsey&#8217;s new favourite</a>).</p><p><strong>Physical control, privacy, and data ownership</strong>. A lot of people assign very high value to having access to the model weights (&#8220;not your weights, not your brain/agent&#8221;), despite not planning to fine-tune them and the half-life of agent deployments (perhaps measured in months on average) making self-hosting uneconomical. Hence, this should be due to privacy, surveillance, and censorship concerns.</p><p>Relatedly, I&#8217;ve proposed the <a href="https://engineeringideas.substack.com/p/personal-agents">Personal Agents</a> toolkit (as an alternative to cookie-cutter &#8220;agent product packages&#8221; from &#8220;Big Token&#8221;: ChatGPT, Gemini, Grok, and Claude) to foster the adoption of open-source agent designs that should in turn <em>enable open-ended innovation</em> at yet higher, <em>institution and governance</em> levels. <a href="https://ii.inc/web/blog/post/commons-week-july-2025">Intelligent Internet&#8217;s Contexts</a> and <a href="https://github.com/open-webui/open-webui">Open WebUI</a> already embody my vision of Personal Agents to a significant degree.</p><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-1" href="#footnote-anchor-1" class="footnote-number" contenteditable="false" target="_self">1</a><div class="footnote-content"><p>Cf. Smith, Samuel. &#8220;<a href="https://github.com/SmithSamuelM/Papers/blob/f7e545909d654de6e1ae2f1867bcfe8f201050c5/presentations/TSPSlides20230308.web.pdf">Trust Spanning-layer Protocol (TSP) Proposal</a>.&#8221; (2023), slide 61.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-2" href="#footnote-anchor-2" class="footnote-number" contenteditable="false" target="_self">2</a><div class="footnote-content"><p>Cf. <a href="https://engineeringideas.substack.com/i/154060571/diversity-hourglass-architecture">OS as the middle level in the prototypical diversity hourglass architecture</a> (a section in previous post in this series).</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-3" href="#footnote-anchor-3" class="footnote-number" contenteditable="false" target="_self">3</a><div class="footnote-content"><p>LeCun, Yann. &#8220;<a href="https://openreview.net/pdf?id=BZ5a1r-kVsf">A Path towards Autonomous Machine Intelligence</a>,&#8221; 2022. https://openreview.net/pdf?id=BZ5a1r-kVsf.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-4" href="#footnote-anchor-4" class="footnote-number" contenteditable="false" target="_self">4</a><div class="footnote-content"><p>Zhi-Xuan, Tan, Lance Ying, Vikash Mansinghka, and Joshua B Tenenbaum. &#8220;<a href="https://arxiv.org/abs/2402.17930">Pragmatic Instruction Following and Goal Assistance via Cooperative Language-Guided Inverse Planning</a>.&#8221; arXiv.org, 2024. https://arxiv.org/abs/2402.17930.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-5" href="#footnote-anchor-5" class="footnote-number" contenteditable="false" target="_self">5</a><div class="footnote-content"><p>As contrasted with <em>compound AI systems</em>-level neurosymbolic approaches such as AlphaGeometry. More on compound AI systems below in the post.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-6" href="#footnote-anchor-6" class="footnote-number" contenteditable="false" target="_self">6</a><div class="footnote-content"><p>van Bergen, Ruben, Justus H&#252;botter, and Pablo Lanillos. "<a href="https://arxiv.org/abs/2411.17438">Object-centric proto-symbolic behavioural reasoning from pixels</a>." arXiv preprint arXiv:2411.17438 (2024).</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-7" href="#footnote-anchor-7" class="footnote-number" contenteditable="false" target="_self">7</a><div class="footnote-content"><p>Elhage, et al., "<a href="https://transformer-circuits.pub/2022/solu/index.html">Softmax Linear Units</a>", Transformer Circuits Thread, 2022.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-8" href="#footnote-anchor-8" class="footnote-number" contenteditable="false" target="_self">8</a><div class="footnote-content"><p>Meinke, Alexander, Bronson Schoen, J&#233;r&#233;my Scheurer, Mikita Balesni, Rusheb Shah, and Marius Hobbhahn. &#8220;<a href="https://arxiv.org/abs/2412.04984">Frontier Models Are Capable of In-Context Scheming</a>.&#8221; arXiv.org, 2024. https://arxiv.org/abs/2412.04984.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-9" href="#footnote-anchor-9" class="footnote-number" contenteditable="false" target="_self">9</a><div class="footnote-content"><p>Of course, this observation is not new. In fact, this is <em>the</em> major theme of AI Safety-adjacent concerns and opposition to scaling frontier LLMs by leading corporations. However, this post shows that this concern is just a single corner of a much larger architecture space that surfaces <em>many more</em> concerns and engineering trade-offs.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-10" href="#footnote-anchor-10" class="footnote-number" contenteditable="false" target="_self">10</a><div class="footnote-content"><p>Greenblatt, Ryan, Carson Denison, Benjamin Wright, Fabien Roger, Monte MacDiarmid, Sam Marks, Johannes Treutlein, et al. &#8220;<a href="https://arxiv.org/abs/2412.14093">Alignment Faking in Large Language Models</a>.&#8221; arXiv.org, 2024. https://arxiv.org/abs/2412.14093.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-11" href="#footnote-anchor-11" class="footnote-number" contenteditable="false" target="_self">11</a><div class="footnote-content"><p>Hwang, Sukjun, Brandon Wang, and Albert Gu. &#8220;<a href="https://arxiv.org/abs/2507.07955">Dynamic Chunking for End-To-End Hierarchical Sequence Modeling</a>.&#8221; arXiv.org, 2025. https://arxiv.org/abs/2507.07955.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-12" href="#footnote-anchor-12" class="footnote-number" contenteditable="false" target="_self">12</a><div class="footnote-content"><p>DeepSeek-AI, Daya Guo, Dejian Yang, Haowei Zhang, Junxiao Song, Ruoyu Zhang, Runxin Xu, et al. &#8220;<a href="https://arxiv.org/abs/2501.12948">DeepSeek-R1: Incentivizing Reasoning Capability in LLMs via Reinforcement Learning</a>.&#8221; arXiv.org, 2025. https://arxiv.org/abs/2501.12948.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-13" href="#footnote-anchor-13" class="footnote-number" contenteditable="false" target="_self">13</a><div class="footnote-content"><p>Xiang, Violet, Charlie Snell, Kanishk Gandhi, Alon Albalak, Anikait Singh, Chase Blagden, Duy Phung, et al. &#8220;<a href="https://arxiv.org/abs/2501.04682">Towards System 2 Reasoning in LLMs: Learning How to Think with Meta Chain-of-Thought</a>.&#8221; arXiv.org, 2025. https://arxiv.org/abs/2501.04682.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-14" href="#footnote-anchor-14" class="footnote-number" contenteditable="false" target="_self">14</a><div class="footnote-content"><p>Cetin, Edoardo, Tianyu Zhao, and Yujin Tang. &#8220;<a href="https://arxiv.org/abs/2506.08388">Reinforcement Learning Teachers of Test Time Scaling</a>.&#8221; arXiv.org, 2025. https://arxiv.org/abs/2506.08388.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-15" href="#footnote-anchor-15" class="footnote-number" contenteditable="false" target="_self">15</a><div class="footnote-content"><p>Tang, Yunhao, Sid Wang, Lovish Madaan, and R&#233;mi Munos. &#8220;<a href="https://arxiv.org/abs/2503.19618">Beyond Verifiable Rewards: Scaling Reinforcement Learning for Language Models to Unverifiable Data</a>.&#8221; arXiv.org, 2025. https://arxiv.org/abs/2503.19618.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-16" href="#footnote-anchor-16" class="footnote-number" contenteditable="false" target="_self">16</a><div class="footnote-content"><p>Shao, Rulin, Jacqueline He, Akari Asai, Weijia Shi, Tim Dettmers, Sewon Min, Luke Zettlemoyer, and Pang Wei Koh. &#8220;<a href="https://arxiv.org/abs/2407.12854">Scaling Retrieval-Based Language Models with a Trillion-Token Datastore</a>.&#8221; arXiv.org, 2024. https://arxiv.org/abs/2407.12854.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-17" href="#footnote-anchor-17" class="footnote-number" contenteditable="false" target="_self">17</a><div class="footnote-content"><p>Bonnet, Cl&#233;ment, and Matthew V Macfarlane. &#8220;<a href="https://arxiv.org/abs/2411.08706">Searching Latent Program Spaces</a>.&#8221; arXiv.org, 2024. https://arxiv.org/abs/2411.08706.&#8204;</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-18" href="#footnote-anchor-18" class="footnote-number" contenteditable="false" target="_self">18</a><div class="footnote-content"><p>Deleu, Tristan, Mizu Nishikawa-Toomey, Jithendaraa Subramanian, Nikolay Malkin, Laurent Charlin, and Yoshua Bengio. &#8220;<a href="https://proceedings.neurips.cc/paper_files/paper/2023/hash/639a9a172c044fbb64175b5fad42e9a5-Abstract-Conference.html">Joint Bayesian Inference of Graphical Structure and Parameters with a Single Generative Flow Network</a>.&#8221; <em>Advances in Neural Information Processing Systems</em> 36 (December 15, 2023): 31204&#8211;31.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-19" href="#footnote-anchor-19" class="footnote-number" contenteditable="false" target="_self">19</a><div class="footnote-content"><p>LCM team, Lo&#239;c Barrault, Paul-Ambroise Duquenne, Maha Elbayad, Artyom Kozhevnikov, Belen Alastruey, Pierre Andrews, et al. &#8220;<a href="https://arxiv.org/abs/2412.08821">Large Concept Models: Language Modeling in a Sentence Representation Space</a>.&#8221; arXiv.org, 2024. https://arxiv.org/abs/2412.08821.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-20" href="#footnote-anchor-20" class="footnote-number" contenteditable="false" target="_self">20</a><div class="footnote-content"><p>Wan, Zishen, Che-Kai Liu, Hanchen Yang, Chaojian Li, Haoran You, Yonggan Fu, Cheng Wan, Tushar Krishna, Yingyan Lin, and Arijit Raychowdhury. &#8220;<a href="https://arxiv.org/abs/2401.01040">Towards Cognitive AI Systems: A Survey and Prospective on Neuro-Symbolic AI</a>.&#8221; arXiv.org, 2024. https://arxiv.org/abs/2401.01040.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-21" href="#footnote-anchor-21" class="footnote-number" contenteditable="false" target="_self">21</a><div class="footnote-content"><p>Silver, David, Satinder Singh, Doina Precup, and Richard S Sutton. &#8220;<a href="https://www.sciencedirect.com/science/article/pii/S0004370221000862">Reward Is Enough</a>.&#8221; Artificial Intelligence 299 (May 24, 2021): 103535&#8211;35. https://doi.org/10.1016/j.artint.2021.103535.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-22" href="#footnote-anchor-22" class="footnote-number" contenteditable="false" target="_self">22</a><div class="footnote-content"><p>Chu, Tianzhe, Yuexiang Zhai, Jihan Yang, Shengbang Tong, Saining Xie, Dale Schuurmans, Quoc V Le, Sergey Levine, and Yi Ma. &#8220;<a href="https://arxiv.org/abs/2501.17161">SFT Memorizes, RL Generalizes: A Comparative Study of Foundation Model Post-Training</a>.&#8221; arXiv.org, 2025. https://arxiv.org/abs/2501.17161.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-23" href="#footnote-anchor-23" class="footnote-number" contenteditable="false" target="_self">23</a><div class="footnote-content"><p>Brown, Tom B, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, et al. &#8220;<a href="https://arxiv.org/abs/2005.14165">Language Models Are Few-Shot Learners</a>.&#8221; arXiv.org, 2020. https://arxiv.org/abs/2005.14165.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-24" href="#footnote-anchor-24" class="footnote-number" contenteditable="false" target="_self">24</a><div class="footnote-content"><p>The kind of  &#8220;M types x N operations with a narrow waist&#8221; architecture discussed in the blog post &#8220;<a href="https://www.oilshell.org/blog/2022/02/diagrams.html">The Internet Was Designed With a Narrow Waist</a>&#8221; is closely related to <strong>bow-ties</strong> that are also a part of John Doyle&#8217;s architecture theory, and themselves are enabled by diversity hourglass architectures. I haven&#8217;t discussed bow-ties in the previous post in this series, but will return to it in the next post.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-25" href="#footnote-anchor-25" class="footnote-number" contenteditable="false" target="_self">25</a><div class="footnote-content"><p>Daochen Zha, Zaid Pervaiz Bhat, Kwei-Herng Lai, Fan Yang, Zhimeng Jiang, Shaochen Zhong, and Xia Hu. &#8220;Data-Centric Artificial Intelligence: A Survey.&#8221; ACM Computing Surveys, January 6, 2025. https://doi.org/10.1145/3711118.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-26" href="#footnote-anchor-26" class="footnote-number" contenteditable="false" target="_self">26</a><div class="footnote-content"><p>Weng, Lilian. &#8220;<a href="https://lilianweng.github.io/posts/2024-11-28-reward-hacking/">Reward Hacking in Reinforcement Learning</a>&#8221;. Lil&#8217;Log (Nov 2024). https://lilianweng.github.io/posts/2024-11-28-reward-hacking/.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-27" href="#footnote-anchor-27" class="footnote-number" contenteditable="false" target="_self">27</a><div class="footnote-content"><p>Sharma, Mrinank, Meg Tong, Tomasz Korbak, David Duvenaud, Amanda Askell, Samuel R Bowman, Newton Cheng, et al. &#8220;<a href="https://arxiv.org/abs/2310.13548">Towards Understanding Sycophancy in Language Models</a>.&#8221; arXiv.org, 2023. https://arxiv.org/abs/2310.13548.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-28" href="#footnote-anchor-28" class="footnote-number" contenteditable="false" target="_self">28</a><div class="footnote-content"><p>Wang, Kun, Guibin Zhang, Zhenhong Zhou, Jiahao Wu, Miao Yu, Shiqian Zhao, Chenlong Yin, et al. &#8220;<a href="https://arxiv.org/abs/2504.15585">A Comprehensive Survey in LLM(-Agent) Full Stack Safety: Data, Training and Deployment</a>.&#8221; arXiv.org, 2025. https://arxiv.org/abs/2504.15585.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-29" href="#footnote-anchor-29" class="footnote-number" contenteditable="false" target="_self">29</a><div class="footnote-content"><p>Knoop, Mike and Fran&#231;ois Chollet. &#8220;<a href="https://arcprize.org/blog/beat-arc-agi-deep-learning-and-program-synthesis">How to Beat ARC-AGI by Combining Deep Learning and Program Synthesis</a>,&#8221; 2024. https://arcprize.org/blog/beat-arc-agi-deep-learning-and-program-synthesis.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-30" href="#footnote-anchor-30" class="footnote-number" contenteditable="false" target="_self">30</a><div class="footnote-content"><p>Dalrymple, David davidad, Joar Skalse, Yoshua Bengio, Stuart Russell, Max Tegmark, Sanjit Seshia, Steve Omohundro, et al. &#8220;<a href="https://arxiv.org/abs/2405.06624">Towards Guaranteed Safe AI: A Framework for Ensuring Robust and Reliable AI Systems</a>.&#8221; arXiv.org, 2024. https://arxiv.org/abs/2405.06624.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-31" href="#footnote-anchor-31" class="footnote-number" contenteditable="false" target="_self">31</a><div class="footnote-content"><p>Walters, Michael, Rafael Kaufmann, Justice Sefas, and Thomas Kopinski. &#8220;<a href="https://arxiv.org/abs/2502.04249">Free Energy Risk Metrics for Systemically Safe AI: Gatekeeping Multi-Agent Study</a>.&#8221; arXiv.org, 2025. https://arxiv.org/abs/2502.04249.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-32" href="#footnote-anchor-32" class="footnote-number" contenteditable="false" target="_self">32</a><div class="footnote-content"><p>Thornley, Elliott. &#8220;<a href="https://www.lesswrong.com/posts/yCuzmCsE86BTu9PfA/there-are-no-coherence-theorems">There Are No Coherence Theorems</a>.&#8221; Lesswrong.com, February 20, 2023. https://www.lesswrong.com/posts/yCuzmCsE86BTu9PfA/there-are-no-coherence-theorems.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-33" href="#footnote-anchor-33" class="footnote-number" contenteditable="false" target="_self">33</a><div class="footnote-content"><p>Bai, Yuntao, Saurav Kadavath, Sandipan Kundu, Amanda Askell, Jackson Kernion, Andy Jones, Anna Chen, et al. &#8220;<a href="https://arxiv.org/abs/2212.08073">Constitutional AI: Harmlessness from AI Feedback</a>.&#8221; arXiv.org, 2022. https://arxiv.org/abs/2212.08073.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-34" href="#footnote-anchor-34" class="footnote-number" contenteditable="false" target="_self">34</a><div class="footnote-content"><p>Guan, Melody Y, Manas Joglekar, Eric Wallace, Saachi Jain, Boaz Barak, Alec Helyar, Rachel Dias, et al. &#8220;<a href="https://arxiv.org/abs/2412.16339">Deliberative Alignment: Reasoning Enables Safer Language Models</a>.&#8221; arXiv.org, 2024. https://arxiv.org/abs/2412.16339.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-35" href="#footnote-anchor-35" class="footnote-number" contenteditable="false" target="_self">35</a><div class="footnote-content"><p>Shavit, Yonadav, Sandhini Agarwal, Miles Brundage, Steven Adler, Cullen O'keefe, Rosie Campbell, Teddy Lee, et al. &#8220;<a href="https://cdn.openai.com/papers/practices-for-governing-agentic-ai-systems.pdf">Practices for Governing Agentic AI Systems</a>.&#8221; 2023. https://cdn.openai.com/papers/practices-for-governing-agentic-ai-systems.pdf.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-36" href="#footnote-anchor-36" class="footnote-number" contenteditable="false" target="_self">36</a><div class="footnote-content"><p>Edelman, Joe, Tan Zhi-Xuan, Ryan Lowe, Oliver Klingefjord, Vincent Wang-Ma&#347;cianica, Matija Franklin, Ryan Othniel Kearns, Ellie Hain, Atrisha Sarkar, et al. &#8220;<a href="https://www.full-stack-alignment.ai/paper">Full-Stack Alignment: Co&#8209;Aligning AI and Institutions with Thick Models of Value</a>.&#8221; 2025. https://www.full-stack-alignment.ai/paper.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-37" href="#footnote-anchor-37" class="footnote-number" contenteditable="false" target="_self">37</a><div class="footnote-content"><p>Xu, Wujiang, Kai Mei, Hang Gao, Juntao Tan, Zujie Liang, and Yongfeng Zhang. &#8220;<a href="https://arxiv.org/abs/2502.12110">A-MEM: Agentic Memory for LLM Agents</a>.&#8221; arXiv.org, 2025. https://arxiv.org/abs/2502.12110.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-38" href="#footnote-anchor-38" class="footnote-number" contenteditable="false" target="_self">38</a><div class="footnote-content"><p>Zhao, Xinjie, Moritz Blum, Rui Yang, Boming Yang, Luis M&#225;rquez Carpintero, M&#243;nica Pina-Navarro, Tony Wang, et al. &#8220;<a href="https://arxiv.org/abs/2410.11531">AGENTiGraph: An Interactive Knowledge Graph Platform for LLM-Based Chatbots Utilizing Private Data</a>.&#8221; arXiv.org, 2024. https://arxiv.org/abs/2410.11531.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-39" href="#footnote-anchor-39" class="footnote-number" contenteditable="false" target="_self">39</a><div class="footnote-content"><p>Karim, Md Monjurul, Dong Hoang Van, Sangeen Khan, Qiang Qu, and Yaroslav Kholodov. &#8220;<a href="https://www.mdpi.com/1999-5903/17/2/57">AI Agents Meet Blockchain: A Survey on Secure and Scalable Collaboration for Multi-Agents</a>.&#8221; Future Internet 17, no. 2 (February 2, 2025): 57&#8211;57. https://doi.org/10.3390/fi17020057.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-40" href="#footnote-anchor-40" class="footnote-number" contenteditable="false" target="_self">40</a><div class="footnote-content"><p>Salib, Peter, and Simon Goldstein. &#8220;<a href="https://doi.org/10.2139/ssrn.5353214">AI Rights for Human Flourishing</a>.&#8221; 2025. https://doi.org/10.2139/ssrn.5353214.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-41" href="#footnote-anchor-41" class="footnote-number" contenteditable="false" target="_self">41</a><div class="footnote-content"><p>Duetting, Paul, Michal Feldman, and Inbal Talgam-Cohen. &#8220;<a href="https://arxiv.org/abs/2412.16384">Algorithmic Contract Theory: A Survey</a>.&#8221; arXiv.org, 2024. https://arxiv.org/abs/2412.16384.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-42" href="#footnote-anchor-42" class="footnote-number" contenteditable="false" target="_self">42</a><div class="footnote-content"><p>L&#249;, Xing Han, Gaurav Kamath, Marius Mosbach, and Siva Reddy. &#8220;<a href="https://arxiv.org/abs/2506.10953">Build the Web for Agents, Not Agents for the Web</a>.&#8221; arXiv.org, 2025. https://arxiv.org/abs/2506.10953.</p><p>&#8204;</p><p></p></div></div>]]></content:encoded></item><item><title><![CDATA[Trace LLM workflows at your app's semantic level, not at the OpenAI API boundary]]></title><description><![CDATA[The data architecture for provider-agnostic reproducibility and experiments with LLM agents and workflows]]></description><link>https://engineeringideas.substack.com/p/trace-llm-workflows-at-your-apps</link><guid isPermaLink="false">https://engineeringideas.substack.com/p/trace-llm-workflows-at-your-apps</guid><dc:creator><![CDATA[Roman Leventov]]></dc:creator><pubDate>Fri, 11 Jul 2025 06:35:31 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!EJj2!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F55443e67-0a66-4164-8473-09b13a2e90ca_256x256.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>"<a href="https://hackernoon.com/stop-prompting-start-engineering-15-principles-to-deliver-your-ai-agent-to-production">Stop Prompting, Start Engineering: 15 Principles to Deliver Your AI Agent to Production</a>" by Vladyslav Chekryzhov deserves far more attention than it has received. As a practicing AI engineer, I can tell the article is born from hard-won experience in production. The advice and checklists in that article are very worth following.</p><p>In this post, I want to <strong>discuss more concretely the implementation of some of the principles from Chekryzhov's article, and the resulting data architecture required for LLM agent/workflow apps to embody these principles.</strong> And consequently, my thoughts on AI tracing/observability SaaSes such as LangSmith, Helicone, Langfuse, Arize, etc. TLDR: I think they are ultimately not suited for <em>provider-agnostic</em> reproducibility and experiments that rapid AI agents and workflow development demans.</p><h3>For predictable latency and reliability, workflows have to support many providers and models and be able to switch them at any step</h3><p>Here I quote the "<strong>3. Model as Config</strong>" section from Chekryzhov's article:</p><blockquote><p><strong>Problem:</strong> LLMs are rapidly evolving; Google, Anthropic, OpenAI, etc. constantly release updates, racing against each other across different benchmarks. This is a feast for us as engineers, and we want to make the most of it. Our agent should be able to easily switch to a better (or conversely, cheaper) model seamlessly.</p><p><strong>Checklist:</strong></p><ul><li><p>Model replacement doesn't affect the rest of the code and doesn't impact agent functionality, orchestration, memory, or tools</p></li><li><p>Adding a new model requires only configuration and, optionally, an adapter (a simple layer that brings the new model to the required interface)</p></li><li><p>You can easily and quickly switch models. Ideally&#8212;any models, at minimum&#8212;switching within a model family</p></li></ul></blockquote><p>I agree with this. What's more, if you develop a user-facing application (such as a chat bot or a support bot) for which latency is important, <strong>going fully multi-model, multi-provider is a must.</strong></p><p>Here's an incomplete list of ways a specific model or provider can fail in the specific agent/workflow step:</p><ul><li><p>The provider has an outage. (Hello, Anthropic!)</p></li><li><p>The provider has blocked/censored/refused your request because it got triggered by something in your dialogue, oftentimes actually benign. (Hello, Gemini!)</p></li><li><p>The model fails to return a valid response schema or a correctly formatted tool call. (Everyone, including OpenAI, but especially everyone else.) Sometimes the response is seemingly cut half-way, in which case retry to the same provider usually will help. But often, the response just has a wrong schema/format, in which case retries may <em>not</em> help, even with non-zero temperature. In theory, non-zero temperature setting <em>should</em> make model&#8217;s outputs more variable, but in my experience, it sometimes doesn&#8217;t.</p></li><li><p>The model has randomly failed tool call formatting and instead outputted calls as code or XML tags in the content. (<a href="https://discuss.ai.google.dev/t/gemini-2-flash-api-returns-raw-markdown-instead-of-function-call/71964/3">Hello</a> <a href="https://github.com/RooCodeInc/Roo-Code/issues/4203">again</a>, Gemini.)</p></li><li><p>The model randomly hallucinated specific details that <em>must</em> be right, such as IDs of something that should have been tool call parameters. LLM should have picked up from the context, but didn't. Of course, models hallucinate all the time, but in these cases it could be easily verifiable (e.g., the ID doesn't appear in the context) and hence the request should be retried, preferably with a different model.</p></li><li><p>The provider updated something small about the exact response format, structured outputs/tool calls schema processing, thinking/reasoning, or the like, and this caused one of the insufficiently flexible layers between your app's semantics and the provider to break. These layers can include: proxy services like OpenRouter, client library like LiteLLM/OpenAI client, AI agent/tool call harness like PydanticAI, or your internal LLM call integration layer.</p></li><li><p>When using proxy service such as OpenRouter, their updates can also silently break with certain providers or models in certain cases (structured outputs, tool calls, streaming, thinking) or their combinations.</p></li><li><p>You get a burst of usage and start hitting the throughput limits through one of your insufficiently "beefy" accounts. The remedy for this is proxying everything though OpenRouter, but there are many reasons why this probably makes more harm than good: OpenRouter's own bugs (sometimes not circumventable), extra latency, the single point of failure, etc.</p></li><li><p>Even when the provider doesn't have an outage overall, they sometimes put certain requests "on hold", in which case it may take them minutes even to start streaming you tokens back. Everyone who programmed with AI have experienced these lags.</p></li><li><p>If the agent step uses reasoning, it may randomly "overthink" a request, thinking for minutes on end on a relatively simple task. This could be almost as bad as a failure for latency-sensitive AI apps.</p><ul><li><p><em>Exact</em> circuit breakers won't help because the agent's thinking is not <em>exactly</em> repeated in a loop, merely <em>highly</em> repeated. "Fuzzy reasoning circuit breakers" <em>would</em> help, but this requires the next level of harness sophistication: an LLM monitoring the reasoning stream. It is very hard to implement, adds to costs, streaming LLM responses are their own can of bugs and worms <em>especially</em> with OpenRouter and LiteLLM, etc.</p></li><li><p>Setting hard thinking/reasoning token limits (supported only by Anthropic at the moment, AFAIR?) or <code>"reasoning_effort": "low"</code> usually helps, but is often undesirable: we <em>want</em> to let LLM (provider) to decide how much to think somewhat on their own, based on the difficulty of the request. Requests that genuinely require longer thinking do happen.</p></li></ul></li></ul><p>I used to think that a primary and a single fallback model (for any specific workflow/agent step) were sufficient. In practice, we found that <strong>a chain of at least six(!) model configs was the minimum for</strong> <strong>&gt;99% success rate and latency below threshold, to safeguard against both period-of-time and stray, one-off issues across different providers, accounts, and models.</strong></p><p>For example, in the application that I develop, the core reasoning/chat step currently has the following chain of model configs for fallback:</p><ol><li><p>openrouter/google/gemini-2.5-pro-preview</p></li><li><p>openrouter/google/gemini-2.5-flash-preview:thinking</p></li><li><p>openrouter/openai/o4-mini</p></li><li><p>bedrock/us.anthropic.claude-3-7-sonnet-20250219-v1:0 -- lower than Gemini Flash and o4-mini because it's often slow, and the response latency is important for our application.</p></li><li><p>gemini/gemini-2.5-pro -- same as the first model config in the chain, but directly though Gemini API rather than through OpenRouter.</p></li><li><p>gemini/gemini-2.5-flash</p></li></ol><h3>Implementation challenge: providers' LLM interfaces are just different and hardly convertible between each other</h3><p>While I criticise OpenRouter and LiteLLM above, and they have <a href="https://github.com/BerriAI/litellm">very convoluted code</a> (OpenRouter is wisely closed source), I don't think it's because these proxy layers are built by bad engineers.</p><p>Rather, it reflects that there is <em>a ton</em> of <a href="https://engineeringideas.substack.com/p/intellectual-phases">essential complexity</a> in the task of conforming dozens of models and providers to OpenAI API which is a quasi-standard (and itself is a moving target, e.g. <a href="https://community.openai.com/t/reasoning-no-longer-available-in-api-responses/1116490">reasoning no longer available in API responses</a>). FWIW, <a href="https://standardcompletions.org/">Standard Completions</a> would largely remedy this, but it's a very distant future at the moment, <a href="https://github.com/standardcompletions/rfcs/issues/9">if happens at all</a>.</p><p>When providers (rather than proxies such as OpenRouter who <em>focus</em> on this challenge) try to provide their own "OpenAI compatible" APIs, they often add bugs on their own. (Hello, Grok!) I'm yet to encounter a provider who would be truly compatible with OpenAI API.</p><p>The above challenges of transforming OpenAI-format requests into provider/model-specific requests, and then provider/model-specific responses into OpenAI-format responses are hard enough, but transforming <em>between</em> provider/model-specific formats (OpenAI, Anthropic, Gemini, Bedrock), <em>across the feature matrix:</em> (chat structure, structured outputs/response schemas, tool calls, reasoning, streaming) is practically impossible. We've encountered:</p><ul><li><p>Some models don't support a dedicated <code>"system"</code> prompt, the chat has to start with a <code>"user"</code> message.</p></li><li><p>Gemini <em>requires</em> message's content to have separate <a href="https://ai.google.dev/api/caching#Content">parts</a> for efficient caching, while other "OpenAI compatible" providers are confused by multiple message parts.</p></li><li><p>Some providers <em>prohibiting</em> consecutive <code>"assistant"</code> messages in a chat, requiring inserting dummy empty <code>"user"</code> messages between them.</p></li><li><p>Some providers prohibiting <code>"assistant"</code> response (content) and tool_call to be in the same message, requiring to artificially splitting such responses with both <code>content</code> and <code>tool_calls</code> from other providers. (Obviously, this directly conflicts with the previous point.)</p></li><li><p>Response/structured outputs schemas: <a href="https://github.com/googleapis/python-genai/issues/460">what in the ever living f*** is this shambles Google...?</a></p></li><li><p>Some otherwise good providers and models don't support "native" reasoning and therefore chain-of-thought reasoning has to be specifically prompted, and then <code>&lt;thinking&gt;...&lt;/thinking&gt;</code> tags from the response cut out (see <a href="https://docs.aws.amazon.com/nova/latest/userguide/prompting-chain-of-thought.html">official AWS user guide</a>). But wait, if you need structured outputs, it couldn't be <code>&lt;thinking&gt;...&lt;/thinking&gt;</code>, you will need to modify your schema to insert a <code>"general_thinking":</code> field...</p></li></ul><p>Even more generally, different models work best with different prompts (and less capable models outright require more specific prompting), potentially leading to the matrix (agent/workflow step, provider/model) of system prompts and context formats (such as, for the chat summarisation step, keeping the message list as is vs. condensing the message list in its entirety into a single prompt.)</p><h3>Trace AI workflows at the application's semantic level</h3><p>All the incompatibilities between and specialisations for different LLM providers and models mean that to build for reproducibility and experiments with model- and provider-agnostic AI agent and workflows with heterogeneous steps (tool calls, structured outputs, reasoning, and streaming) we must <em><strong>trace workflows at the application's semantic level</strong></em><strong>, not at the lower-level "OpenAI-ish" API boundary,</strong> <strong>and </strong><em><strong>shape the request for the specific provider and model at runtime</strong></em><strong>.</strong> We can see this as "<a href="https://en.wikipedia.org/wiki/Late_binding">late binding</a> with provider's APIs and specific model's damands".</p><p>Application's data model <em>can</em> include abstractions like "message" and "role" as in the LLM chat APIs, if the application is genuinely a chat (e.g., in a support chat bot), but it shouldn't be limited to them, and shouldn't be constrained to them.</p><p>For example, if some entities are pulled into the LLM context by IDs (e.g., via search), for LLMs to see them the data of these entities should appear somewhere in the system prompt or chat messages's content as plain text. If the workflow trace is captured at the "OpenAI-ish API/formats boundary", as is the case for most LLM tracing and observability services, this contextual data is "fossilized" within the trace. When debugging such a trace, we couldn't easily tell if it was a data quality problem that may have been resolved independently from the AI workflow logic after the workflow took place in production, or it was an actual LLM hallucination that failed the workflow.</p><p>Another benefit of this "late binding" approach to tracing of AI applications over LLM observability SaaS is that it <strong>doesn't need to store requests for every LLM response</strong> because requests can always be re-created from the data. For chat-like applications, the storage overhead for a long-running chats becomes quadratic, as every new turn requires storing the entire history again.</p><h3>Use immutable data schema/design to unify application's persistence and tracing</h3><p>If the application's trace should be kept at the same (semantic) data level at which the core application's logic operates, it becomes clear that that they shouldn't be stored stored separately: the "trace database" can be <em>just</em> the production database(s) that use immutable data schema/designs.</p><p>Immutable data designs are quite simple to implement with all types of databases:</p><ul><li><p>Relational OLTP databases like PostgreSQL and MySQL have <a href="https://wiki.postgresql.org/wiki/Temporal_Extensions">temporal extensions</a> or built-in temporal tables features. Depending on the scale of the application (and how long in the past you would need to keep traces), this may already be good enough. Otherwise, it's possible to setup change data capture into a database in the next category, or better yet, just pick one at the primary storage from the start. Remember that LLM applications would never notice millisecond difference in point query latency between OLTP and OLAP databases.</p></li><li><p>In OLAP, time-series, and streaming databases, such as ClickHouse, Databend, Apache Doris, StarRocks, Firebolt, TimescaleDB/TigerData, <a href="https://questdb.com/glossary/immutable-data-pattern/">QuestDB</a>, or RisingWave, the combination of the native <code>time</code> column + entity (record) ID identifies the immutable version of the entity's data at the point of time that can be linked from other tables and databases.</p></li><li><p>Graph and document databases like Neo4j and ScyllaDB naturally lend themselves to graph- or chain-like data versioning with copy-on-write "head" entity updates, a la Git.</p></li><li><p>Preprocessed tabular data is stored in Hive catalogs or the modern alternatives: Apache Iceberg, Apache Hudi, or Delta Lake, that have built-in table versions that can simultaneously serve as the versions for the entities stored these tables.</p></li></ul><p>The most elegant solution, however, would be to use the actual "database inside out" -- <a href="https://redplanetlabs.com/programming-model">Rama</a>, or "immutable databases" like <a href="https://github.com/xtdb/xtdb">XTDB</a> for the core of the AI workflow logic. I would recommend these for greenfield AI workflow applications if they are not ruled out by organisation's technical strategy that may prescribe selecting from a certain list of databases that are already in use in the organisation (cf. <a href="https://lethain.com/magnitudes-of-exploration/">magnitudes of exploration</a>).</p><p>In our chat application, we are store the user interaction session's data in a single value (keyed by the session ID) in DynamoDB, with atomic updates to prevent races with async messages from the user. To simulate immutability, all changes to the session are stored in the same document, in a separate "revision_history" field. Other pieces of the semantic data in our application are also stored in DynamoDB and in MySQL.</p><h3>Connecting the semantic data traces with LLM responses</h3><p>If an OLAP database is already used to store the semantic trace of the application, it's best to store LLM responses in a separate table (or multiple tables, one per workflow step type/kind) in the same database, to simplify coding your <a href="https://hamel.dev/blog/posts/evals-faq/#q-what-makes-a-good-custom-interface-for-reviewing-llm-outputs">custom evals interfaces</a>.</p><p>Otherwise, I think <a href="https://docs.victoriametrics.com/victorialogs/">VictoriaLogs</a> is optimal due to its efficiency, operational and configuration simplicity (no need to set up search indexes for every column! don't need an "ingestion pipeline"!), automatic "flattening" of LLM responses (JSONs) built-in, and the built-in analytics analytics console.</p><p>Since all providers already send responses with request IDs, there is no need to re-define these IDs for the tracing tables.</p><p>In addition to the raw LLM response fields from the provider, the table includes the workflow ID (which is the same as the "trace" ID) and the entity IDs (pointers to immutable versions of these entities) in the semantic data model that were used to construct the context (request) for this LLM call.</p><p>The request IDs whose responses <em>have directly contributed</em> to the creation of a version of application's semantic entity can be added into array column(s) in the table row (or fields in the document in a NoSQL db) that represents this entity version.</p><p>By LLM requests "contribute to the creation of the version of the entity" not only by literally generating chat messages, structured outputs, and whatnot that end up <em>constituting</em> the entity's data, but also by directing conditional logic:</p><ul><li><p>Pre-generation: fast LLM classification and/or pre-filtering of the user input or external events</p></li><li><p>Post-generation: guardrails, checking that the LLM didn't "forget its role" in the conversation.</p></li></ul><p>If a post-generation guardrail rejects an output of a model and the workflow step is retried (and succeeds) with a different provider or model, that original rejected LLM response <em>also</em> contributes to the new entity version, being the input for the LLM guardrail call that gave way for the eventually successful LLM response.</p><p>Storing LLM request IDs in the semantic data tables as "denormalised" metadata is much easier to program than doing the opposite, storing the IDs of the data that the LLM requests have contributed to. Denormalisation is not an issue because both the LLM responses storage and entities are immutable.</p><p>Still, collecting IDs of all contributing LLM calls at the point of writing down the entity version can become quite burdensome without <a href="https://docs.python.org/3/library/contextvars.html">contextvars</a> (in Python) or their equivalents in other programming languages. To pass LLM request ID "bags" in <code>contextvars</code> between threads (rather than coroutines) in Python is possible with a <a href="https://stackoverflow.com/a/71778109/648955">thread pool executor wrapper</a> that should be used throughout the application code. This reinforces the importance of the keystone principle from Chekryzhov's article: "<strong>Own the Execution Path</strong>".</p><div><hr></div><p>In a follow-up post, I'll describe my experience building a custom trace reproducibility/debugging/evals interface using <a href="https://marimo.io/">marimo</a>.</p>]]></content:encoded></item><item><title><![CDATA[Personal agents]]></title><description><![CDATA[Motivation]]></description><link>https://engineeringideas.substack.com/p/personal-agents</link><guid isPermaLink="false">https://engineeringideas.substack.com/p/personal-agents</guid><dc:creator><![CDATA[Roman Leventov]]></dc:creator><pubDate>Tue, 17 Jun 2025 01:40:43 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!EJj2!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F55443e67-0a66-4164-8473-09b13a2e90ca_256x256.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h3>Motivation</h3><p>I believe that the most important factor in whether our AI future goes broadly well or poorly is whether people quickly develop effective AI-ready (and AI-enabled) institutions and networks<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-1" href="#footnote-1" target="_self">1</a>. In that, I agree with the recent S&#233;b Krier's essay "<a href="https://www.aipolicyperspectives.com/p/maintaining-agency-and-control-in">Maintaining agency and control in an age of accelerated intelligence</a>".</p><p>Many academic groups, non-profit orgs (such as <a href="https://www.cip.org/">Collective Intelligence Project</a>, <a href="https://ai.objectives.institute/">AI Objectives Institute</a>, <a href="https://metagov.org/">Metagov</a>, and <a href="https://www.gaia-lab.de/">Gaia Lab</a>), and even some governmental agencies, such as Taiwan's Ministry of Digital Affairs are currently working on new AI-ready institutions. However, these projects will likely remain theoretical exercises or prototypes unless there is a population of AI-enabled agents (individuals and organisations) eager to coordinate and solve problems together. This is because <a href="https://engineeringideas.substack.com/i/140971628/advanced-organisations-and-institutions-need-each-other">agents and institutions need each other to develop and grow in capability and sophistication</a>.</p><p>Thus, for new AI-enabled institutions to take root and develop, individuals and organisations have to be at least as AI-ready as these institutions.</p><p>Effective use of powerful AI and participation in new economic networks (such as stablecoin payments) obviously promises a lot of advantages to businesses. So, the AI modernisation of the business sphere is already well aligned with the standard economic incentives. It doesn't seem to me that this area needs any extra care or push on the margin.</p><p>However, for individuals, such incentives almost don't exist. Using AI tools at work is not the same as becoming a person ready to participate in AI-first social, political, and media networks (such as Jim Rutt's idea of the network of personal "<a href="https://jimruttshow.blubrry.net/the-jim-rutt-show-transcripts/transcript-of-ep-238-sam-sammane-on-humanitys-role-in-an-ai-dominated-future/">information agents</a>").</p><p>Currently, people mostly use siloed commercial AI apps from OpenAI, Google, Microsoft, and Perplexity. Although all these and other vendors will soon push agentic AI products aggressively, I suspect that these vendors will be reluctant to permit free exploration of the social or political agency of users because this could be politically risky for them and there is no commercial upside for them in doing this<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-2" href="#footnote-2" target="_self">2</a>. So, it's likely that big vendors' agents will keep interacting with the external world on behalf of the users in mostly mundane commercial ways ("plan my next holiday trip") rather than become true companions and faithful representatives of the people in social and political domains, such as setting up a date for the human, recommending a friend, <a href="https://aligned.substack.com/p/a-proposal-for-importing-societys-values">representing the human in a political assembly</a>, and <a href="https://www.linkedin.com/feed/update/urn:li:activity:7334738981017800705/">enabling new types of collaboration between people</a>.</p><p><strong>From this I conclude that increasing the adoption of truly personal agents could be one of the highest-impact things to do on the margin to enable social, political, or media innovation.</strong></p><p>If the above is not a sufficient argument, the wider adoption of personal agents has more positive effects and indirect arguments for working on it:</p><p>(1) It <strong>reduces the power imbalance between people and corporations</strong>: people save money that doesn't go to corporations as subscription revenue. There are no or fewer deplatforming risks, as well as the "traditional" risks of surveillance capitalism and <a href="https://www.amazon.com/Hooked-How-Build-Habit-Forming-Products/dp/1591847788">behaviour manipulation</a> pervasive in the so-called <a href="https://en.wikipedia.org/wiki/Attention_economy">attention economy</a>.</p><p>(2) Individual human intelligence and agency augmentation is almost by definition the most anti-<a href="http://gradual-disempowerment.ai/">gradual disempowerment</a> and anti-<a href="https://intelligence-curse.ai/breaking/">intelligence curse</a> agenda among various other AI safety and "AI for good" agendas.</p><p>(3) Making it easier for people to run their fully personal agents for non-commercial affairs (socialisation, politics, commoning) that should preferably stay this way is a <a href="https://michaelnotebook.com/optimism/">non-market safety</a> project, so we should expect it to be more neglected by default than market safety projects, such as <a href="https://exa.ai/search?q=ai+guardrails+and+ai+safety+startup&amp;filters=%7B%22numResults%22%3A12%2C%22domainFilterType%22%3A%22include%22%2C%22type%22%3A%22auto%22%2C%22text%22%3A%22%5C%22true%5C%22%22%2C%22density%22%3A%22compact%22%2C%22useAutoprompt%22%3Atrue%2C%22resolvedSearchType%22%3A%22neural%22%7D&amp;resolvedSearchType=neural">improving AI robustness or steerability</a>. Of course, to be actually useful and widely adopted, personal agents <em>must</em> be robust, steerable, have long memory, and other characteristics equally attractive for business AI agents, but these capabilities are already actively developed in the open source AI agent frameworks (driven by the business demand), so personal agents can leverage these capabilities without differentially pushing them much.</p><p>Finally, note that the increasing capability of open-weights LLMs and compute becoming cheaper over time will make personal agents even more relevant in the future because completely private agents will be enabled through the inference of open-weights models on rented GPUs, whereas today open-weights non-MoE models are not sufficiently robust as agents and are not sufficiently "deep" for thoughtful engagement with the human, which limits the practicality of such "completely private" setups (or greatly increases their costs, if someone is willing to host the largest DeepSeek, Qwen, or Llama models all on their own). Also, the increasing robustness of coding agents and DevOps agents (whether they are built over APIs or open-weights LLMs) will itself reduce the crucial barriers for the adoption and usage of personal agents, as I will discuss below.</p><h3>Personal agents offer mundane value</h3><p>The personal agents "movement" would descend ideologically from the self-hosted movement, which promotes and advocates for personal, private hosting of apps such as e-mail, calendar, task tracker, photos and file sharing instead of using free cloud services by Google, Microsoft, or Apple.</p><p>It's safe to say that the self-hosted movement has failed: it hasn't gained sufficient traction for about 20 years. I think this is because self-hosting of office apps doesn't actually provide any benefits beyond the ideological satisfaction and the reduction of poorly felt risks of deplatforming, hacking, or data leaks.</p><p>I'm convinced that good intentions and mundane benefits could go much farther than just good intentions, and AI adoption is no different. It's hopeless to promote personal AI agents that are "safer" or "more private" but otherwise are equally or less useful than the agents offered by big vendors.</p><p>Fortunately, I think personal agents have better a priori odds of being adopted than self-hosted productivity apps of the previous era because personal agents do offer immediate and tangible value over agents from big vendors:</p><p><strong>Lower cost.</strong> Flat pricing (usually, 20$/mo) is inadequately high for most personal users, yet virtually all AI vendors employ flat pricing: from general platforms such as OpenAI, Google, Microsoft, and Perplexity, to personal AI tutors and psychotherapists such as <a href="https://auren.app/">Auren</a>, to professional agents such as Shortwave and Cursor. I may want to talk to my AI psychotherapist just once per month and the cost of compute will be less than 10 cents. <em>All</em> personal agents can be run for just 2-3$/mo on data and app hosting + model inference API costs, which will be well below 10$/mo for most people across all their AI agents and apps.</p><p><strong>International availability.</strong> OpenAI and many other AI vendors use Stripe for payment processing in limited configurations, so that people without Visa or MarsterCard cards cannot pay for their services. These are a lot of such people in developing countries.</p><p><strong>Unified context and usage history (memory).</strong> People often talk to AIs across several different vendors, partially because they want to compare results from different base LLMs (and each big vendor ties up the apps with their models) and partially because no vendor offers all agents and apps that the users want. It's impossible to search, query, or reference this tapestry of usage traces. The personal agent platform eliminates this problem by storing <em>all</em> conversation and query history in a single memory layer such as <a href="http://github.com/topoteretes/cognee">Cognee</a>. Of course, the user could also maintain context boundaries by attaching different agents and apps to different memory system instances.</p><p><strong>Customisation.</strong> Want some agent to send you a notification every other day? The deep research agent to ignore results from a certain domain or author? Exchange certain information with your family's or friends' agents in specific situations? The coding agent should be able to do this quite reliably with a single prompt against the stock open-source version of the specific agent. By the end of 2025, coding agents should become so capable that non-programmers can rely on such customisation to work (and to warn them if the user asks for something suspicious) without knowing anything about the source code of the agent they want to customise.</p><h3>Risks</h3><p>I'm aware that the benefits of the personal agent platform that I mentioned above come with their own risks. For example, keeping all personal agents on a single hosting account increases the blast radius if this account is stolen. Or, the "vibe coding agent" can introduce a vulnerability into the code or simply break it in a saddle way.</p><p>These risks seem like the only notable downsides of personal agents, both as a personal choice and as an agenda. I'm still advocating for a wide adoption of personal agents because the benefits seem to outweigh the risks. I also expect that the state of mundane computer security and LLM security (such as against jailbreaks and prompt injection) will get better rather than worse in the next couple of years. If you think I'm wrong about either of those, please let me know.</p><p>The simplest and probably the most likely risk with the deployment of personal agents are not clever prompt injections on the web pages that the agent reads or a vulnerability introduced accidentally when the human asks the coding agent to customise another app or agent, but voluntary deployment of agents with malware, dowloaded from "agent sharing" websites (perhaps, the next generation of shareware website) or untrusted Github repositories.</p><p>It's simple to play an active positive role in mitigating this specific risk, as well as increasing the trust in personal agents overall and thus foster their adoption: <strong>create a directory of vetted agent repositories (and the specific versions and commits within them) and continuously scan them for vulnerabilities with SoTA AI for code security.</strong> This is economical to do this necessary work with resource pooling and perhaps public or institutional funding to reduce the risks for everyone.</p><h3>Levers for fostering the adoption of personal agents</h3><p>To summarise the above, here's how I see the main areas of work for helping personal agents spread:</p><p><strong>(1) Make open source agents more capable and useful at their main tasks than the analogous agents from big vendors.</strong> Open-source agents are at a disadvantage because perhaps they will be using stock LLMs with prompting rather than LLMs post-trained specifically for the given agentic tasks. However, for most personal use cases, the difference may be small or non-existent, especially as the capabilities of the stock models increase.</p><p>(2) Help open-source agent development ecosystem flourish by reducing the barrier into this kind of development, though <strong>agent project templates, scaffolds, and the tested stack of infrastructure pieces (hosting platforms, databases, execution environments, etc.).</strong> <a href="https://github.com/AgentOps-AI/AgentStack">AgentStack</a> is an example of such a project, however, it's not focused on personal agents. Ideally, agent developers start themselves seek compatibility with the <em>personal agents stack</em> (platform, toolkit) because it will aid their distribution, while the personal agents platform benefits from a wider variety of supported agents.</p><p><strong>(3) Eliminate or reduce the barriers for adoption of personal agents, both technical and financial/jurisdictional.</strong> This is a crucial learning from the failure of the self-hosted movement: <strong>non-programmers must be able to set up their own personal agents platform with deal-simple, short, step-by-step instructions</strong>, ideally just to the point of running the manager agent that walks the human through the rest of the process in a dialogue and helps the user to maintain, evolve, and customise their agents. This process should work robustly enough that it gains a reputation of "just working" among non-programmers. <a href="https://brew.sh/">Homebrew</a> comes to mind as the example of a project having such reputation.</p><p>Wrt. financial and jurisdictional barriers, reduce number of separate payments the humans needs to do and accounts to manage. <a href="https://openrouter.ai/">OpenRouter</a>, <a href="https://requesty.ai/">Requesty.ai</a>, and <a href="http://nano-gpt.com/">nano-gpt.com</a> do a great job at unifying LLM API bills (as well as enabling access), but none of them supports any embedding models (on the other hand, recently, embedding-based RAG falls increasingly out of favour among AI agent developers). <a href="https://www.litellm.ai/#pricing">LiteLLM</a> does support embedding models, but doesn't onboard small customers yet.</p><p>Ideally, there should be a way to unify both model API and hosting bills, but unfortunately it doesn't currently seem to me that best hosting services for the personal agent platform (such as <a href="http://fly.io/">Fly.io</a>) will be eager to enter this LLM proxy business because it will be an unnecessary risk for them. It would be awesome if Fly.io or a similar hosting service (Digital Ocean, Vercel, Render, etc.) proves me wrong.</p><p>So, probably two separate bills (and accounts) is the minimum achievable today (with embedding model inference rationed through Gemini Embedding API's free usage limit, for instance).</p><p>(4) <strong>Support distribution and discoverability of personal agent projects</strong>. Currently, it's surprisingly hard to even discover the coolest open-source agent projects on the block, despite them instantly amassing thousands of stars on Github. Perhaps, I don't hang around the right Discord channels or subreddits, but doing either of these things already sounds as a deal breaker if we aim for a really wide adoption. <a href="https://huggingface.co/spaces">HuggingFace Spaces</a> and <a href="https://theresanaiforthat.com/">theresanaiforthat.com</a> might be good enough, so ideally these and similar platforms would add a tag for projects compatible with the personal agents toolkit.</p><p>(5) <strong>Create a directory of open-source agents scanned for malware and vulnerabilities</strong> (see the "Risks" section above) to minimise the chance of a major hack that can undermine people's trust in personal agents.</p><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-1" href="#footnote-anchor-1" class="footnote-number" contenteditable="false" target="_self">1</a><div class="footnote-content"><p><a href="https://engineeringideas.substack.com/p/gaia-network-an-illustrated-primer">Gaia Network</a> is one particular form of such network/institution that Rafael Kaufmann and collaborators in the <a href="https://www.gaia-lab.de/">Gaia Lab</a> have been shaping up.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-2" href="#footnote-anchor-2" class="footnote-number" contenteditable="false" target="_self">2</a><div class="footnote-content"><p>With a possible exception of Meta, whose positioning and business model writ large may, and ideally should be compatible with enablement of new social institutions. However, in practice, <a href="https://thezvi.substack.com/p/zuckerbergs-dystopian-ai-vision">it's much more likely that Meta will move in the exact opposite direction</a>: atomisation of people, which usually can be monetised more easily.</p></div></div>]]></content:encoded></item><item><title><![CDATA[Architecture theory and the hourglass model]]></title><description><![CDATA[Everyone is talking about AI agent architectures, frameworks, and protocols at the moment.]]></description><link>https://engineeringideas.substack.com/p/architecture-theory-and-the-hourglass</link><guid isPermaLink="false">https://engineeringideas.substack.com/p/architecture-theory-and-the-hourglass</guid><dc:creator><![CDATA[Roman Leventov]]></dc:creator><pubDate>Wed, 08 Jan 2025 12:19:49 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!kG-6!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F605c91f8-c5a7-41b5-a22b-e4f435b9e60f_706x566.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Everyone is talking about AI agent architectures, frameworks, and protocols at the moment. Let me apply John Doyle&#8217;s <em>architecture theory<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-1" href="#footnote-1" target="_self">1</a></em> lens to this topic, as well as Micah Beck&#8217;s <em><a href="https://cacm.acm.org/research/on-the-hourglass-model/">hourglass model</a></em> (2019).</p><p>In this first post in this series, I present the key ideas from the architecture theory and the hourglass model. In the next post, I will apply these ideas in the domain AI agents.</p><h3>The distinction between system <em>levels</em> and <em>layers</em></h3><p>The two core concepts in John Doyle&#8217;s architecture theory are <em>levels</em> and <em>layers</em>. They are distinct, and it&#8217;s important not to confuse them.</p><h4>Levels</h4><p><strong>Levels</strong> are the levels of modelling (coarse-graining, abstraction, renormalisation, weak emergence, interpretation) of a system. At different levels of modelling of the same system, the whole ontology, and the types of variables in the dynamical model of the system changes.</p><p><strong>Theories</strong>, <strong>ontics</strong>, <strong>ontologies</strong>, and <strong>spatiotemporal scales</strong> are among loose synonyms for &#8220;levels&#8221; in this sense, or 1-1 associated concepts, such as, it could be said that a certain scientific or normative <em>theory</em> with a specific <em>ontic/ontology</em> describes <em>and defines</em> a specific system <em>level</em>.</p><p>Marr&#8217;s &#8220;<a href="https://www.albany.edu/~ron/papers/marrlevl.html">levels of analysis</a>&#8221; of a cognitive system (implementation, algorithm, and semantics) are the example of &#8220;Doyle&#8217;s levels&#8221;<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-2" href="#footnote-2" target="_self">2</a>. You can describe the human brain/mind, as a physical object, on many <em>levels</em>: molecular dynamics, neuronal dynamics, <a href="https://en.wikipedia.org/wiki/Large-scale_brain_network">brain network</a>, circuit, and <a href="https://en.wikipedia.org/wiki/Two-streams_hypothesis">processing stream</a> dynamics, Hawkins&#8217; <a href="https://engineeringideas.substack.com/i/44683968/mental-reference-frames-of-concepts-have-at-most-seven-features">reference frame</a> (i.e., inference states) dynamics, reasoning dynamics such as <a href="https://en.wikipedia.org/wiki/Intrapersonal_communication">internal monologue</a> aka. chain-of-thought, psychological and developmental dynamics, etc.</p><p>In a coherent description stack of a system (such as a human brain/mind), the theories behind all the levels should be weaved together into an <a href="https://www.lesswrong.com/posts/opE6L8jBTTNAyaDbB/a-multi-disciplinary-view-on-ai-safety-research#3_4__Weaving_together_theories_of_cognition_and_cognitive_development__ML__deep_learning__and_interpretability_through_the_abstraction_grounding_stack">abstraction&#8212;grounding graph</a>. Beware, this could be a source of confusion: the word &#8220;level&#8221; may imply that there should be a total order between the levels of analysis of a system. However, there is probably no order, i.e. asymmetric emergence relation, between the levels of brain network dynamics and psychological dynamics.</p><p>Within the context of architecture theory, it seems useless to distinguish &#8220;mere renormalisations&#8221; (such as a transition from neuronal to brain network dynamics) from <a href="https://plato.stanford.edu/entries/model-theory/">model-theoretic</a> <em>interpretations</em> that give rise the levels <em>across</em> the semantic hierarchy, such as Marr&#8217;s implementation &#8594; algorithm &#8594; semantics transitions. So, below in this post I will ignore these distinctions.</p><h4>Layers</h4><p>In Doyle&#8217;s terminology, <strong>layers</strong> are nested and/or compartmentalised <strong>(sub)systems</strong> (<strong>components</strong>, <strong>parts</strong>), i.e., <em>groups of variables (atoms, elements, objects)</em>, separated by Markov blankets (boundaries).</p><p><strong>Beware of the terminological confusion</strong>: in the fields of <em>network systems engineering</em> (and, more narrowly, <em>protocol engineering</em>) where Micah Beck&#8217;s <a href="https://cacm.acm.org/research/on-the-hourglass-model/">hourglass model</a> and related to it <a href="https://en.wikipedia.org/wiki/End-to-end_principle">end-to-end principle</a> come from, the term <em>layer</em> is used to refer to [Doyle&#8217;s] <em>level</em>. Hence, the <a href="https://en.wikipedia.org/wiki/List_of_network_protocols_(OSI_model)">internet protocol layers</a> in the OSI stack would be called <em>levels</em> by Doyle. To minimise confusion, I&#8217;ll avoid using the term <em>layers</em> and will use other synonyms: <em>subsystems</em>, <em>components</em>, <em>parts</em>, <em>compartments</em> instead.</p><p>The phrase &#8220;system level&#8221; may also be confusing because this may hint at Doyle&#8217;s layer when the system boundaries fully nest within each other, such as the egg yolk within the whole egg within the egg with shell. So, I will call <em>levels</em> simply &#8220;levels&#8221;, or <em>modelling/abstraction/renormalisation levels</em>.</p><p>The way the dynamic variables at a certain level are compartmentalised into subsystems (by drawing &#8220;imaginary&#8221; system boundaries/Markov blankets) is itself a subject of inference for the observer (aka. modeller, rational agent, scientist). Different ways to &#8220;slice up&#8221; the &#8220;whole modelling field&#8221; at the given level (aka &#8220;the whole system&#8221;) into (sub)systems could be more or less useful for specific practical goals that the observer has.</p><p>For example, when analysing the brain on the level of neuronal dynamics, neuroscientists may group neurons into subsystems in different ways, such as the cortical <em>layers</em>, cortical <em>columns</em>, or neuronal circuits, and then hypothesise the emergent properties of these subsystems and thus move to a higher <em>level</em> of analysis.</p><h3>Diversity hourglass architecture</h3><p><strong>Diversity hourglass</strong> is an architecture (a class of systems) with a particular pattern on three successive modelling <em>levels</em>: some model diversity on the lowest level, very little model diversity on the middle level, the most diversity on the top level.</p><p>The middle, low-diversity level is called the <em>spanning layer</em> in network systems and protocol engineering literature. Below, I&#8217;ll simply call it the &#8220;middle level&#8221;.</p><p>Also, the &#8220;hourglass&#8221; metaphor refers to two different aspects of this architecture (see more on this in the next section): (1) the low diversity of the alternative models/theories on the middle level, and (2) the relative <em>weakness</em>, <em>simplicity</em>, and <em>generality</em> of these model(s) on the middle level. As network engineering literature focuses more the second notion, they don&#8217;t use the &#8220;diversity&#8221; modifier and call this architecture simply the <em>hourglass architecture</em> (<em>design</em>, <em>model</em>).</p><div class="captioned-image-container"><figure><a class="image-link image2" target="_blank" href="https://substackcdn.com/image/fetch/$s_!kG-6!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F605c91f8-c5a7-41b5-a22b-e4f435b9e60f_706x566.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!kG-6!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F605c91f8-c5a7-41b5-a22b-e4f435b9e60f_706x566.png 424w, https://substackcdn.com/image/fetch/$s_!kG-6!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F605c91f8-c5a7-41b5-a22b-e4f435b9e60f_706x566.png 848w, https://substackcdn.com/image/fetch/$s_!kG-6!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F605c91f8-c5a7-41b5-a22b-e4f435b9e60f_706x566.png 1272w, https://substackcdn.com/image/fetch/$s_!kG-6!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F605c91f8-c5a7-41b5-a22b-e4f435b9e60f_706x566.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!kG-6!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F605c91f8-c5a7-41b5-a22b-e4f435b9e60f_706x566.png" width="284" height="227.68271954674222" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/605c91f8-c5a7-41b5-a22b-e4f435b9e60f_706x566.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:566,&quot;width&quot;:706,&quot;resizeWidth&quot;:284,&quot;bytes&quot;:null,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:null,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!kG-6!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F605c91f8-c5a7-41b5-a22b-e4f435b9e60f_706x566.png 424w, https://substackcdn.com/image/fetch/$s_!kG-6!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F605c91f8-c5a7-41b5-a22b-e4f435b9e60f_706x566.png 848w, https://substackcdn.com/image/fetch/$s_!kG-6!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F605c91f8-c5a7-41b5-a22b-e4f435b9e60f_706x566.png 1272w, https://substackcdn.com/image/fetch/$s_!kG-6!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F605c91f8-c5a7-41b5-a22b-e4f435b9e60f_706x566.png 1456w" sizes="100vw" loading="lazy"></picture><div></div></div></a><figcaption class="image-caption">The depiction of diversity hourglass architecture, &#169; John Doyle</figcaption></figure></div><p>The prototypical example of diversity hourglass architecture is the modern computing ecosystem (PCs, phones, servers, etc.):</p><p>The <strong>hardware level</strong>&#8217;s objects are transistors, wires, electric signals, etc. This level is diverse: there are a lot of vendors, hardware specifications, and of course specific hardware products.</p><p>The <strong>operating system level</strong> vaguely starts from &#8220;computing platforms&#8221; (such as x86, ARM, or CUDA) with all their objects such as registers, cache levels, platform events, interruptions, and execution modes. They followed by the &#8220;OS-proper&#8221; objects such as processes, threads, devices, memory maps, descriptors, and mounted file systems. The <strong>OS level is </strong><em><strong>not</strong></em><strong> diverse</strong> (relatively speaking): there are relatively few computing platforms and operating systems.</p><p>The <strong>software level</strong>&#8217;s objects and variables include those that the OS have decided to expose to the user space (and thus are shared with the OS level), such as processes, threads, memory maps, files, and more. This is a source of confusion. Of course, software level also includes arbitrary objects, variables, and abstractions built on top of the OS-level objects and variables, such as elements of the execution models specific to programming languages (e.g., variables, data structures, types, channels, events, etc.), process containers, communication protocols, and more. Even higher, there are domain-level abstractions for specific industries, businesses or organisations, specific software projects within an organisation, specific scopes in project&#8217;s source code, etc. Informally, the &#8220;software level&#8221; refers to all these finer levels (starting from the programming language and up) lumped together. The software level is the most diverse of all three, even more diverse than the hardware level.</p><h3>The findings of the architecture and the hourglass theories</h3><p>John Doyle makes statements about the diversity hourglass that could be seen as the main conclusions or &#8220;theorems&#8221; of his architecture theory. Micah Beck&#8217;s calls the main results of his <a href="https://cacm.acm.org/research/on-the-hourglass-model/">hourglass model</a> (theory) The Hourglass Theorem and The Deployment Scalability Tradeoff. In this section, I summarise these findings.</p><p><strong>The relatively low diversity in the middle level of diversity hourglass is exactly what enables diversity on both the lower and the higher levels</strong>, provided there are evolutionary processes driving the diversity up in both the lower and higher levels. </p><p>Low diversity in the middle level <em>enables</em> the evolutionary processes in the lower and higher levels. I don&#8217;t remember if I saw a formal argument for this from Doyle or anyone else, but you can think of the following example: a uniform set of laws and regulations (&#8220;laws and regulations&#8221; being a <em>level</em> here, &#8220;a uniform set&#8221; means zero diversity) enables more businesses to evolve, apply themselves and diversify in different product lines, geographies, customer demographics, etc.</p><p>However, the low diversity in the middle level is not by itself sufficient to enable diversification in the lower and higher levels. <em>The specific abstraction (theory, model, design) of the middle level matters.</em></p><p>First, middle level&#8217;s <strong>weakness</strong> (also called <em>genericness</em> by Beck), as well as low complexity/high <strong>simplicity</strong> of the model/abstraction/theory/ontology of the system on this level enable more diversity on the lower levels because such a weak/simple model is simpler to <em>implement</em> (<em>support</em>, <em>enable</em>) by the lower levels.</p><p>Note that weakness/genericness and simplicity are closely related concepts (I&#8217;m not even sure it makes much sense to distinguish between them), but the <em>low diversity</em> is a categorically different thing. In the context of protocol engineering, low diversity refers to the fact that there is a single, &#8220;spanning&#8221; protocol that all other systems and protocols implement in the lower levels and use in the higher levels. Whereas weakness/genericness and simplicity are possible properties of that spanning protocol itself.</p><p>Second, the abstractions and elements defined (entailed) by the middle level <em>for</em> the higher level may be more or less <strong>composable </strong>and<strong> recombinable</strong>, that will the determine the &#8220;evolutionary breeding potential&#8221; on the higher level.</p><p>Beck combines composability with some extra, very informal property of &#8220;broad reach&#8221; or &#8220;broad applicability&#8221; and call this combined property <strong>generality</strong> (nb. difference with <em>genericness</em> mentioned above). Composability determines in part (but perhaps not in full) the &#8220;broadness of applicability&#8221; through the &#8220;computational power&#8221; reached by the middle level&#8217;s model. The ultimate ceiling here is Turing-completeness. It is reached by many programmatic abstractions, but of course not many other levels in real life, such as law.</p><p>Another important property of the interface between the middle and the higher levels that Doyle emphasises is <strong>how prone it is for hacking or hijacking</strong> by viruses, parasites, and bad actors.</p><h3>Diversity hourglass&#8217;s benefits: diversity-enabled sweet spots and scalability</h3><p>Doyle proposes that<strong> the diversity of level models/theories and subsystem designs at the lower and higher levels</strong> in the diversity hourglass architecture (that is enabled by the low model/theory diversity at the middle level, and by <em>weak/generic</em>, <em>composable</em>, and <em>general</em> model design(s) at the middle level, as discussed above) <strong>enables combining heterogeneous subsystems (components, parts, layers) to achieve optimal properties for the whole system</strong>. </p><p>I will not justify the above statement here, please refer to Matni, Ames, and Doyle, 2024<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-3" href="#footnote-3" target="_self">3</a>.</p><p>For example, evolution of human brains have combined fast, but inaccurate &#8220;<a href="https://en.wikipedia.org/wiki/Thinking,_Fast_and_Slow">System 1</a>&#8221; inference with slow, but accurate &#8220;System 2&#8221; reasoning to achieve optimally adaptive cognitive performance for humans in their environment. &#8220;System 1&#8221; and &#8220;System 2&#8221; here are thought to be two distinct <em>subsystems</em> on a certain level of brain modelling; the diversity of designs and hence operational characteristics is thought to be enabled by the low diversity and genericness of the lower &#8220;substrate&#8221; levels, such as the levels of neuronal dynamics and neuronal circuits.</p><p>Doyle calls these system designs with heterogeneous subsystems/components where the whole system &#8220;takes the best from all its components&#8221; <strong>diversity-enabled sweet spot (DeSS)</strong> [designs].</p><p>Beck and other authors in the field network systems and protocol engineering focus more on sociotechnical aspects and economic benefits of the hourglass architecture, such as protocol <strong>scalability</strong>, which in this context means the potential for <strong>broad adoption</strong> and huge <strong>economic utility</strong> to be derived from the use of a single &#8220;spanning&#8221; protocol.</p><p>This argument intersects with the informal argument for why low-diversity middle level enables evolution in the higher levels to the fullest: wide interoperability creates a &#8220;huge market&#8221; which in turn makes experimentation and bets on the higher levels more attractive due to potentially higher returns on successful experiments.</p><h3>Diversity hourglass&#8217;s risks</h3><p>In the context of AI agents, I&#8217;m not sure the scalability benefit of the hourglass architecture is very relevant: the utility of AI agents is probably going to be big enough, and the cost of their development low enough, that a lot of experimentation will happen even without the promises of maximally broad adoption. In fact, this &#8220;adoption amplification&#8221; effect of the hourglass architecture can be considered a <em>downside</em> when applied to AI agents, considering the potential societal or institutional disruption due to <em>too quick</em> adoption, &#8220;slide to criticality&#8221;<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-4" href="#footnote-4" target="_self">4</a> and hence the idea that <a href="https://www.lesswrong.com/posts/YkwiBmHE3ss7FNe35/short-timelines-and-slow-continuous-takeoff-as-the-safest">Short timelines and slow, continuous takeoff as the safest path to AGI</a>.<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-5" href="#footnote-5" target="_self">5</a></p><p>Other risks of the diversity hourglass architecture are also directly connected to its benefits:</p><ul><li><p>Low diversity of the middle level increases the &#8220;evolutionary breeding potential&#8221; not only for &#8220;good&#8221; systems, but also for <a href="https://www.youtube.com/watch?v=Bf4hPlwU4ys&amp;t=29m15s">viruses, parasites, and zombies</a>.</p></li><li><p>What&#8217;s worse, the scale of disruption (the &#8220;blast radius&#8221;) that could be caused by the viruses is <em>additionally</em> exacerbated by the broad adoption of the given middle level or &#8220;spanning&#8221; protocol.</p></li></ul><p>Several distinct <em>approaches</em> for addressing these risks have been proposed:</p><p><strong>Complete verification (proving) that the models/theories across the entire abstraction/level DAG are not hackable</strong>. In the domain of AI (agents), this approach has been called a &#8220;Guaranteed Safe AI&#8221; agenda (Dalrymple et al., 2024)<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-6" href="#footnote-6" target="_self">6</a>.</p><p><strong>Multi-level and multi-component (layered) </strong><em><strong>immunity system</strong></em><strong> for fighting viruses and parasites</strong>. Immunity systems themselves should leverage the benefits of the hourglass architecture, namely diversity-enabled sweet spot designs and scalability. Apart from the applications of <em>system-level synthesis (SLS)</em> framework that underpins Doyle&#8217;s diversity enabled sweet spots theory in control theory<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-7" href="#footnote-7" target="_self">7</a> and game theory<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-8" href="#footnote-8" target="_self">8</a> that are not very specific to immunity domain, perhaps the closest work that I can find that takes this <em>systems immunity</em> perspective is (Ciaunica et al., 2023)<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-9" href="#footnote-9" target="_self">9</a>. Yet, in application to AI agents, this approach is even less developed: the closest idea that gained some prominence in the AI space is the <a href="https://www.aisafetybook.com/textbook/component-failure-accident-models#swiss-cheese-model">Swiss Cheese Model</a> for risk mitigation.</p><p>The <strong>resilience and safety engineering</strong> perspective: see (Dekker and Woods, 2024)<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-10" href="#footnote-10" target="_self">10</a> for a recent work specifically in application to highly automated systems such as AI agents. This is also sometimes called a <em>complex systems</em> perspective, including in Dan Hendrycks&#8217; <a href="https://www.aisafetybook.com/textbook/complex-systems-for-ai-safety">AI Safety textbook</a>.</p><h3>Conclusion</h3><p>Steering towards the diversity hourglass architecture of AI agents<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-11" href="#footnote-11" target="_self">11</a> is not automatically &#8220;good&#8221; because the diversity hourglass architecture entails both benefits (I haven&#8217;t even covered all of them in this post, will elaborate more on those in the following post) and risks.</p><p>A thoughtful hourglass architecture for AI agents should proactively mitigate the risks through the combination of</p><ul><li><p>Using <em>provably tamper-proof models</em> at certain levels of abstraction,</p></li><li><p>Designing &#8220;diversity-enabled sweet spot&#8221; <em>layered immunity systems</em> alongside the core functionality within this multi-level architecture, and</p></li><li><p>Accounting for the ideas from resilience engineering such as <em>slide to criticality</em> [4], <em><a href="https://www.youtube.com/watch?v=gFotUdLL2zs">robust yet fragile</a></em>, <em>graceful extensibility</em><a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-12" href="#footnote-12" target="_self">12</a>, and more.</p></li></ul><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-1" href="#footnote-anchor-1" class="footnote-number" contenteditable="false" target="_self">1</a><div class="footnote-content"><p>&#8220;John Doyle&#8217;s architecture theory&#8221; is primarily conveyed through multiple John Doyle&#8217;s presentations (you can find them on YouTube) between 2019 and 2022. More materials could be found in <a href="https://www.dropbox.com/sh/7bgwzqsl7ycxhie/AABQB9L2J-XmCniwgyO3N83Ba?dl=0">Doyle&#8217;s public Dropbox folder</a>. For the most unifying and comprehensive published work, see footnote 3.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-2" href="#footnote-anchor-2" class="footnote-number" contenteditable="false" target="_self">2</a><div class="footnote-content"><p>Or, <em>groups</em> of levels in the <a href="https://www.lesswrong.com/posts/opE6L8jBTTNAyaDbB/a-multi-disciplinary-view-on-ai-safety-research#3_4__Weaving_together_theories_of_cognition_and_cognitive_development__ML__deep_learning__and_interpretability_through_the_abstraction_grounding_stack">abstraction&#8212;grounding DAG</a> of levels/models/theories, where the grouping criteria should be that each group is a connected sub-DAG. Ontological distinction between &#8220;levels proper&#8221; and &#8220;groups of levels&#8221; looks hopeless to me at the moment, and is probably not that useful anyway, so I will mostly just call both levels and groups of levels simply &#8220;levels&#8221; below.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-3" href="#footnote-anchor-3" class="footnote-number" contenteditable="false" target="_self">3</a><div class="footnote-content"><p>N. Matni, A. D. Ames and J. C. Doyle, "<a href="https://arxiv.org/abs/2401.15185">A Quantitative Framework for Layered Multirate Control: Toward a Theory of Control Architecture</a>", in IEEE Control Systems Magazine, vol. 44, no. 3, pp. 52-94, June 2024, doi: 10.1109/MCS.2024.3382388.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-4" href="#footnote-anchor-4" class="footnote-number" contenteditable="false" target="_self">4</a><div class="footnote-content"><p>D. Alderson, J. Allspaw and D. Woods, "<a href="https://www.aqualab.cs.northwestern.edu/wp-content/uploads/2024/01/RE_perspective_day2.pdf">Re-architecting tomorrow&#8217;s internet for &#8220;survivability&#8221; (a resilience engineering perspective)</a>", in proceedings of <a href="https://dl.acm.org/doi/10.1145/3687234.3687238">NSF Workshop: Towards Re-architecting Today&#8217;s Internet for Survivability</a>, 2023.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-5" href="#footnote-anchor-5" class="footnote-number" contenteditable="false" target="_self">5</a><div class="footnote-content"><p>The opposite stance on offer here is Nathan Labenz&#8217;s &#8220;<a href="https://x.com/labenz/status/1795849846328295483">adoption accelerationist, hyperscaler pauser</a>&#8221;.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-6" href="#footnote-anchor-6" class="footnote-number" contenteditable="false" target="_self">6</a><div class="footnote-content"><p>Dalrymple, David davidad, Joar Skalse, Yoshua Bengio, Stuart Russell, Max Tegmark, Sanjit Seshia, Steve Omohundro, et al. &#8220;Towards Guaranteed Safe AI: A Framework for Ensuring Robust and Reliable AI Systems.&#8221; arXiv.org, 2024. <a href="https://arxiv.org/abs/2405.06624">https://arxiv.org/abs/2405.06624</a>.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-7" href="#footnote-anchor-7" class="footnote-number" contenteditable="false" target="_self">7</a><div class="footnote-content"><p>Deglurkar, Sampada, Haotian Shen, Anish Muthali, Marco Pavone, Dragos Margineantu, Peter Karkus, Boris Ivanovic, and Claire J Tomlin. &#8220;System-Level Analysis of Module Uncertainty Quantification in the Autonomy Pipeline.&#8221; arXiv.org, 2024. <a href="https://arxiv.org/abs/2410.12019">https://arxiv.org/abs/2410.12019</a>.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-8" href="#footnote-anchor-8" class="footnote-number" contenteditable="false" target="_self">8</a><div class="footnote-content"><p>Neto, Michela Mulas, and Francesco Corona. &#8220;SLS-BRD: A System-Level Approach to Seeking Generalised Feedback Nash Equilibria.&#8221; arXiv.org, 2024. <a href="https://arxiv.org/abs/2404.03809">https://arxiv.org/abs/2404.03809</a>.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-9" href="#footnote-anchor-9" class="footnote-number" contenteditable="false" target="_self">9</a><div class="footnote-content"><p>Ciaunica, Anna, Evgeniya V. Shmeleva, and Michael Levin. &#8220;<a href="https://www.frontiersin.org/journals/integrative-neuroscience/articles/10.3389/fnint.2023.1057622/full">The Brain Is Not Mental! Coupling Neuronal and Immune Cellular Processing in Human Organisms</a>.&#8221; <em>Frontiers in Integrative Neuroscience</em> 17 (May 17, 2023). https://doi.org/10.3389/fnint.2023.1057622.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-10" href="#footnote-anchor-10" class="footnote-number" contenteditable="false" target="_self">10</a><div class="footnote-content"><p>Sidney, and David D Woods. &#8220;<a href="https://www.researchgate.net/profile/David-Woods-19/publication/385746174_Wrong_Strong_and_Silent_What_Happens_when_Automated_Systems_With_High_Autonomy_and_High_Authority_Misbehave/links/673683f837496239b2bfeb21/Wrong-Strong-and-Silent-What-Happens-when-Automated-Systems-With-High-Autonomy-and-High-Authority-Misbehave.pdf">Wrong, Strong, and Silent: What Happens When Automated Systems with High Autonomy and High Authority Misbehave?</a>&#8221; <em>Journal of Cognitive Engineering and Decision Making</em> 18, no. 4 (April 23, 2024): 339&#8211;45. https://doi.org/10.1177/15553434241240849.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-11" href="#footnote-anchor-11" class="footnote-number" contenteditable="false" target="_self">11</a><div class="footnote-content"><p>Saying &#8220;<em>designing</em> the diversity hourglass architecture&#8221; would not be correct here because this activity is not done by a single person or organisation. The common abstractions and levels that will be eventually most widely adopted depend on a myriad of theoretic proposals, technical innovations, marketing campaigns, and political efforts done by numerous actors. Cf. the <a href="https://cs.ccsu.edu/~stan/classes/CS410/Notes16/06-ArchitecturalDesign.html">architecture in the large</a> concept in systems engineering. </p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-12" href="#footnote-anchor-12" class="footnote-number" contenteditable="false" target="_self">12</a><div class="footnote-content"><p>Woods, David D. &#8220;<a href="https://link.springer.com/article/10.1007/s10669-018-9708-3">The Theory of Graceful Extensibility: Basic Rules That Govern Adaptive Systems</a>.&#8221; <em>Environment Systems and Decisions</em> 38, no. 4 (September 10, 2018): 433&#8211;57. https://doi.org/10.1007/s10669-018-9708-3.</p><p>&#8204;</p><p></p></div></div>]]></content:encoded></item><item><title><![CDATA[Differential knowledge interconnection]]></title><description><![CDATA[This post is a reply to Eugene Kirpichov's post on Linkedin. Eugene writes that contributing to general AI and information processing capabilities (including GPUs, general LLM technology, general data processing, etc.) is probably harmful overall because these capabilities effectively increase the speed at which the civilisation is moving but doesn't affect the trends, and the trends are negative right now because the civilisation is not on a sustainable trajectory, that is, the civilisation doens't move towards increasing flourishing of all moral patients, human and non-human.]]></description><link>https://engineeringideas.substack.com/p/differential-knowledge-interconnection</link><guid isPermaLink="false">https://engineeringideas.substack.com/p/differential-knowledge-interconnection</guid><dc:creator><![CDATA[Roman Leventov]]></dc:creator><pubDate>Sat, 12 Oct 2024 12:37:48 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!EJj2!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F55443e67-0a66-4164-8473-09b13a2e90ca_256x256.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>This post is a reply to Eugene Kirpichov's post <a href="https://www.linkedin.com/posts/eugenekirpichov_i-think-that-doing-any-fundamental-ai-research-activity-7249776414109962240-wY8S">on Linkedin</a>. Eugene writes that contributing to general AI and information processing capabilities (including <em>GPUs, general LLM technology, general data processing</em>, etc.) is probably harmful overall because these capabilities effectively increase the speed at which the civilisation is moving but doesn't affect the trends, and the trends are negative right now because the civilisation is not on a sustainable trajectory, that is, the civilisation doens't move towards increasing flourishing of all moral patients, human and non-human.</p><p>I disagree with Kirpichov's proposition as is because I think it lacks important nuance in definition of general AI and knowledge production capabilities. I think there are different kinds of general AI capabilities, some, I agree, are probably on net harmful, but others I think are not. I will explain the difference below.</p><p>Note that this post is <em>not</em> about general vs. specialised AI, i.e., narrow AI applications. Kirpichov and I agree that specialised AI applications should be judged on the case-by-case basis. Different applications may lie on the range from clearly beneficial, such as AI for community deliberation (see the <a href="https://www.cip.org/">Collective Intelligence Project</a>), AI for human health (e.g., <a href="https://www.slingshot.xyz/">Slingshot AI</a>, <a href="https://healthcareagents.com/">HealthcareAgents</a>), AI for ocean ecosystems modelling and monitoring (e.g., <a href="https://wildflow.ai/">Wildflow AI</a>), or AI for decoding non-human communication (e.g., <a href="https://www.earthspecies.org/">Earth Species Project</a>), to clearly harmful applications, such as AI for spam, phishing, etc., with a thousand shades of benefit and harm in between.</p><p>Yet another dimension is the degree of generality of AI capabilities, from very broadly general, such as GPGPU computing capabilities, to very specialised AI capabilities, applicable only in a single narrow domain. The chances of spilling over some capabilities developed for beneficial applications to other, potentially harmful applications should be estimated. The standard example here is AI for drone navigation and autonomy, if developed for low-footprint delivery of goods, may proliferate into harmful applications like drone warfare and killer drones.</p><p>Now, to the question of distinguishing between better or worse <em>general</em> AI capabilities.</p><p>AI technologies help to create and test more models faster. I use the word "models" in the broadest sense here, including engineering designs, methods, organisational designs, social technologies, psycho-technologies, legal designs (laws, legal structures for organisations, contracts), industrial standards, etc., along with more standard epistemic theories a.k.a. <em>explanations</em>, as well as theories of ethics.</p><p>Models that are not refuted by test or practice become <em>knowledge</em>.</p><p>I agree with Kirpichov that currently, the civilisation is not on a sustainable trajectory. The civilisation as a whole lacks a lot of knowledge about how a sustainable civilisational design even looks and how to get there from the current state. As David Deutsch wrote, "all evils are caused by insufficient knowledge".</p><p>AI capabilities could be used to obtain and leverage "good" knowledge: that is, the knowledge that nudges the civilisation towards a sustainable path. However, just as well, AI capabilities could be used to obtain and leverage "bad" knowledge: that is, the knowledge that exploits the flaws in the current design of the civilisation to gain advantage at the high collateral cost for other moral patients.</p><p>Therefore, we can infer that AI capabilities that differentially help or incentivise obtaining and leveraging more "good" than "bad" knowledge are probably on net beneficial.</p><p>However, how to distinguish between "good" and "bad" knowledge? Can the usage of some knowledge today be "good" today but "bad" tomorrow, or vice versa? How would we know?</p><p>I think we can work on this question "backwards".</p><h3>"Good" knowledge implies interconnection</h3><p>When the civilisation is in a sustainable state, all agents whose actions matter for the well-being of any moral patients have to predominantly use "good" knowledge.</p><p>By definition of a sustainable civilisation given above, this knowledge should be interconnected with the (subjective/objective) knowledge about all moral patients' states of flourishing<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-1" href="#footnote-1" target="_self">1</a>, sourced from them directly when possible, e.g. when their own verbal report is available, or if unavailable, "to the best of our knowledge", that is, using our best methods for inferring flourishing states of mute moral patients.</p><p>The phrase <em>knowledge interconnection</em> used above refers to how the models underlying that knowledge have been inferred and tested. "Interconnected inference" means obtaining the joint posterior of the models, and "interconnected testing" means verifying that the two models hold up in practice in interactive scenarios rather than only in isolation. Inference and testing should also not be isolated from each other but rather create a learning loop.</p><p>Making the knowledge of every agent (not only humans and AIs but also organisations and states) interconnected with the knowledge about the flourishing states of all moral patients individually would be infeasibly expensive. Imagine that every business or AI agent had to consider the outcomes of all their decisions for every human and animal. Therefore, by necessity, the structures for integrating the knowledge about the states of moral patients and outcomes for them have to be hierarchical<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-2" href="#footnote-2" target="_self">2</a>.</p><p>Rafael Kaufmann and I have called these structures that ought to exist to align the civilisation with flourishing of moral patients the <a href="https://engineeringideas.substack.com/p/gaia-network-an-illustrated-primer">Gaia Network</a>. The details of the technical architecture that we proposed for "connected model inference", federated learning via credit assignment, and trustworthy "connected model testing" (verification/validation) are not important for this post. These details are also still up for a debate. Also, it's almost certain that if our civilisation will reach a sustainable trajectory, multiple alternative approaches to knowledge connection would coexist.</p><p>The big point is that the "good" knowledge embodied in a sustainable civilisation <em>must</em> be interconnected, pretty much by definition of a sustainable civilisation.</p><p>Note that the reverse may not be true: a fully interconnected knowledge may not be used towards the flourishing of all patients. As an example, imagine a tight world-wide surveillance regime that doesn't value the flourishing of the people and animals.</p><p>However, I don't think it means that we should suppress knowledge connection until we figure out how to ensure that knowledge is used benevolently. In opposite, it seems to me that gradual interconnection of knowledge embodied by the economic agents is one of the very few operationalisable strategies for increasing world agents' circles of concern and care<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-3" href="#footnote-3" target="_self">3</a>.</p><h3>AI and data processing capabilities that foster knowledge interconnection</h3><p>From the interim conclusions above, we can posit that the kinds of AI and information processing capabilities that have a propensity to be used for obtaining and using interconnected knowledge are probably on net beneficial.</p><p>As is inherent to the discussions of differential technology development (see the <a href="https://michaelnotebook.com/dtd/index.html">recent Michael Nielsen's notes on the topic</a>), it's often frustratingly hard even to put a sign on the propensity of this or that capability for "knowledge interconnection". I cannot do this for general technologies like LLMs, general capabilities like causal reasoning and planning.</p><p>For example, LLMs can be deployed (and, in fact, essential) both for "knowledge connection", such when they are used for semantic knowledge graph mining, and "disconnected" use cases, such as for automating myriads of tasks in the present "disconnected" business ecosystems.</p><p>For another example, capabilities for LLM distillation and miniaturisation may on the one hand foster the creation of knowledge graphs and well-structured public data because "they don't know much by themselves" and therefore have to rely on externalised knowledge, but on the other hand small LLMs make (online) automation much cheaper that accelerates the present harmful trends.</p><p>Planning is essential for grounded federated learning and credit assignment, but obviously also the core capability for AI automation that leverages existing "disconnected" knowledge for profit extraction.</p><p>Nevertheless, I think I can make at least a few claims relatively confidently.</p><p>Capabilities that seem to favor knowledge interconnection:</p><ul><li><p><em>Federated learning</em>, privacy-preserving <em>multi-party computation</em>, and <em>privacy-preserving machine learning</em>. See <a href="https://flower.ai/">Flower AI</a>, <a href="https://openmined.org/">OpenMined.org</a>.</p></li><li><p><a href="https://www.sciencedirect.com/science/article/pii/S0149763423004694">Federated inference and belief sharing</a>. Examples: prediction markets like <a href="https://manifold.markets/">Manifold</a>, <a href="https://www.digitalgaia.earth/">Digital Gaia</a>.</p></li><li><p>Protocols and file formats for data, belief, or claim exchange and validation, such as various blockchain and crypto projects, <a href="https://solidproject.org/">Solid</a>, <a href="https://en.wikipedia.org/wiki/ActivityPub">ActivityPub</a>, <a href="https://xtdb.com/">XTDB</a>, or <a href="https://github.com/apache/incubator-graphar">GraphAr</a>.</p></li><li><p>Semantic knowledge mining and hybrid reasoning on (federated) knowledge graphs and multimodal data, including tabular data. See <a href="https://arxiv.org/abs/2310.18318">OpenCog Hyperon</a>.</p></li><li><p><em>Structured or semantic search</em> such as <a href="https://exa.ai/">exa.ai</a> and <a href="https://system.com/">system.com</a>.</p></li><li><p><em>ML interpretability</em>, including so-called <a href="https://arxiv.org/abs/2404.14082">mechanistic interpretability</a>. The usual "theory of impact" of interpretability is ensuring that we know when huge LLMs act or suggest us something for benevolent or nefarious reasons and corrupting LLM's knowledge of dangerous topics via representation engineering. However, in the context of this post, representation interpretability is an essential piece of the research agenda of cognitive science of flourishing, i.e., understanding the (subjective) states of moral patients, potentially AIs themselves(!), but also animals or humans when the representations are obtained by passing through DNNs video, audio, or other metrics about them, brain-computer interface signals, etc.</p></li><li><p>Datastore federation for <a href="https://arxiv.org/abs/2403.03187">retrieval-based LMs</a>.</p></li><li><p>Cross-language (such as, English/French) retrieval, search, and semantic knowledge integration. This is especially important for low-online-presence languages. See <a href="https://cohere.com/research">Cohere for AI</a>.</p></li></ul><p>On the other hand, many stock AI capabilities, such as imitation learning, many (though not all) methods of reinforcement learning, image and video generation<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-4" href="#footnote-4" target="_self">4</a>, online (browser-based) task automation, collaborative filtering, and other capabilities seems to have very little to do with knowledge interconnection. Although it's probably unfair to also say that most of these AI capabilities favor obtaining and leveraging "isolated" knowledge, either, if we take as the default premise that these capabilities will be mostly used to accelerate the current trends (of leveraging "disconnected" knowledge in the environment where most agents' circle of concern is rather narrow) rather than change them, we should expect the development of these capabilities to be harmful on net.</p><h3>Knowledge interconnection and the risk of industrial dehumanisation</h3><p>I agree with Andrew Critch that <a href="https://www.lesswrong.com/posts/Kobbt3nQgv3yn29pr/my-theory-of-change-for-working-in-ai-healthtech#Extinction_by_industrial_dehumanization">post-AGI </a><em><a href="https://www.lesswrong.com/posts/Kobbt3nQgv3yn29pr/my-theory-of-change-for-working-in-ai-healthtech#Extinction_by_industrial_dehumanization">industrial dehumanization</a></em><a href="https://www.lesswrong.com/posts/Kobbt3nQgv3yn29pr/my-theory-of-change-for-working-in-ai-healthtech#Extinction_by_industrial_dehumanization"> is a major extinction risk for humanity</a>.</p><p>This challenges the view that the development AI capabilities that favor knowledge interconnection will be on net beneficial if pursued right now. It corresponds to the possible position that I already mentioned above, namely that <em>any</em> intelligence amplification, even of the "interconnected" flavor, only exacerbates risks until we ensure that the knowledge is deployed stably and benevolently towards humans and other moral patients.</p><p>Currently, I conclude the development AI capabilities that favor knowledge interconnection on net reduces the risk of industrial dehumanisation. This is because the economy aligned with the flourishing of humans, animals, and natural ecosystems will be much complex and interconnected (hence, lower entropy<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-5" href="#footnote-5" target="_self">5</a>) than the pure "machine economy", at least "locally"/temporarily. This means that <strong>AI capabilities favoring knowledge interconnection also differentially favor the development and sustainment of complex "human economy" industries, institutions, and social phenomena, such as healthcare, agriculture, education and enlightenment, family and romance, deliberative or liquid democracy, philosophy and ethics, religion, communities, culture, animal and ecosystem preferences, etc.</strong></p><p>In fact, earlier I wrote <a href="https://www.lesswrong.com/posts/PcTLHamp236afJxxT/some-for-profit-ai-alignment-org-ideas?commentId=JC6xpCyvwwD5kqyHw">comments</a> that are very compatible with both this post and the recent Critch's post calling for differential development of "human economy" industries. This post focuses on AI capabilities and technologies in specific and attempts to find "good" ones among them, but of course I fully support the development of human- and animal-centered AI applications as well.</p><p>Nevertheless, I take seriously the "industrial dehumanisation challenge" to the <em>differential knowledge interconnection</em> thesis that I lay out above in this post. I'm not at all sure about my own conclusions. I'm interested in your thoughtful opinions on this subject.</p><h3>Relation to the simplicity/acc manifesto</h3><p>A few months ago, I've drafted the <a href="https://engineeringideas.substack.com/i/146642286/summary-the-simplicityacc-manifesto">simplicity/acc manifesto</a>:</p><blockquote><ul><li><p>Apply AI power to create simple software.</p></li><li><p>Create more a la carte tools (such as debuggers, observability, modellers, simulators, security analysers, verifiers, AI-first DevOps, CI/CD tools) to empower AI to create, maintain, and explain simple software more reliably and effectively.</p></li><li><p>Create more real-world-facing software than software-facing software.</p></li><li><p>Make it easier for system designers and developers to receive and account for the diverse feedback from the real world and the stakeholders.</p></li><li><p>Spend the software complexity &#8220;budget&#8221; on the essential complexity of accommodating diverse, interacting users&#8217; and stakeholders&#8217; needs rather than on the accidental complexity of &#8220;self-consumed&#8221; software.</p></li></ul></blockquote><p>The simplicity/acc manifesto calls for more focus on AI applications rather than the development of general AI capabilities, and specifically applications that "face the real world" rather than other software and software-derived "virtual" economy elements such as finance.</p><p>I guess this manifesto looks somewhat conflicted with the differential knowledge interconnection thesis. Although the last two items of the manifesto are very synergistic with knowledge interconnection for advancing the flourishing of moral patients, the second point about "creating a la carte tools for software engineering" looks perhaps slightly antagonistic to it. So, today I would probably remove it from the manifesto.</p><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-1" href="#footnote-anchor-1" class="footnote-number" contenteditable="false" target="_self">1</a><div class="footnote-content"><p>I don't discuss here the disagreements about what subjective or objective states or "life journeys" of moral patients are really desirable between welfarism, utilitarianism, hedonism, eudaimonism, ecocentrism, and other relevant theories of ethics. Without loss of generality, we can assume that moral uncertainty and ethical portfolio views should be applied and the "goodness" of such and such state of such and such moral patient(s) weighted accordingly.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-2" href="#footnote-anchor-2" class="footnote-number" contenteditable="false" target="_self">2</a><div class="footnote-content"><p>Fields, Chris. "<a href="https://chrisfieldsresearch.com/FEP-compart-pre.pdf">The free energy principle induces compartmentalization.</a>" Biochemical and Biophysical Research Communications (2024): 150070.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-3" href="#footnote-anchor-3" class="footnote-number" contenteditable="false" target="_self">3</a><div class="footnote-content"><p>Witkowski, Olaf, Thomas Doctor, Elizaveta Solomonova, Bill Duane, and Michael Levin. "<a href="https://www.sciencedirect.com/science/article/pii/S0303264723001399">Toward an ethics of autopoietic technology: Stress, care, and intelligence.</a>" Biosystems 231 (2023): 104964.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-4" href="#footnote-anchor-4" class="footnote-number" contenteditable="false" target="_self">4</a><div class="footnote-content"><p>A potential counter-point here, per Andrew Critch's "<a href="https://www.lesswrong.com/posts/Kobbt3nQgv3yn29pr/my-theory-of-change-for-working-in-ai-healthtech">My theory of change for working in AI healthcare</a>", is that image and video generation are mostly used for human entertainment, which is a part of "human economy", and fostering human economy is preferable to fostering "machine economy". </p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-5" href="#footnote-anchor-5" class="footnote-number" contenteditable="false" target="_self">5</a><div class="footnote-content"><p>See Beren Millidge's &#8220;<a href="https://www.lesswrong.com/posts/d74pb97TAqNKwJkc5/bcis-and-the-ecosystem-of-modular-minds">BCIs and the ecosystem of modular minds</a>&#8221;.</p></div></div>]]></content:encoded></item><item><title><![CDATA[Table transfer protocols: improved Arrow Flight and alternative to Iceberg]]></title><description><![CDATA[This article is the ultimate one in the five-piece series:]]></description><link>https://engineeringideas.substack.com/p/table-transfer-protocols-improved</link><guid isPermaLink="false">https://engineeringideas.substack.com/p/table-transfer-protocols-improved</guid><dc:creator><![CDATA[Roman Leventov]]></dc:creator><pubDate>Sat, 07 Sep 2024 10:37:17 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!0KNY!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1697db02-9392-42b7-9d2a-1bb9c56c7142_1826x789.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>This article is the ultimate one in the five-piece series:</p><p><strong>1. &#8220;<a href="https://engineeringideas.substack.com/p/the-future-of-olap-table-storage">The future of OLAP table storage is not Iceberg</a>&#8221;</strong> argues for why object storage-based <em>open table formats</em>: Apache Iceberg, Apache Hudi, and Delta Lake, although they <em>may</em> completely cover all analytical querying needs for <em>some</em> data teams, impose several significant limitations and inefficiencies for some OLAP use cases, and therefore shouldn&#8217;t be trumpeted as the &#8220;future&#8221; of columnar table storage.</p><p><strong>2. &#8220;<a href="https://github.com/apache/arrow/issues/43762">Proposal: generic streaming protocol for columnar data</a>&#8221;</strong> proposes a low-level, reactive/asynchronous streaming protocol for data in Arrow or another <a href="https://blog.lancedb.com/lance-v2/">columnar container</a> format. The proposed protocol occupies the same niche as <a href="https://arrow.apache.org/docs/format/DissociatedIPC.html">Arrow Dissociated IPC</a>, but is more general and flexible.</p><p><strong>3. &#8220;<a href="https://engineeringideas.substack.com/p/table-transfer-protocols-for-universal">Table transfer protocols for universal access to OLAP databases</a>&#8221;</strong> describes <em>the M &#215; N interoperability problem</em> between OLAP databases and processing engines which <a href="https://engineeringideas.substack.com/i/148153268/the-problem-of-olap-data-interoperability">have both greatly diversified in recent years</a>. I discuss the existing solutions to this problem, including the usage of aforementioned open table formats, <a href="https://cloud.google.com/bigquery/docs/biglake-intro#connectors">BigQuery Storage APIs</a>, and <a href="https://arrow.apache.org/docs/format/FlightSql.html">Arrow Flight</a>, and describe the limitations of each of these solutions that are too significant to ignore.</p><p>Then I propose a new family of <strong>table transfer protocols: Table Read, Table Write, and Table Replication protocols</strong>. These protocols are layered on the streaming protocol for columnar data proposed in the previous article. These don&#8217;t have the limitations of the other solutions to the interoperability problem between OLAP databases and processing engines.</p><p>Finally, in that article, I describe Table Read protocol in detail.</p><p><strong>4. &#8220;<a href="https://engineeringideas.substack.com/p/table-write-protocol-for-interop">Table Write protocol for interop between diverse OLAP databases and processing engines</a>&#8221;</strong> describes Table Write protocol: a <em>pull-based</em> data ingestion protocol that uses Table Read protocol <em>in reverse</em>: the target database reads the records to write from the writing source, such as a processing engine.</p><p>This design is agnostic to transaction, isolation, and write atomicity semantics that the target database uses, but is conducive to ensuring <em>exactly once</em> delivery guarantees on the higher level of abstraction (the transaction or ingestion task management).</p><p>Another byproduct of making Table Write protocol based on Table Read protocol is getting an &#8220;almost free&#8221; <a href="https://engineeringideas.substack.com/i/148485754/table-replication-method">distributed table replication method (protocol)</a> from any OLAP database that implements Table Read protocol and into any database that implements the target side of Table Write protocol.</p><p><strong>5. &#8220;Overview of table transfer protocols&#8221;</strong> (this post) summarises the most important points from the previous posts. For reference, I&#8217;ll generously link to the most relevant sections of the preceding posts in this series throughout the text below.</p><h2>How table transfer protocols are different from Arrow Flight</h2><h3><strong>Table Read protocol</strong></h3><p>Unlike Arrow Flight, Table Read protocol affords <strong>fine-grained control of</strong></p><ul><li><p><strong>load distribution</strong> both on the <a href="https://engineeringideas.substack.com/i/148153268/slice-and-partition-breakdown">server (database)</a> and <a href="https://engineeringideas.substack.com/i/148153268/agents-logic">client (processing engine)</a> sides,</p></li><li><p><strong><a href="https://engineeringideas.substack.com/i/148153268/partition-locations">resource usage</a> on the server (database) side</strong>, enabling database nodes to serve table data for the processing engine concurrently with other real-time queries or data ingestion, and</p></li><li><p><strong>network traffic</strong> between the server and client sides. Network traffic size could be <a href="https://engineeringideas.substack.com/i/148153268/column-sections-and-transfer-encodings">traded off</a> with resource usage on the database side.</p></li></ul><p>Also, Table Read protocol affords <a href="https://engineeringideas.substack.com/i/148153268/read-consistency">consistent reads</a> and resilience in the face of <a href="https://engineeringideas.substack.com/i/148153268/clients-logic">server</a> or <a href="https://engineeringideas.substack.com/i/148153268/preemption-of-partition-consumption">client</a> node failures or <a href="https://engineeringideas.substack.com/i/148153268/table-data-availability">table data rebalancing</a>/redistribution concurrent with long-running Read jobs (i.e., Table Read protocol interactions).</p><p><strong>These properties are achieved <a href="https://engineeringideas.substack.com/i/148153268/basic-principles">in cooperation</a> between the server and client sides of the Read jobs.</strong></p><p>Arrow Flight doesn&#8217;t afford cooperation between the protocol interaction sides to achieve these properties. If the client accesses the database via Arrow Flight, the database may only take singular responsibility for consistency, resiliency, and load distribution, but this is more complicated and less efficient: <em>cooperative mechanisms for consistency and resiliency are simpler</em>. Therefore, <strong>Table Read protocol requires less end-to-end implementation complexity to get consistent reads and resiliency</strong> than Arrow Flight.</p><p>Table Read protocol also strives to be maximally <a href="https://engineeringideas.substack.com/i/148153268/basic-principles">agnostic about the architectures of both databases and processing engines</a> that could implement it, while enabling optimal read performance between any pairings of the Read job sides. Table Read protocol is supposed to work approximately equally well for</p><ul><li><p>Single-node or distributed servers or clients,</p></li><li><p><a href="https://engineeringideas.substack.com/i/147163081/data-warehouses-designed-for-olap-manage-their-table-storage-themselves">Disk-first, object storage-first, or other approaches to table data storage</a>,</p></li><li><p>Various approaches to <a href="https://engineeringideas.substack.com/i/148485754/index-statistics-and-segment-metadata-replication">metadata storage</a>,</p></li><li><p>CPU-only, <a href="https://github.com/apache/arrow/issues/43762">GPU-only, or mixed processing</a>,</p></li><li><p>IO-bound or compute-bound query patterns, thanks to flexible network traffic control (see above), and the option to <a href="https://engineeringideas.substack.com/i/148153268/table-processing-plan">push-down processing to storage nodes</a>.</p></li></ul><p>Table Read protocol is also agnostic about the <a href="https://engineeringideas.substack.com/i/148153268/read-consistency">consistency/isolation model</a> of the database.</p><h3><strong>Table Write protocol</strong></h3><p>Unlike <a href="https://arrow.apache.org/docs/format/FlightSql.html#id4">Arrow Flight&#8217;s bulk ingestion path</a>, Table Write protocol supports <strong>distribution on both the writing source and target database&#8217;s sides</strong> in virtue of <a href="https://engineeringideas.substack.com/i/148485754/the-best-table-write-protocol-is-table-read-protocol-in-reverse">being essentially Table Read protocol with server and client sides flipped</a>, with only a few non-trivial additions, primarily needed to support handling the total size of written records <a href="https://engineeringideas.substack.com/i/148485754/handling-write-jobs-larger-than-source-servers-memory">exceeding the memory allocated to the Write job on processing engine&#8217;s worker nodes</a>, and thus enabling query processing and ML frameworks with strong preference for memory-only operation (such as Bodo, cuDF, Dask, Apache DataFusion, DuckDB/MotherDuck, oneDAL, Polars, Ray, Theseus, and others) to effectively use table transfer protocol in the &#8220;<a href="https://engineeringideas.substack.com/i/148485754/the-etl-loop">ETL loop</a>&#8221; with the database.</p><p>Table Write protocol is designed specifically for processing engines as the source sides in Write jobs (i.e., Table Write protocol interactions). Processing engines that typically provide consistent-at-the-offset reads to enable end-to-end <em>exactly once</em> delivery/ingestion guarantees for the data that &#8220;flows&#8221; through them. <a href="https://engineeringideas.substack.com/i/148485754/handling-server-restarts">Table Write protocol exposes at-the-offset reading semantics</a> (instead of hiding them behind the veneer of &#8220;simpler&#8221; abstractions) <strong>to &#8220;plug into&#8221; the </strong><em><strong>exactly once</strong></em><strong> delivery flow</strong> that may include a Write job at the end or as an intermediate data exchange between different systems.</p><p>Not coincidentally, the consumption of a shared log (such as Kafka) is also <a href="https://engineeringideas.substack.com/i/148485754/the-best-table-write-protocol-is-table-read-protocol-in-reverse">the industry standard for resilient ingestion in distributed OLAP databases</a>. However, since processing engines provide consistent-at-the-offset reads like a shared log themselves, there is no need to stick a Kafka topic between sources and targets (databases) in Table Write protocol.</p><h3><strong>Scope</strong></h3><p>Table transfer protocols are lower-level than Arrow Flight SQL. I intentionally leave out of the scope of table transfer protocols:</p><ul><li><p>Data access or writing permissions. This concern is left, for example, to data governance systems like Unity Catalog.</p></li><li><p><a href="https://engineeringideas.substack.com/i/148485754/out-of-scope-transaction-semantics">Transactions</a>. They are left, for example, to the database layer if there is only one database system used through the processing pipeline, or to ETL/ETL tools (such as dbt) or distributed transaction systems (such as Apache Seata or Temporal) when there are more than one database, queue, or source/sink service involved in the pipeline.</p></li><li><p>Table creation, management and configuration of perpetual ingestion jobs/streams (a-la DDL). This logic is left to the target databases. However, insert, update, upsert, delete, and <a href="https://engineeringideas.substack.com/i/148485754/replication-of-delete-files">partition-specific</a> semantics (a-la DML) <a href="https://engineeringideas.substack.com/i/148485754/record-writing-dml-and-output-semantics">could be specified</a> for record writing/ingestion in Table Write protocol.</p></li><li><p>The query syntax and semantics, such as SQL. At the moment, I think it&#8217;s a good idea for table transfer protocols to embrace <a href="https://substrait.io/">Substrait</a> as the only format for expressing <a href="https://engineeringideas.substack.com/i/148153268/table-processing-plan">queries</a>, <a href="https://engineeringideas.substack.com/i/148153268/slices-and-partitions">partition breakdown of table data</a>, <a href="https://engineeringideas.substack.com/i/148485754/partitions">schema of the written records</a>, and negotiation of the <a href="https://engineeringideas.substack.com/i/148153268/table-processing-plan">processing logic push-back</a> from the server to the client side. Substrait plans can be extended in many ways and at different places, which should be flexible enough to support time-travel semantics in feature stores such as Hopsworks, Chronon, and others.</p></li></ul><p>While table transfer protocols are lower-level than Arrow Flight SQL, they are higher-level than <a href="https://arrow.apache.org/docs/format/Flight.html">Arrow Flight RPC</a>. Arrow Flight RPC is oblivious to table-level processing logic such as projections, filtering, aggregations, table read consistency, and table data partitioning:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!0KNY!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1697db02-9392-42b7-9d2a-1bb9c56c7142_1826x789.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!0KNY!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1697db02-9392-42b7-9d2a-1bb9c56c7142_1826x789.png 424w, https://substackcdn.com/image/fetch/$s_!0KNY!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1697db02-9392-42b7-9d2a-1bb9c56c7142_1826x789.png 848w, https://substackcdn.com/image/fetch/$s_!0KNY!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1697db02-9392-42b7-9d2a-1bb9c56c7142_1826x789.png 1272w, https://substackcdn.com/image/fetch/$s_!0KNY!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1697db02-9392-42b7-9d2a-1bb9c56c7142_1826x789.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!0KNY!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1697db02-9392-42b7-9d2a-1bb9c56c7142_1826x789.png" width="1456" height="629" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1697db02-9392-42b7-9d2a-1bb9c56c7142_1826x789.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:629,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:183496,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!0KNY!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1697db02-9392-42b7-9d2a-1bb9c56c7142_1826x789.png 424w, https://substackcdn.com/image/fetch/$s_!0KNY!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1697db02-9392-42b7-9d2a-1bb9c56c7142_1826x789.png 848w, https://substackcdn.com/image/fetch/$s_!0KNY!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1697db02-9392-42b7-9d2a-1bb9c56c7142_1826x789.png 1272w, https://substackcdn.com/image/fetch/$s_!0KNY!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1697db02-9392-42b7-9d2a-1bb9c56c7142_1826x789.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Thus, <strong>table transfer protocols are designed to be </strong><em><strong>always </strong></em><strong>used by other data tools and systems</strong>: SQL querying layers, transaction managers, processing pipeline planners and orchestrators, semantic layers, ML training, inference, or data science frameworks, feature stores, CDC or <a href="https://engineeringideas.substack.com/i/148485754/table-replication-method">table replication systems</a>, etc.</p><p>Sometimes, though not always, processing engines and databases that take part in the specific table transfer protocol interaction would also play the role of these data tools, such as when the database is its own SQL querying layer, semantic layer, and transaction manager, the processing engine is also an ML framework, etc.</p><p>Regardless, table transfer protocols also permit pulling these functions away from the storage and processing layers in line with the <a href="https://materializedview.io/p/databases-are-falling-apart">&#8220;database disassembly&#8221; trend</a>.</p><h3><strong>Complicatedness</strong></h3><p><strong>Table transfer protocols are more complicated than Arrow Flight</strong>: table transfer protocols define more node roles, request and response types, states the interacting nodes could be in, etc.</p><p>I believe that most of this complexity is <a href="https://en.wikipedia.org/wiki/No_Silver_Bullet#Summary">essential</a> for table transfer protocols to provide</p><ul><li><p><em>Cooperability</em> between the client and server sides,</p></li><li><p><em>Universality</em> wrt. database and processing engine architectures, features, and semantic models,</p></li><li><p><em>Flexibility</em> for efficient support of different query types, workload patterns, and heterogeneous compute hardware, and</p></li><li><p><em>Composability</em> with higher-level systems and functions.</p></li></ul><p>In particular, as I already mentioned above, cooperative mechanisms to achieve consistent reads, &#8220;exactly once&#8221; delivery guarantees, resilience, and optimal load distribution are usually simpler than those where only one side of the protocol interaction (usually the database) tries to take full responsibility of achieving these properties, as implied by Arrow Flight.</p><p>Note that all the <strong>attractive properties of table transfer protocols come </strong><em><strong>just</strong></em><strong> from making these protocols lower level and more tweakable</strong> than Arrow Flight, rather than from using some clever or novel techniques and distributed algorithms.</p><p>Moreover, <strong>achieving some of these nice properties with Arrow Flight may be just impossible by the database unless it has a certain distributed architecture</strong>, such as <a href="https://engineeringideas.substack.com/i/148153268/table-read-protocol-overview-and-comparison-with-arrow-flight">reverse proxy (&#8220;frontend&#8221;) nodes on the read path</a> for availability and resilience, or <a href="https://engineeringideas.substack.com/i/148485754/the-best-table-write-protocol-is-table-read-protocol-in-reverse">a shared log on the write path</a> for &#8220;exactly once&#8221; delivery. Sure, some databases, such as data warehouse offerings from public clouds have these elements in their distributed architectures. But most OLAP and time-series databases (and especially their open-source/on-premise tiers<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-1" href="#footnote-1" target="_self">1</a>) don&#8217;t have these elements. Thus, <strong>Table transfer protocols enable building resilient and consistent distributed data stacks without obligatory DBaaS and PaaS subscriptions</strong>, possibly outside the cloud.</p><p>As I noted above, table transfer protocols are designed to be implemented and directly used by database, data processing, and other data tool engineers rather than by data engineers who combine these systems for their data stacks. This fact also makes me think the complicatedness of table transfer protocols is the right tradeoff. For example, the <a href="https://www.postgresql.org/docs/current/protocol.html">PostgreSQL wire protocol</a> is also very complicated, as it essentially has to be, to provide its functionality. Still, many OLAP databases adopt this protocol because it enables plugging into the PostgreSQL ecosystem.</p><p>With all that said, I also shared some thoughts about how table transfer protocols could be made less burdensome to implement by the databases and processing engines <a href="https://engineeringideas.substack.com/i/148153268/table-read-protocol-implementation-notes">here</a> and <a href="https://engineeringideas.substack.com/i/148485754/table-write-protocol-implementation-notes">here</a>. I also don&#8217;t claim that I already came up with the simplest possible designs for the <a href="https://github.com/apache/arrow/issues/43762">streaming protocol for columnar data</a> and table transfer protocols. I welcome your feedback and ideas about their designs!</p><h2>Table transfer protocols enable the benefits of Iceberg without its limitations</h2><p>Object storage-based open table formats for data lakehouse architecture: Iceberg, Hudi, and Delta Lake radically solve the interoperability problem between databases and processing engines by removing the database layer from the data stack entirely: data is ingested into and queried from the object storage directly by diverse processing engines. The interface is not as much the object storage API/protocol as the format of the files.</p><p>It&#8217;s important to disambiguate the pros and cons of using object storage as the data storage service in the lakehouse architecture from the pros and cons of using open table formats such as Iceberg per se.</p><p>There are other object storage-only (or object storage-first) databases such as Databend, Firebolt, GreptimeDB, LanceDB, OpenObserve, Oxla, Snowflake, Quickwit, and others who do <em>not</em> use any of the &#8220;big three&#8221; open table formats (Iceberg, Hudi, Delta Lake) yet share the benefits and limitations of using cloud object storage as the primary data storage service with open table formats.</p><h3><strong>Object storage</strong></h3><p>The benefits of cloud object storage for analytical, search, and vector querying are primarily the <strong>low cost</strong> of &#8220;cold&#8221; storage that is never or very rarely accessed, and the very high <strong>aggregate read throughput</strong> for very IO-intensive queries.</p><p>The limitations of object storage for analytical, search, and vector querying are:</p><ul><li><p>Object storage-imposed <a href="https://engineeringideas.substack.com/i/147163081/network-io-amplification-inability-to-filter-or-pre-aggregate-rows-on-the-storage-side">read amplification and network overheads of random file access</a> <strong>make certain analytical indexes ineffective</strong>.</p></li><li><p>The &#8220;<a href="https://engineeringideas.substack.com/i/147163081/the-tradeoff-between-ingestion-data-latency-and-small-file-problem-with-storage-amplification">small file problem</a>&#8221;: high overhead of small files (and file writing as such) that <strong>prevents storing very fresh data in object storage</strong> or greatly increases the cost of doing this.</p></li></ul><p><strong>Modern databases avoid these limitations</strong> by having a layer of nodes for caching and updating recent table data, metadata, and indexes in memory or on SSDs.</p><p>At the same time, these databases can <strong>retain both main benefits of using object storage (low cost for rarely used data and high read throughput)</strong> by either making this layer completely ephemeral (like Databend, DuckDB/MotherDuck, Firebolt, LanceDB, Redshift, Snowflake, and others do), or by aggressively <em>tiering</em> table data to object storage, like ClickHouse, Doris, Druid, Pinot, SingleStore, StarRocks, and others <em>could</em> be configured to do.</p><p>Table transfer protocols (as well as Arrow Flight) can leverage this caching layer because they are just network protocols that databases can implement. However, accessing the data lake through Iceberg or another open table format is poised to miss the freshly ingested data or be <a href="https://engineeringideas.substack.com/i/147163081/object-storage-based-table-formats-miss-the-innovations-in-file-formats-for-data-partitions">ineffective for certain queries that greatly benefit from specialised indexes</a>.</p><h3><strong>Table formats</strong></h3><p>Open table formats embody an ambitious and technically impressive idea of removing the database from the data stack by carefully re-implementing its critical functions, namely the management of table schemas, metadata, and transactions, within the so-called <em>catalog</em> component separated from processing engines that do the meat of ETL and query processing.</p><p>However, it seems to me that there are some <em>not-technical</em> downsides to the wide adoption of this idea.</p><h4><strong>Innovation speed and file format inertia</strong></h4><p>If Iceberg &#8220;wins&#8221; analytical data stack deployments decisively, it will put the entire industry in an unusual situation when the innovation in table storage formats and performance hinges on a <em>committee</em> design process of <em>on-disk</em> file formats.</p><p>This sounds like a recipe for <a href="https://engineeringideas.substack.com/i/147163081/object-storage-based-table-formats-miss-the-innovations-in-file-formats-for-data-partitions">slow progress</a> at first and a legacy drug and &#8220;data format inertia&#8221; later.</p><p>Compliant Iceberg readers (processing engines) should already be able to read Avro, ORC, and Parquet. But these formats are not the last word in the history of columnar file formats: see&nbsp;<a href="https://www.youtube.com/watch?v=bISBNVtXZ6M&amp;ab_channel=VeloxCon">Nimble</a>,&nbsp;<a href="https://blog.lancedb.com/lance-v2/">Lance</a>,&nbsp;<a href="https://docs.activeloop.ai/technical-details/data-format">DeepLake Data Format</a>, <a href="https://github.com/maxi-k/btrblocks">BtrBlocks</a>,&nbsp;and <a href="https://github.com/spiraldb/vortex">Vortex</a>, not to mention the steadily improved internal file formats of ClickHouse, Databend, Doris, Druid, Pinot, StarRocks, and other databases. Iceberg will always face the trade-off of adding new formats for efficiency vs. imposing more implementation burden forever for processing engines.</p><p>Because table transfer protocols always assume <em>some</em> compute on the database side, they demand that the database side at least always supports column data transfer in <a href="https://arrow.apache.org/docs/format/Columnar.html">Arrow</a> format, potentially in addition to other, more specialised or optimised formats. (Obviously, this is also the main idea of <a href="https://arrow.apache.org/docs/format/FlightSql.html">Arrow Flight</a>. However, table transfer protocols <a href="https://engineeringideas.substack.com/i/148153268/column-sections-and-transfer-encodings">don&#8217;t limit themselves to the Arrow format</a>.)</p><h4><strong>Vendor competition and the &#8220;lowest common denominator&#8221; effect</strong></h4><p>There are a lot of OLAP and time-series database technologies and engineers who love to hack on them. If Iceberg takes over the OLAP space as the table storage format, these engineers and companies won&#8217;t just decide that area is &#8220;solved&#8221; and move to work on something else. This also won&#8217;t make sense objectively, considering that there are limitations and inefficiencies inherent to storing data <em>only</em> in object storage (as discussed above) and that Parquet is not the &#8220;silver bullet&#8221; file format that covers all use cases optimally.</p><p>It seems much more likely that database and data warehouse companies will start to &#8220;build around&#8221; Iceberg. For example, they can add custom-made indexes to Parquet files for specific use cases, store them in a separate SSD- or NVMe-based semi-ephemeral storage tier, or collect and cache advanced metadata outside Iceberg&#8217;s standard metadata format.</p><p>BigQuery already does this: see section 3.3 in (<a href="https://research.google/pubs/biglake-bigquerys-evolution-toward-a-multi-cloud-lakehouse/">Levandoski et al., 2024</a>), and <a href="https://research.google/pubs/biglake-bigquerys-evolution-toward-a-multi-cloud-lakehouse/">Snowflake does this, too</a>. These and other vendors will make their &#8220;accelerated Iceberg&#8221; as functional and efficient as possible, and the metadata and indexes that they propagate to the &#8220;true&#8221; Iceberg as minimal as possible, to maximise the value added by their platform and minimise the chances that their clients switch to another vendor, while keeping the right to say that they &#8220;use Iceberg&#8221; to calm customers&#8217; concerns about the vendor lock-in.</p><p>I don&#8217;t imply that such vendors&#8217; behaviour is wrong: all power to data warehouse vendors to build their competitive advantage!</p><p>However, in this scenario, it&#8217;s pointlessly wasteful that when users access these Iceberg layers from alternative processing engines and runtimes, bypassing the data warehouse&#8217;s native processing layers, they will not leverage the caches, indexes, and extra metadata that the data warehouse maintains anyway.</p><p>This arrangement is also not advantageous to data warehouse vendors themselves. First, they spend resources to sync their internal table metadata store with austere Iceberg metadata. Second, when users query Iceberg directly instead of using the data warehouse&#8217;s processing layer, the vendor &#8220;loses&#8221; some processing to another vendor or system, whereas if that processing was done on the vendor&#8217;s compute it would have charged the user for it.</p><p>Table transfer protocols (as well as Arrow Flight) enable interoperability between databases (data warehouses) and diverse processing engines <strong>while not inhibiting the healthy competition among the database vendors</strong>: they can use accelerated hardware setups and innovate on the approaches to data partitioning, indexing, and metadata storage while keeping their innovations proprietary if they choose to.</p><p>Databases will also retain as much processing compute as they deserve. The client can request a &#8220;thicker&#8221; or &#8220;thinner&#8221; <a href="https://engineeringideas.substack.com/i/148153268/table-processing-plan">table processing plan</a> depending on how much the vendor will charge for these different plans, traded off with cloud provider&#8217;s egress costs (if any) of transferring smaller or larger results of the respective table processing plans, and the cost of performing the remaining processing on the client side. Similar calculations can be done for the end-to-end latency of the processing job.</p><h3>The lock-in question</h3><p>Another advantage of Iceberg and other open table formats I haven&#8217;t mentioned yet is that they provide an ironclad guarantee that the data team can <strong>easily move all data to another data warehouse vendor or different cloud provider</strong>. This issue is periodically raised with OLAP and timeseries databases that don&#8217;t use Parquet or ORC as their data partition file formats, such as Druid and Pinot (see <a href="https://github.com/apache/pinot/issues/12315">example</a>).</p><p>If the database implements Table Read protocol, there is very little extra logic they should implement (just the <code>REPLICATION_INIT</code> and <code>REPLICATION_STEP</code> RPCs: see details <a href="https://engineeringideas.substack.com/i/148485754/table-replication-method">here</a>) to support export/replication. Also, the database doesn&#8217;t need to run anything in its control plane to monitor the replication job.</p><p>Considering the above, it would be hard for database vendors to justify not providing this functionality to their customers: it would appear as straightforwardly anti-competitive behaviour on their part. For open-source databases, it also wouldn&#8217;t be hard for the community to implement and maintain replication RPCs for the database.</p><p>Finally, <strong>many OLAP databases already provide export to Parquet and Iceberg even though they don&#8217;t use them as their native table storage format</strong>. These databases include BigQuery, ClickHouse, Databend, Doris, StarRocks, SingleStore, Snowflake, and others. When choosing these databases, data teams can be sure they <em>can</em> export their data if they decide to, while table transfer protocols would enable them to enjoy the benefits of interoperability with different processing engines without paying Iceberg&#8217;s overhead.</p><h2>Conclusion</h2><p>I buy into the composable data systems vision (<a href="https://www.vldb.org/pvldb/vol16/p2679-pedreira.pdf">Pedreira et al., 2023</a>; Voltron&#8217;s &#8220;<a href="https://voltrondata.com/codex/a-new-frontier">Composable Codex</a>&#8221;). However, I don&#8217;t think Apache Iceberg should be the centrepiece in the future composable data stacks for OLAP, search, and AI workloads.</p><p><a href="https://arrow.apache.org/docs/format/FlightSql.html">Arrow Flight</a> protocol is closer to enabling universal database and processing engine composability. However, lower-level protocols would enable the composed data systems to achieve resilience, better performance, load balancing, consistency, and other nice properties more effectively than with Arrow Flight. I&#8217;ve called such lower-level protocols <strong>table transfer protocols</strong> and drafted their design in this article series.</p><h3>What vendors may be interested in table transfer protocols</h3><p><strong>Specialised and challenger database vendors who want to innovate on the storage formats and the ingestion architecture</strong> (e.g., for hybrid transactional and analytical processing, HTAP), and who realise that they <strong>cannot win the entire processing stack</strong> and therefore want to open up for diverse processing engines. I think good examples of such databases might be CedarDB, CnosDB, Druid, GreptimeDB, Hopsworks, InfluxDB, LanceDB, OpenObserve, TimescaleDB, QuestDB, Quickwit, and possibly<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-2" href="#footnote-2" target="_self">2</a> Pinot, ClickHouse, Databend, Doris, Firebolt, Oxla, Pinot, SingleStore, StarRocks, and others.</p><p><strong>Specialised and challenger processing engine vendors</strong> who are currently at a disadvantage to established technologies (Spark, Flink, and Trino) in the <strong>number of &#8220;source&#8221; and &#8220;sink&#8221; integrations</strong>. I think good examples of such processing engines might be Bodo, DataFusion, DuckDB/MotherDuck, Theseus, and others.</p><p><strong>Accelerated and specialised hardware platform vendors</strong> who want the databases and processing engines to utilise their hardware (compute, networking, and storage) most effectively via the <a href="https://github.com/apache/arrow/issues/43762">streaming protocol for columnar data</a>. Cf. Nvidia&#8217;s <a href="https://rapids.ai/">Rapids</a> (including <a href="https://github.com/rapidsai/cudf">cuDF</a>) and Intel&#8217;s oneAPI Data Analytics Library (<a href="https://github.com/oneapi-src/oneDAL">oneDAL</a>).</p><p><strong>High-level data systems</strong>: ETL/ELT orchestrators and schedulers, change data capture, data movement, and replication tools, semantic layers, <a href="https://github.com/rilldata/rill">BI and operational analytics interfaces</a>, <a href="https://engineeringideas.substack.com/p/the-open-source-stack-for-decision">decision intelligence</a> and causal inference algorithms, data science apps and frameworks, feature stores, ML training frameworks, ML inference apps and platforms, data catalogs and governance, and others. High-level data systems can interface with databases and coordinate with the processing engines more effectively with the help of table transfer protocols than with Arrow Flight, and provide better end-to-end consistency and <em>exactly once</em> delivery guarantees.</p><h3>Project status and what&#8217;s next</h3><p>The work on this article series was sponsored by&nbsp;<a href="https://rilldata.com/">Rill Data</a>. Rill Data is interested in developing the open data ecosystem rather than promoting any specific database solution.&nbsp;<a href="https://github.com/rilldata/rill">Rill&#8217;s technology</a>&nbsp;is compatible with various databases mentioned in this article series, including ClickHouse, Apache Druid, and DuckDB.</p><p>I&#8217;m interested in starting a working group to develop table transfer protocols, perhaps within the Apache Arrow project. However, this also depends on interest from the vendors of databases, processing engines, and high-level data tools. If you represent some vendor who might be interested in helping with developing table transfer protocols and supporting libraries, please drop me a line at <a href="mailto:leventov@apache.org">leventov@apache.org</a>.</p><h2>Appendix: <strong>A word about &#8220;big&#8221; vs. &#8220;small&#8221; data</strong></h2><p><em>(Note: this section was originally published in <a href="https://engineeringideas.substack.com/p/table-transfer-protocols-for-universal">another article</a> in this series.)</em></p><p>Jordan Tigani recently demonstrated that&nbsp;<a href="https://motherduck.com/blog/redshift-files-hunt-for-big-data/">the vast majority of teams actually don&#8217;t have &#8220;Big&#8221; data</a>, and those who do rarely query it on a large scale, anyway. From my perspective, there is nothing to argue about here, I think Tigani is correct.</p><p>However, I design table transfer protocols specifically to address possible performance and efficiency limitations of Iceberg, even though most data teams will likely never encounter these limitations, or may save only pennies on their small workloads. Isn&#8217;t there a contradiction here?</p><p>My &#8220;theory of impact&#8221; is <em>not</em> that table transfer protocols will save that much money for most data teams, and query latency for most use cases. Rather,&nbsp;<strong>the performance and efficiency of table transfer protocols should assure data teams in choosing OLAP databases with native table storage formats instead of open table formats like Iceberg.</strong></p><p>Data teams may think that data and query volumes may increase in the future, and therefore they need a &#8220;grown-up&#8221;, Big Data solution that is guaranteed to scale. Many of these teams end up being wrong, as Jordan Tigani finds.</p><p>My response to this is not trying to argue these data engineers out of their affinity to &#8220;big data&#8221;, object storage-based solutions. I think individual data teams are often right when they choose the data lakehouse architecture:&nbsp;they rationally hedge against their own risk, as the cost of industry-wide inefficiency. <strong>Table transfer protocols should help the data teams to hedge against this &#8220;scaling risk&#8221;, thus enabling them to pick more efficient solutions from the beginning.</strong></p><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-1" href="#footnote-anchor-1" class="footnote-number" contenteditable="false" target="_self">1</a><div class="footnote-content"><p>Sometimes, a commercial cloud-based tier of an open-source database is essentially a different system because it can more easily leverage the same primitives that data warehouses from public clouds use.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-2" href="#footnote-anchor-2" class="footnote-number" contenteditable="false" target="_self">2</a><div class="footnote-content"><p>However, the databases in this group seem to have ambitions to own the processing stack more thoroughly.</p><p></p></div></div>]]></content:encoded></item><item><title><![CDATA[Table Write protocol for interop between diverse OLAP databases and processing engines]]></title><description><![CDATA[In the previous article, I argued that there is an opportunity for creating a new family of protocols: table transfer protocols, namely Table Read and Table Write protocols to address the M x N interoperability problem between OLAP, timeseries, vector, and search databases]]></description><link>https://engineeringideas.substack.com/p/table-write-protocol-for-interop</link><guid isPermaLink="false">https://engineeringideas.substack.com/p/table-write-protocol-for-interop</guid><dc:creator><![CDATA[Roman Leventov]]></dc:creator><pubDate>Wed, 04 Sep 2024 13:20:21 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!EJj2!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F55443e67-0a66-4164-8473-09b13a2e90ca_256x256.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In the <a href="https://engineeringideas.substack.com/p/table-transfer-protocols-for-universal">previous article</a>, I argued that there is an opportunity for creating a new family of protocols: <em><strong>table transfer protocols</strong></em><strong>, namely Table Read and Table Write protocols to address the M x N interoperability problem</strong> between <strong>OLAP, timeseries, vector, and search databases</strong> on the one hand and <strong>data processing/query and ML engines</strong> on the other hand.</p><p>I <a href="https://engineeringideas.substack.com/i/148153268/existing-solutions-are-not-enough">discussed</a> why existing technologies and protocols that tackle this interoperability problem, namely ADBC (Arrow Database Connectivity), BigQuery Storage APIs, open table formats (Apache Iceberg, Apache Hudi, and Delta Lake), and Arrow Flight are insufficient and have different downsides. Arrow Flight comes closest.</p><p>I&#8217;ve already described the <a href="https://engineeringideas.substack.com/i/148153268/table-transfer-protocols">common design principles for table transfer protocols</a> and a more concrete proposal for <a href="https://engineeringideas.substack.com/i/148153268/table-read-protocol-walkthrough">Table Read protocol</a>. In this article, <strong>I propose semi-concrete designs of Table Write protocol and a table replication method</strong> based on Table Read and Table Write protocols<strong>.</strong> In this series&#8217;s <a href="https://engineeringideas.substack.com/p/table-transfer-protocols-improved">next and final article</a>, I will review table transfer protocols again and discuss table transfer protocols&#8217; place in the <a href="https://materializedview.io/p/databases-are-falling-apart">disassembled database architecture</a> and data stack.</p><h3>Use cases for Table Write protocol</h3><h4>The ETL loop</h4><p>The need for <em>distributed columnar writing (data ingestion)</em> appears when a processing engine has completed a distributed computation job (after pulling data onto multiple worker nodes from some database(s) using Table Read protocol, or from a data lake) and wants to write the results back into the database into a new table, or update existing rows.</p><p>Arrow Flight doesn&#8217;t permit data ingestion from distributed writer nodes. </p><p>Open table formats (Iceberg, Hudi, Delta Lake) permit distributed writes, but if the target database uses these table formats, the read path of Arrow Flight becomes unnecessary: processing engines can read table data directly from the object storage.</p><p>On the other hand, open table formats are inefficient in many OLAP and HTAP use cases, as I argued in &#8220;<a href="https://engineeringideas.substack.com/p/the-future-of-olap-table-storage">The future of OLAP table storage is not Iceberg</a>&#8221;. So, it would be sad if the recent diversification of processing engines and ML runtimes pushed more data teams to use Iceberg as their only OLAP storage, unnecessarily leaving efficiency on the table and locking into their dependence on cloud object storage.<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-1" href="#footnote-1" target="_self">1</a></p><p>Thus, Table Write protocol&#8217;s primary motivational use case is <strong>distributed writing of processing job (or ML inference) results</strong> from the processing engine&#8217;s nodes back into the database.</p><p>This use case enables closing the loop:</p><ol><li><p>The processing engine does a distributed read of input data from the distributed database using Table Read protocol,</p></li><li><p>The engine performs a distributed processing job,</p></li><li><p>The engine writes the results back into the database in parallel from multiple worker nodes or GPUs via Table Write protocol.</p></li></ol><p><strong>In the above loop, columnar table data is not passed through a single node at any point, or possibly even through CPU memory at all</strong><a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-2" href="#footnote-2" target="_self">2</a>.</p><p>Table Write protocol can also be used to ingest data from a single node (a single data transformation/generation process, or a single-node source database). Even in this case, Table Write protocol should have advantages over Arrow Flight: <strong>writing different data partitions to multiple (distributed) database nodes</strong>, and the possibility of <strong>achieving resilient writing with </strong><em><strong>exactly once</strong></em><strong> delivery guarantees</strong> with less end-to-end implementation complexity than Arrow Flight would require<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-3" href="#footnote-3" target="_self">3</a>, similar to how <a href="https://engineeringideas.substack.com/i/148153268/table-read-protocol-overview-and-comparison-with-arrow-flight">Table Read protocol enables consistent and resilient reads with less end-to-end implementation complexity than Arrow Flight</a>.</p><h4>Distributed table replication between different database technologies</h4><p>Another target use case for Table Write protocol is <strong>distributed table replication</strong> via a combination of Table Read and Table Write protocols. The main difference from the above use case (&#8220;the ETL loop&#8221;) is that there is no processing engine between the source and target databases.</p><p>Additionally, such a table replication method would enable the most efficient and consistent (a la change data capture) import/export of tables between different databases that use different storage formats, <strong>without intermediary Kafka or Parquet/Iceberg storage</strong>.</p><h3>The best Table Write protocol is Table Read protocol in reverse</h3><p>The primary way to ingest data with <em>exactly once</em> delivery guarantees into a distributed database is to give database nodes access to a shared log of records to write (or commands/operations to execute) and let the nodes atomically commit (or reach a distributed consensus about) the read offsets within the log. If during ingestion some node crashes or becomes unavailable to the part of the cluster that maintains the consensus, the database&#8217;s cluster manager restarts consumption from the offset in the log of the last record that has been consumed and processed persistently (as known to the database&#8217;s consensus).</p><p>On the source data ingestion path (i.e., before ETL/ELT), the role of this shared log is usually played by Kafka or similar systems: Kinesis, Google Pub/Sub, Redpanda, WarpStream, <a href="https://transactional.blog/blog/2024-database-startups#_queues">and others</a>. These systems are populated with data from IoT gateways, change data capture agents, log and metric collectors, etc.</p><p>The approach with database-side offset management is recommended in <code>KafkaConsumer</code> <a href="https://kafka.apache.org/38/javadoc/org/apache/kafka/clients/consumer/KafkaConsumer.html#rebalancecallback">documentation</a> to achieve exactly once delivery guarantees. This approach is also extensively described in <a href="https://cwiki.apache.org/confluence/display/PINOT/Consuming+and+Indexing+rows+in+Realtime">Apache Pinot&#8217;s design document for partition-level Kafka consumption</a>.</p><p>Apart from exactly once delivery guarantees, this pull-based ingestion approach also permits the database to control node assignment for ingesting each data partition, and change this assignment at any time. The latter may be needed in the event of database cluster scale-up, scale-down, or data rebalancing that happens concurrently with a long-running data ingestion job.</p><p>With push-based ingestion, this flexibility is only possible if there is a layer of proxy nodes in front of the &#8220;core&#8221; database server nodes, or if the database&#8217;s cluster and data distribution management is fully externalised to Kubernetes (the same cluster that hosts the nodes that do the &#8220;push&#8221;). Neither of these is a common OLAP database setup.</p><p>Yet another advantage of pull-based ingestion from a shared log is &#8220;almost free&#8221; replication, as database replica nodes (for a given table, partition, or data segment) can all consume data from the same log, instead of transmitting records between each other after one of the replicas have consumed them. The latter approach (&#8220;internal replication&#8221;) requires extra burdensome background processing, internal buffers, etc. This could be entirely avoided with pull-based ingestion from a shared log.</p><p><a href="https://cloud.google.com/bigquery/docs/write-api-best-practices#manage_stream_offsets_to_achieve_exactly-once_semantics">BigQuery Storage Write APIs</a> offer concise, push-based ingestion API with exactly once delivery guarantees <em>by providing a simplified version of Kafka <strong>producer</strong> API</em>. In other words, BigQuery internalises the shared record log mentioned above. If the client pushes data into BigQuery via consumption from <em>another</em> log or a system that offers consistent-at-the-offset reads of records to ingest, such as a Flink or Spark Streaming processing pipeline, BigQuery&#8217;s approach becomes wasteful: in effect, there are two duplicative systems providing semantics of a log in front of the &#8220;core&#8221; database nodes.</p><p>Per Table Write protocol&#8217;s design use cases, writing sources are specifically processing engines such as Flink or Spark that already provide offset or block-based consumption in their &#8220;sink&#8221; interfaces, or other databases (when Table Write protocol is used for table replication) that could provide consistent-at-the-offset reads via Table Read protocol. Therefore, it would be wasteful for Table Write protocol to use BigQuery&#8217;s push-based approach to ingestion.</p><p>It turns out that <strong><a href="https://engineeringideas.substack.com/i/148153268/table-read-protocol-walkthrough">Table Read Protocol</a> already takes care of most aspects that would be nice to have in an efficient pull-based ingestion protocol, namely at-the-offset read consistency, load distribution and resource usage control, fault tolerance, control of transfer encodings for columns, and <a href="https://github.com/apache/arrow/issues/43762">streaming of columnar data</a> (including GPU off-loading).</strong></p><p>This leads to a decision to make Table Write protocol essentially <em>Table Read protocol in reverse</em>: that is, the <strong>source side</strong> (such as a processing or ML engine) in the Table Write protocol interaction (called the <strong>Write job</strong> below) acts as the <em>server side</em> in the &#8220;underlying&#8221; Table Read protocol interaction (aka the <em>Read job</em>) and the <strong>target side</strong> in the Write job acts as the <em>client side</em> in the underlying Read job<em>.</em></p><p>Another benefit of using Table Read protocol in reverse as Table Write protocol is getting a <strong>no-intermediary distributed table replication method &#8220;for free&#8221;</strong>. All databases that implement the server side of Table Read protocol can act as sources in the Write job. See the &#8220;Table replication method&#8221; section below for more details.</p><p>If a processing engine implements both the client and server sides of Table Read protocol for the &#8220;ETL loop&#8221;, it could also use Table Write protocol for <em>inter-stage data exchange</em>. <a href="https://github.com/apache/datafusion-ballista">DataFusion Ballista</a> uses Arrow Flight for this purpose.</p><h2>Table Write protocol: details</h2><h3>Node roles</h3><p>I&#8217;ll use the same terms for node roles <a href="https://engineeringideas.substack.com/i/148153268/node-roles">as in Table Read protocol</a>.</p><p>The Write job&#8217;s orchestrator/controller node role on the <strong>source side</strong> (such as a processing engine) is still called <strong>Coordinator</strong>.</p><p>The orchestrator/controller node role on the <strong>target side</strong> (i.e., the database the data is written into) is called <strong>Agent</strong>.</p><p>The nodes on the source side that hold the data to be written and will send it to the target are called <strong>Servers</strong>.</p><p>The target side&#8217;s nodes that receive and store data are called <strong>Clients</strong>.</p><p>If either the source or target side of the Write job is a single-process data-framing library runtime, an embedded database, or a single-node database, the above node roles are played by threads or coroutines within that process.</p><h3>Out-of-scope: t<strong>ransaction semantics</strong></h3><p>As I <a href="https://engineeringideas.substack.com/i/148153268/cross-cutting-and-out-of-scope-concerns">described</a> in the previous post, table transfer protocols are &#8220;headless&#8221;. This means that table transfer protocols don&#8217;t define transaction semantics for ACID guarantees.</p><p>Transactions are usually managed by the target database<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-4" href="#footnote-4" target="_self">4</a>. Some OLAP databases use the standard SQL transaction protocol (BEGIN&#8230;COMMIT, or implicit autocommit of SQL statements) and others have different ways to organise ingestion: for example, Apache Druid has &#8220;<a href="https://druid.apache.org/docs/latest/ingestion/tasks">indexing/ingestion tasks</a>&#8221;. Also, many OLAP and timeseries databases manage continuously running services to ingest data from Kafka or other perpetual data sources.</p><p>Thus, Write jobs are supposed to be embedded in either:</p><ul><li><p><em>Transaction protocol interactions,</em> that are jointly managed by the <strong>transaction manager</strong> and the <strong>transaction client</strong> (roles) on the target and source sides, respectively. An SQL console is a typical example of a transaction client.</p></li><li><p><em>Data ingestion tasks/jobs/streams,</em> that are jointly managed by the <strong>ingestion manager</strong> and (optionally) the <strong>ingestion client</strong> (roles) on the target and source sides, respectively. Here are some examples of ingestion clients: a process with a SparkContext or a SparkSession, an ETL/ELT tool, a table replication system, a feature store, or an ML/MLOps platform.</p></li></ul><p>Transaction and ingestion clients should interact with the target database directly before starting the Write job, and then &#8220;commit&#8221; the results after the Write job is completed if the database requires explicit transaction commits or completion signals for data ingestion jobs.</p><h3><strong>Write job initiation</strong></h3><p><code>Transaction Client or Agent &#8594; Coordinator: READ_FOR_WRITE &nbsp;&nbsp;Agent location, job context, table processing plan,<br>&nbsp;&nbsp;partitioning hints</code></p><p><code>READ_FOR_WRITE</code> is an optional step in the Write job. Upon receiving this request, Coordinator behaves the same as when it prepares the <a href="https://engineeringideas.substack.com/i/148153268/the-initial-request-and-coordinators-logic">step #2 response in Table Read protocol</a>, except that it sends the response as a <code>WRITE_INIT</code> request to the given Agent location and with the given job context.</p><p><code>READ_FOR_WRITE</code> request may be sent by Agent itself in a replication job (see &#8220;Table replication method&#8221; below for details), or when Agent retries to get Server locations of  temporarily unavailable partitions. In this case, if Agent doesn&#8217;t know its own public address, it may use the <code>reuse-connection://</code><a href="https://arrow.apache.org/docs/format/Flight.html#connection-reuse"> schema convention</a> from Arrow Flight.</p><p><code>Coordinator &#8594; Agent: WRITE_INIT<br>&nbsp;&nbsp;job context, write operation, field names,<br>&nbsp;&nbsp;[ partition: (filter, relation,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[ location: (URI, serving hints), ]), ]<br>Response:<br>&nbsp;&nbsp;Write job ID</code></p><p>The <em>job context</em> includes all information needed to anchor this Write job on the target side: the target table name, the transaction ID, the ingestion task/job/stream ID, the ID of the &#8220;root&#8221; Write job to track their completions (see the section &#8220;Handling Server restarts&#8221; below), etc.</p><p>Coordinator receives the context from the transaction or ingestion client, or Agent itself via a <code>READ_FOR_WRITE</code> message or by other means.</p><p>When Agent receives a <code>WRITE_INIT</code> request, it immediately creates an ID for this new Write job and sends it back to Coordinator before doing its other logic, described in the &#8220;Agent&#8217;s logic&#8221; section below.</p><h4><strong>Record writing (DML) and output semantics</strong></h4><p>The write operation (a Substrait&#8217;s <a href="https://github.com/substrait-io/substrait/blob/bc1b93f/proto/substrait/algebra.proto#L577">WriteOp</a> + extra fields for upsert behaviour definition, such as the default values for unspecified fields) determines the semantics for writing the records in this Write job: whether they are inserted or upserted into the target table, or update existing rows, or delete existing rows.</p><p>However, <code>WRITE_OP_CTAS</code> (Create Table As Select) write operation is not supported: table creation semantics are out of scope for Table Write protocol. The transaction client should create the table separately before letting Coordinator initialise Write job(s) via <code>WRITE_INIT</code> requests.</p><p>On the other hand, there is a type of write operation that is not currently codified in Substrait but would be useful to implement for Table Write protocol, in particular for the cases when it is used for table replication: the record writing semantics are determined by some column in the records themselves. This would be useful when the source database in a table replication job natively uses &#8220;tombstone&#8221; bitmaps to indicate deleted rows in data segments<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-5" href="#footnote-5" target="_self">5</a>.</p><p>Note: Substrait <a href="https://github.com/substrait-io/substrait/blob/bc1b93f/proto/substrait/algebra.proto#L554">WriteRel</a>&#8217;s <code>OUTPUT_MODE_MODIFIED_RECORDS</code> is not supported in Table Write protocol because it doesn&#8217;t seem there is any use case for it. Even returning just the number of modified rows may not be possible in databases that use the &#8220;write first, compact/deduplicate rows later&#8221; approach to upserts, updates, and deletes. The number of modified rows can be requested along with other statistics of the Write job(s) from the transaction or ingestion manager, via some protocol specific to the target database.</p><h4><strong>Partitions</strong></h4><p>The list of <em>partitions</em> in the <code>WRITE_INIT</code> request is the equivalent of <a href="https://github.com/substrait-io/substrait/blob/bc1b93f/proto/substrait/algebra.proto#L554">WriteRel</a>&#8217;s <code>input</code> relation: the latter would be the union of partitions&#8217; <em>relations</em>. At the same time, this list of partitions is a simplified version of Coordinator&#8217;s <a href="https://engineeringideas.substack.com/i/148153268/the-initial-request-and-coordinators-logic">step #2</a> response to Agent in Table Read protocol, except that <em>slices</em> are omitted (it could be assumed that there is a slice wrapping each partition).</p><p>The partition is defined by its <em>filter</em> (a <a href="http://substrait.io/">Substrait</a> expression), in the same way as in Table Read protocol. See more on partition semantics <a href="https://engineeringideas.substack.com/i/148153268/slices-and-partitions">in Table Read protocol description</a>.</p><p>Each partition&#8217;s <em>relation</em> (a Substrait&#8217;s <a href="https://github.com/substrait-io/substrait/blob/bc1b93f/proto/substrait/algebra.proto#L462">Rel</a>) defines the <em>physical</em> schema of the written records in the partition, as they will appear on the wire between the source&#8217;s Servers and the target&#8217;s Clients. Relations are specific for each partition because there may be different fields in different partitions, for example, if the source side is another database in a table replication, and the schema of the table in the source database has been changed. The same field may also have different types in different partitions as long as the target database can upcast all these types to the column type in the target table.</p><p>The relation shouldn&#8217;t include the partition&#8217;s filter. If all partitions in the Write job share the same relation, it&#8217;s possible to send it only once and omit them from each partition structure. <em>Field names</em> are always extracted in this way, as they should be shared between partitions: that&#8217;s why partition&#8217;s <code>relation</code> field is a Substrait&#8217;s <code>Rel</code> rather than a <a href="https://github.com/substrait-io/substrait/blob/bc1b93f/proto/substrait/algebra.proto#L454">RelRoot</a>.</p><p>When the source side is a processing engine, the <em>locations</em> list of each partition should typically have just one element, i.e., the location of the processing engine&#8217;s worker node that holds the processing results. However, if the source side of the Write job is a database (in the course of a table replication job), partitions may have multiple locations that can enable better load distribution on the source side and higher overall speed of the table replication job.</p><p>The location list for a partition may also be empty in response to a <code>READ_FOR_WRITE</code> request. This indicates that the partition is temporarily unavailable. Agent should handle this in the same way <a href="https://engineeringideas.substack.com/i/148153268/table-data-availability">as in Table Read protocol</a>: periodically repeat <code>READ_FOR_WRITE</code> requests where the original table processing plan specialised to the unavailable partition&#8217;s filter and the parent Write job&#8217;s ID as the &#8220;root&#8221; Write job ID. See also the section &#8220;Handling Server restarts&#8221; below.</p><h3>Multiple Write jobs within a single transaction or ingestion task/job/stream</h3><p>Coordinator can initiate multiple Write jobs within a transaction or an ingestion task/job/stream: Coordinator can send multiple <code>WRITE_INIT</code> requests to Agent with different lists of partitions. These Write jobs <em>may</em> overlap in time.</p><p>Writing from a perpetual data source, such as a stream processing engine like Flink or hybrids of databases with stream processing systems like Materialize, RisingWave, <a href="https://transactional.blog/blog/2024-database-startups#_stateful_streaming">and others</a>, can be implemented as a <em>series</em> of Write jobs within a single ingestion task/job/stream. Yet, every Write job has a limited number of partitions, and every partition&#8217;s filter is &#8220;closed&#8221;, such as <code>time BETWEEN $X and $Y</code> rather than <code>time &gt; $X</code>.</p><h3>Agent&#8217;s logic</h3><p>Upon receiving the <code>WRITE_INIT</code> request from Coordinator, Agent, Coordinator, Clients, and Servers generally behave <a href="https://engineeringideas.substack.com/i/148153268/agents-logic">according to Table Read protocol, starting from step #3</a>.</p><p>Of course, in determining which target database&#8217;s node should act as Client for each partition, Agent should consider the target side&#8217;s existing data segment placement on the database nodes, data distribution rules for the target table, and the current load of database nodes. In other words, the difference from the &#8220;standard&#8221; client-side load distribution logic <a href="https://engineeringideas.substack.com/i/148153268/agents-logic">as described for Table Read protocol</a> is that the target side of the Write job (i.e., the client side of the underlying Read job) may be stateful if database nodes themselves are stateful.</p><p>If the source side&#8217;s VPC rules prohibit inbound connections, Agent can send to Coordinator the Clients locations that will consume data from the given partition locations. The source side&#8217;s Servers <em>must</em> establish connections with the corresponding Clients to enable the transfer of data from Servers:</p><p><code>Agent &#8594; Coordinator: WRITE_PRE_CONNECT_CLIENTS<br>&nbsp;&nbsp;[ (Server location, Client locations), ]<br>Coordinator &#8594; Client(s): WRITE_PRE_CONNECT_CLIENTS<br>&nbsp;&nbsp;Server locations<br>Client &#8594; Server(s): WRITE_PRE_CONNECT</code></p><p>Note that the connection from Coordinator to Agent is already established via the <code>WRITE_INIT</code> request that makes the <code>WRITE_PRE_CONNECT_CLIENTS</code> request possible.</p><p>If Clients get swapped in the course of the Write job, Agent can send <code>WRITE_PRE_CONNECT_CLIENTS</code> requests repeatedly to update the lists of Client locations.</p><h3>Handling Write jobs larger than source Servers&#8217; memory</h3><p>If the source side&#8217;s Servers are transferring more data in this Write job than they can hold in memory at once (or the processing engine prefers to reserve memory for other concurrent jobs), Coordinator <em>must</em> set Servers&#8217; <a href="https://engineeringideas.substack.com/i/148153268/partition-locations">serving parallelism limit</a> to one for these Servers in the <code>WRITE_INIT</code> request.</p><p>After that, Servers <em>must</em> break down large partitions into multiple <a href="https://engineeringideas.substack.com/i/148153268/column-sections-and-transfer-encodings">sections</a><a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-6" href="#footnote-6" target="_self">6</a> as part of <em>consumer info</em> that each Server sends to Client at <a href="https://engineeringideas.substack.com/i/148153268/clients-logic">step #5</a> of the underlying Read job, even though there may be no difference in the offered per-column transfer encodings between the sections (which is the original &#8220;justification&#8221; for the concept of sections in Table Read protocol).</p><p>To permit multiple target database&#8217;s replica nodes ingesting the same partition as Clients concurrently, Servers must also track serving parallelism and enforce the limit per Client, rather than in total across Clients, and Agent must send partition consumption tasks to Clients at <a href="https://engineeringideas.substack.com/i/148153268/agents-logic">step #3</a> and synchronise their completion such that only two Clients that request the same partition take advantage of Server&#8217;s per-Client tracking of the serving parallelism limit.</p><p>By doing what is described above, Coordinator, Agent, and Servers cooperate to execute <a href="https://engineeringideas.substack.com/i/148153268/streaming-column-data-from-server-to-client">sequential consumption</a> of the partitions and sections by Clients. Then, the source side can leverage <code>WRITE_PROGRESS</code> messages to dismiss successfully ingested partitions (and sections within partitions) promptly. This enables Write jobs with the total size of written records larger than the size of memory allocated to these jobs on Servers through which the records flow.</p><h3>Write job progress</h3><p>After a Client successfully consumes a data section from a Server (i.e., a <a href="https://github.com/apache/arrow/issues/43762">columnar data streaming protocol</a> interaction for the section ends with a <code>COMPLETE</code> signal) and successfully persists this data to its disk or object storage, Client writes the number of consumed and persisted rows to the target side&#8217;s metadata store, or, perhaps, an ephemeral metadata &#8220;substore&#8221; specific for the Write job and tied to this Write job&#8217;s parent transaction or ingestion task/job/stream lifetime, as supported by <a href="https://streamnative.io/blog/introducing-oxia-scalable-metadata-and-coordination">Oxia</a>.<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-7" href="#footnote-7" target="_self">7</a></p><p><strong>Then, Agent executes the following logic concurrently with <a href="https://engineeringideas.substack.com/i/148153268/agents-logic">its Read job logic</a>:</strong></p><pre><code>ingested_row_counts =
  new map&lt;partition, map&lt;consumption_token, integer&gt;&gt;
min_ingested_row_counts = new map&lt;partition, integer&gt;

async for (partition, consumption_token, ingested_row_count) updates
  in metadata_store:
    ingested_row_counts[partition][consumption_token] =
      ingested_row_count
    if size(ingested_row_counts[partition]) &lt; replication_factor:
        // Not all replicas have reported any progress for the partition
        //   yet, skip
        return
    min_count = min_ingested_row_counts[partition]
    new_count = min_value(ingested_row_counts[partition])
    if new_count &gt; min_count:
        min_ingested_row_counts[partition] = new_count
&#9;<strong>Agent &#8594; Coordinator: WRITE_PROGRESS
&#9;  partition, new_count</strong><code>
</code></code></pre><p>Agent listens to the metadata store. When it sees that all replica Clients, identified by their <a href="https://engineeringideas.substack.com/i/148153268/preemption-of-partition-consumption">consumption tokens</a> (note the metadata store schema is internal to the target side, and thus this ID must not necessarily be equal to the consumption token as it appears in Table Read protocol, although this is a natural choice), have consumed N rows within the partition, which is higher than the previous N for that partition, Agent sends <code>WRITE_PROGRESS</code> messages to Coordinator.</p><p>There is more than one replica Client (usually, two) if the target database wants to piggy-back Table Write protocol to get &#8220;almost free&#8221; replication, as I mentioned above in the section &#8220;The best Table Write protocol is Table Read protocol in reverse&#8221;, and as illustrated in Apache Pinot&#8217;s documentation <a href="https://cwiki.apache.org/confluence/display/PINOT/Consuming+and+Indexing+rows+in+Realtime#ConsumingandIndexingrowsinRealtime-DesignofLowLevel(PartitionLevel)consumptioninPinot">here</a>.</p><p>When Coordinator receives a <code>WRITE_PROGRESS</code> message, it registers them in its own metadata store (to support high availability and Write job restarts) and forwards them to the relevant Servers. Servers then release resources (memory, primarily) used to serve the data sections that are now completely ingested, to enable Write jobs larger than source Servers&#8217; memory: see above.</p><h3><strong>Handling Server restarts</strong></h3><p>If some source&#8217;s Server crashes or is restarted, Client sends to Agent a <a href="https://engineeringideas.substack.com/i/148153268/clients-logic">step #6</a> message in Table Read protocol. Then Agent sends to Coordinator a <code>READ_FOR_WRITE</code> request (equivalent to step #7 in Table Read protocol) where it retransmits the job context that it received from Coordinator in the <code>WRITE_INIT</code> request (adding the current Write job&#8217;s ID as the &#8220;root&#8221; Write job ID if there is none yet in the job context), <code>partition.relation &amp; partition.filter</code> as the table processing plan, and empty partitioning hints.</p><p>Coordinator responds with a new <code>WRITE_INIT</code> request which may have a more fine-grained partition breakdown, perhaps if the old Server crashed exactly because the original partitions were too big and didn&#8217;t fit in memory. And even if Coordinator returns a single partition with the same filter as before, the new Server may break this partition into <a href="https://engineeringideas.substack.com/i/148153268/column-sections-and-transfer-encodings">sections</a> differently than the old Server.</p><p>When Client(s) reconnect to the new Server and initiates streaming of new partition&#8217;s sections, it sends the <code>row_offset</code> equal to the already ingested (consumed and persisted) number of rows in <em>the whole original partition</em> at <a href="https://engineeringideas.substack.com/i/148153268/streaming-column-data-from-server-to-client">step #10</a> of the underlying Read job.</p><p>The new Server may figure out if any rows should be transferred in the given section and the given (partition) row offset either very cheaply, or the new Server may need to &#8220;shadow consume&#8221; the section without sending the actual data. If the section needs to be skipped completely, Server responds to the step #10 request from Client with a <a href="https://github.com/apache/arrow/issues/43762">streaming protocol</a>&#8217;s <code>COMPLETE</code> signal immediately.</p><p>If Coordinator broke down the original partition into several smaller partitions with different Server locations, Coordinator <em>must</em> order partitions in its <code>WRITE_INIT</code> message such that they coincide with the original partition&#8217;s row order, and Clients <em>must</em> consume the new partitions sequentially to send the correct <code>row_offset</code> (subtracting the number of consumed rows in the preceding partition) to each of the new partitions.</p><h3>Write job completion</h3><p>Table Write protocol has <em>implicit completion</em>: Both Coordinator and Agent <em>must</em> keep track of partitions in the Write job (as listed in the <code>WRITE_INIT</code> request) whose transfer has been completed, as Agent signals to Coordinator in <code>WRITE_PROGRESS</code> messages described above. Coordinator and Agent must also keep track of the tree of Write jobs as created by <code>WRITE_INIT</code> requests with specified &#8220;root&#8221; Write job IDs in the job context.</p><p>When Coordinator and Agent see that the transfer of all partitions in this Write job is complete, as well as all child Write jobs for the &#8220;root&#8221; Write job, Coordinator and Agent without any additional communication with each other both release all resources associated with this Write job and signal Servers and Clients involved in this Write job to do the same.</p><h3><strong>Write job abortion</strong></h3><p>As transaction and ingestion task/job/stream semantics are not defined in Table Write protocol, it doesn&#8217;t need to be concerned with abortion and error messaging.</p><p>The Write job might fail due to a data (consistency) conflict, crashes of the target&#8217;s Clients, or it could be aborted externally due to overload.</p><p>If the Write job abortion originates from actions on the level of Table Write protocol rather than higher levels, Agent registers the abortion signal and error messages with the transaction or ingestion manager rather than the source side&#8217;s Coordinator.</p><p>It&#8217;s the responsibility of the transaction/ingestion manager to send the termination signal to the transaction/ingestion client, which in turn propagates this termination signal to Coordinator. All these interactions are out of the scope of Table Write protocol: they happen according to the already existing protocols between the target database, the processing engine (or another source, such as another database, in the context of table replication), and the system or process that acts as the transaction or ingestion client.</p><p>Then, Coordinator sends signals to Servers to release all resources associated with the Write job. These signals are internal to the source side and thus out of scope for Table Write protocol.</p><p>As per Table Read protocol, Agent and Coordinator must <a href="https://engineeringideas.substack.com/i/148153268/high-availability-ha-of-agent-and-coordinator">monitor each other&#8217;s aliveness</a>. When their counterpart appears unresponsive to them, they terminate all connections and release resources on their side of the Write job. They should report this to their transaction/ingestion manager or transaction/ingestion client, respectively.</p><h3>Table Write protocol: implementation notes</h3><p>It should be relatively simple for most processing engines to implement the source side of Table Write protocol, i.e., the server side of Table Read protocol. They can leverage their implementations of inter-stage (and inter-node) data exchange.</p><p>If the processing engine already implements the server side of Arrow Flight protocol, as DataFusion does, implementing the server side of Table Read protocol becomes even simpler: Table Read protocol is &#8220;progressive&#8221;, which means the implementation could only support &#8220;core&#8221; features that are mostly equivalent to Arrow Flight. The primary difference would be the <a href="https://github.com/apache/arrow/issues/43762">streaming protocol for columnar data</a> instead of the standard FlightData streaming in <a href="https://arrow.apache.org/docs/format/Flight.html">Arrow Flight RPC</a>, or <a href="https://arrow.apache.org/docs/format/DissociatedIPC.html">Arrow Dissociated IPC</a>.</p><p>On the target side of Table Write protocol, i.e., the client side of Table Read protocol, the databases could reuse much of the heavy lifting that they have done to implement pull-based Kafka ingestion, and combine that with other heavy lifting that they have done to implement importing and external querying of data stored in columnar formats, such as Parquet or Arrow.</p><p>However, despite the reuse of concepts and logic with Table Read protocol, implementing the server and client sides of Table Read protocol for a database (the latter is necessary for it to act as the target side in Table Write protocol) are completely separate efforts.</p><h2>Table replication method</h2><p>An efficient table replication method <em>across database types and storage formats</em> is possible via a combination of Table Read and Table Write protocols: the source side of the Write job is the database from which the table is replicated, and the target side of the Write job is the target database into which the table is replicated.</p><p>The table replication method automatically inherits all the nice properties of Table Read and Table Write protocols: read consistency, resiliency, efficient load distribution, and the controllability of resource usage, all on both sides of the replication process.</p><p>The proposed table replication method consists of a series of Write jobs. I&#8217;ll call <strong>Replicator</strong> the system that acts as the transaction or ingestion <em>client</em> for these Write jobs (see &#8220;Node roles&#8221; section above). Replicator&#8217;s logic looks as follows:</p><pre><code>if target_db uses task/job/stream-based ingestion:
    ingestion_task_id =
      ... (Start ingestion task/job/stream in target_db.)

<strong>Replicator &#8594; Coordinator (source_db): REPLICATION_INIT
  processing_plan, replication params
Replicator &#8592; Coordinator: REPLICATION_PHASE
  augmented_processing_plan</strong>

repeat until cancelled (maybe with delay between steps):
    if target_db uses transactions:
        // Note: EXECUTE_COMMAND (and TRANSACTION_RESULT below) are
        //   dummy. Actually, Replicator uses the transaction protocol
        //   specific to the target DB, such as the PostgreSQL wire
        //   protocol that many OLAP databases adopt.
        <strong>Replicator &#8594; Agent (target_db): EXECUTE_COMMAND
          "COPY INTO $target_table
           FROM $source_db WITH $augmented_processing_plan"</strong>
        // Executed on Agent: context = {table=target_table, tx_id=...}
        <strong>Agent &#8594; Coordinator: READ_FOR_WRITE
          <a href="https://arrow.apache.org/docs/format/Flight.html#connection-reuse">reuse-connection://?</a>, context, augmented_processing_plan, ...</strong>
        ... (The entire Write job happens in background.)
        <strong>Replicator &#8592; Agent: TRANSACTION_RESULT
          result</strong> // Success or Failure, after the Write job is complete.
    else: // target_db uses task/job/stream-based ingestion
        context = {task_id=ingestion_task_id}
        <strong>Replicator &#8594; Coordinator: READ_FOR_WRITE
          agent_location, context, augmented_processing_plan, ...</strong>
        ... (The entire Write job happens in background.)
        <strong>Replicator &#8592; Coordinator:
          result</strong> // Success or failure, after the Write job is complete.
    if result == Success:
        <strong>Replicator &#8594; Coordinator: REPLICATION_STEP
          augmented_processing_plan, replication params
        Replicator &#8592; Coordinator: REPLICATION_PHASE
          augmented_processing_plan</strong> // New plan
</code></pre><p><code>REPLICATION_INIT</code> and <code>REPLICATION_STEP</code> requests from Replicator to Coordinator with <code>REPLICATION_PHASE</code> responses make most of the interesting work here.</p><p>Upon receiving a <code>REPLICATION_INIT</code> request, Coordinator augments the given processing plan (it may be a simple column selection and projection from the source table) with extra special predicates that <a href="https://engineeringideas.substack.com/i/148153268/read-consistency">ensure consistent reads</a>. These extra predicates are opaque to Replicator and the target database&#8217;s Agent, and their nature depends on the source database&#8217;s approach to consistent reads. See more details at the link above.</p><p>Upon receiving a <code>REPLICATION_STEP</code> request, Coordinator inverts that extra predicate in the given (previous) augmented processing plan. For example, if that extra predicate has the form <code>segment.snapshot_number &lt;= $N</code>, Coordinator returns a new processing plan augmented with a predicate like <code>segment.snapshot_number &gt; $N and segment.snapshot_number &lt;= $X</code>, where <code>X</code> is the latest segment snapshot number.</p><h3>Index, statistics, and segment metadata replication</h3><p>Table Read protocol permits transferring <a href="https://engineeringideas.substack.com/i/148153268/column-indexes">column indexes</a>, as well as column- and section-level statistics (they could be treated as a kind of index) alongside column data to make replication faster at the cost of higher network traffic.</p><p>When the source and target databases are two separate instances of the same database technology, the source side&#8217;s Servers can also transfer arbitrary internal data segment- or column-level metadata in extension or metadata fields in its <a href="https://engineeringideas.substack.com/i/148153268/clients-logic">step #5</a> messages, or <a href="https://arrow.apache.org/docs/format/Columnar.html#custom-application-metadata">Arrow&#8217;s metadata</a> as transferred in the <a href="https://github.com/apache/arrow/issues/43762">streaming protocol</a>.</p><p>Note the difference in the approach to metadata transfer in this table replication method from the approach of open table formats: Iceberg, Hudi, and Delta Lake, who externalise the exact metadata storage format and medium, i.e., object storage. The table replication method based on Table Write protocol offers greater flexibility: the metadata may be stored in raw files on object storage like in Iceberg and Delta Lake, in HBase or another wide column store <a href="https://hudi.apache.org/blog/2023/11/01/record-level-index/">like in Hudi</a>, in ZooKeeper or Raft-based consensus system with in-memory caching like <a href="https://clickhouse.com/docs/en/guides/sre/keeper/clickhouse-keeper">in ClickHouse</a>, <a href="https://docs.databend.com/guides/overview/editions/dc/architecture">in Databend</a>, Druid, and Pinot, in a distributed key-value store such as Cassandra like in <a href="https://engineering.fb.com/2021/06/21/data-infrastructure/tectonic-file-system/">Facebook&#8217;s Tectonic</a>, in files directly on worker or database nodes alongside the data like in systems built with <a href="https://streamnative.io/blog/introducing-oxia-scalable-metadata-and-coordination">Oxia</a>, in front-end server&#8217;s key-value store with in-memory caching like <a href="https://doris.apache.org/community/design/metadata-design/">in Doris</a> and StarRocks, in a relational DBMS such as Aurora, AlloyDB, or Cockroach like in <a href="https://quickwit.io/">Quickwit</a>, in a disaggregated columnar storage <a href="https://research.google/pubs/big-metadata-when-metadata-is-big-data/">like in BigQuery</a>, or in hybrid and tiered ways where different parts of metadata are stored in different formats and on different mediums.</p><p>The approaches to storing metadata may be completely different in the source and the target databases in the replication job, but they don&#8217;t need to concern about the metastore architecture and format on the opposite side.</p><h3>Replication of &#8220;delete files&#8221;</h3><p>The source database can emulate replication of data segments with different <em>writing semantics</em> a la Iceberg&#8217;s <a href="https://iceberg.apache.org/spec/#row-level-deletes">delete files</a> with the help of the new write operation type proposed in the section &#8220;Record writing (DML) and output semantics&#8221; above: the writing semantics are determined by a column within the record itself. However, the source database&#8217;s nodes may transfer the same value in this special column for entire partitions&#8217; sections, and its transmission is almost free with Arrow&#8217;s <a href="https://arrow.apache.org/docs/format/Columnar.html#run-end-encoded-layout">Run-End Encoding</a> for the column (as transferred on the level of the <a href="https://github.com/apache/arrow/issues/43762">streaming protocol for columnar data</a>). The alternative design is making write operations specific to each partition in the <code>WRITE_INIT</code> message rather than shared.</p><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-1" href="#footnote-anchor-1" class="footnote-number" contenteditable="false" target="_self">1</a><div class="footnote-content"><p>This is because without the read throughput provided by public cloud&#8217;s object storage, such as with on-premises setups of OSS object storage like MinIO where the number of nodes in the object storage layer doesn&#8217;t greatly exceed the number of nodes doing query processing, analytics queries on tables stored in Iceberg, Hudi, or Delta Lake formats would run even slower.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-2" href="#footnote-anchor-2" class="footnote-number" contenteditable="false" target="_self">2</a><div class="footnote-content"><p>The <a href="https://github.com/apache/arrow/issues/43762">streaming protocol for columnar data</a> proposed for use in Table Read and Table Write protocols permits loading columnar data directly from NVM-based storage to GPU memory and back, using transfer off-loading via <a href="https://github.com/ofiwg/libfabric">libfabric</a> or <a href="https://github.com/openucx/ucx">UCX</a>.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-3" href="#footnote-anchor-3" class="footnote-number" contenteditable="false" target="_self">3</a><div class="footnote-content"><p>In fairness, if the database&#8217;s architecture is built around a shared, durable log (like WAL), and natively implements distributed transaction management, implementing <a href="https://arrow.apache.org/docs/format/FlightSql.html#id4">Arrow Flight-style SQL bulk ingestion</a> becomes relatively simple, unlike Table Write protocol, which would require significant development effort and complexity anyway. I believe that some HTAP databases, such as Google&#8217;s <a href="https://cloud.google.com/blog/products/databases/alloydb-for-postgresql-intelligent-scalable-storage">AlloyDB</a> and CedarDB (see <a href="https://vldb.org/pvldb/vol17/p3290-schmidt.pdf">Schmidt et al., 2024</a>) have these features and thus can offer a resilient data ingestion interface with exactly once delivery via Arrow Flight protocol more easily than via Table Write protocol. However, the vast majority of distributed OLAP databases don&#8217;t have a shared durable log in their architecture, and thus for them offering a resilient data ingestion interface with exactly once delivery guarantees (and without sticking Kafka in between) would be simpler via Table Write protocol.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-4" href="#footnote-anchor-4" class="footnote-number" contenteditable="false" target="_self">4</a><div class="footnote-content"><p>The emerging alternative is cross-system transaction managers such as <a href="https://seata.apache.org/">Apache Seata</a>, <a href="https://temporal.io/">Temporal</a>, etc. to orchestrate transactions on top of multiple OLAP and other databases.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-5" href="#footnote-anchor-5" class="footnote-number" contenteditable="false" target="_self">5</a><div class="footnote-content"><p>I use the term &#8220;data segment&#8221; to disambiguate between physical partitions at the source and logical partitions as defined <a href="https://engineeringideas.substack.com/i/148153268/slices-and-partitions">in Table Read protocol</a>.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-6" href="#footnote-anchor-6" class="footnote-number" contenteditable="false" target="_self">6</a><div class="footnote-content"><p>In Table Read protocol, there is an extra abstraction called <em>column group</em>, so, more precisely, sections belong to <a href="https://engineeringideas.substack.com/i/148153268/consumption-structure-column-groups">column groups</a> within partitions, not partitions themselves.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-7" href="#footnote-anchor-7" class="footnote-number" contenteditable="false" target="_self">7</a><div class="footnote-content"><p>If the target side <a href="https://engineeringideas.substack.com/i/148153268/high-availability-ha-of-agent-and-coordinator">doesn&#8217;t implement Agent&#8217;s high availability</a>, the metadata &#8220;store&#8221; could be just Agent&#8217;s memory, and Clients &#8220;write into this metadata store&#8221; by sending messages to Agent.</p><p></p></div></div>]]></content:encoded></item><item><title><![CDATA[Table transfer protocols for universal access to OLAP databases]]></title><description><![CDATA[Update: for the overview of table transfer protocols, see the following article.]]></description><link>https://engineeringideas.substack.com/p/table-transfer-protocols-for-universal</link><guid isPermaLink="false">https://engineeringideas.substack.com/p/table-transfer-protocols-for-universal</guid><dc:creator><![CDATA[Roman Leventov]]></dc:creator><pubDate>Mon, 26 Aug 2024 18:54:07 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4feccdf3-7282-4bbf-9d17-4048bff69106_1826x789.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><em>Update: for the overview of table transfer protocols, see the <a href="https://engineeringideas.substack.com/p/table-transfer-protocols-improved">following article</a>.</em></p><h2>The problem of OLAP data interoperability</h2><p>The field of <strong>OLAP, columnar, time-series, search, and vector databases</strong> is burgeoning. There are a lot of serious projects under active development that deliver state-of-the-art performance in different use cases. These include AlloyDB, BigQuery, CedarDB, ClickHouse, CosmosDB, Databend, Apache Doris, Apache Druid, Firebolt, GreptimeDB, Hopsworks, InfluxDB, LanceDB, OpenObserve, Oxla, Apache Paimon, Apache Pinot, QuestDB, Redshift, RisingWave, SingleStore, Snowflake, StarRocks, Synapse Analytics, TimescaleDB, Quickwit, Vastdata, VictoriaMetrics, and <a href="https://benchmark.clickhouse.com/">many</a> <a href="https://transactional.blog/blog/2024-database-startups#_olap_sql">more</a>.</p><p>Lots of innovation and diversification are also happening on the side of <strong>processing and ML engines</strong>. Apart from the usual suspects: Apache Spark, Apache Flink, Apache Hive, and Trino, there are Azure ML, Bodo, cuDF, Dask, Apache DataFusion, Dremio, DuckDB/MotherDuck, Timeplus Proton, Polars, Ray, SageMaker, Theseus, Velox, Vertex AI, and others.</p><p>Many OLAP databases can also act as processing engines, which is especially useful for cross-database joins. BigQuery, Redshift, Azure Synapse, Snowflake, ClickHouse, Databend, Doris, StarRocks, and others can do this.</p><p>The huge diversity on both the database and processing engine sides presents the classical <strong>M</strong> <strong>&#215;</strong> <strong>N interoperability problem</strong>.</p><p>Established processing engines such as Spark and Trino have spent a lot of effort building efficient bespoke integrations with many popular OLAP databases: e.g., see the list of <a href="https://trino.io/docs/current/connector.html">Trino connectors</a>. But even Spark and Trino don&#8217;t cover the &#8220;long tail&#8221; of columnar databases and time-series stores. When the developers of new databases want to make their tables efficiently accessible from many different processing engines, they have to write a lot of custom integrations. Similarly, new processing engines are less appealing if they can efficiently read the data from (and write to) only a few databases.</p><p>In this post, I propose <strong>a solution to this interoperability problem: a family of table transfer protocols</strong>: <strong>Table Read protocol</strong> for querying, <strong><a href="https://engineeringideas.substack.com/p/table-write-protocol-for-interop">Table Write protocol</a></strong> for data ingestion, and a <a href="https://engineeringideas.substack.com/i/148485754/table-replication-method">table replication method</a> on top of Table Read and Write protocols.</p><h2>Existing solutions are not enough</h2><h4><strong>ConnectorX, ADBC, Arrow Dissociated IPC</strong></h4><p><a href="https://github.com/sfu-db/connector-x">ConnectorX</a> and <a href="https://arrow.apache.org/docs/format/ADBC.html">ADBC</a> can take advantage of data partitioning and distribution on the database side, but not the processing engine&#8217;s side, that is, when the processing engine consists of multiple nodes. So, it works well for single-process dataframe engines, such as Pandas and Polars, but not distributed processing in Spark, Trino, etc.</p><p>Arrow <a href="https://arrow.apache.org/docs/format/DissociatedIPC.html">Dissociated IPC</a> is a point-to-point transfer protocol that can &#8220;accelerate&#8221; ADBC but doesn&#8217;t add client-side distribution.</p><p>Using ADBC with Arrow Flight <em>does</em> provide processing engine-side distribution semantics. However, Arrow Flight has other shortcomings that I discuss in the section &#8220;Arrow Flight protocol&#8221; below.</p><h4><strong>Open table formats: Iceberg, Hudi, Delta Lake</strong></h4><p>Another solution that has gained popularity recently is making the OLAP databases store data in an <strong>object storage-based table catalog, based on either Apache Iceberg, Apache Hudi, or Delta Lake table formats</strong>. Then, processing engines can read the table data from the object storage (or distributed file system) in these standardised table formats.</p><p>However, as I explained in the <a href="https://engineeringideas.substack.com/p/the-future-of-olap-table-storage">previous article</a>, object storage-based table format design fundamentally limits the performance and efficiency of queries. This is especially relevant in OLAP use cases with high query volumes, the need for low query latency, or real-time data updates.</p><p>Iceberg, Hudi, and Delta Lake also restrict the data partition file formats to either Apache Parquet, ORC, or Avro. <a href="https://engineeringideas.substack.com/i/147163081/object-storage-based-table-formats-miss-the-innovations-in-file-formats-for-data-partitions">This stifles innovation in columnar data file layouts</a>.</p><h4><strong>BigQuery Storage APIs</strong></h4><p><a href="https://cloud.google.com/bigquery/docs/reference/storage/">BigQuery Storage APIs</a> (Read API and Write API) have been designed by Google exactly for interoperability between multiple underlying table storage formats, and thus they abstract from the storage details. Storage access efficiency and scalability were also essential design criteria<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-1" href="#footnote-1" target="_self">1</a> for these APIs.</p><p>Here&#8217;s a nice picture by Google showing BigQuery (BigLake) Storage APIs&#8217; role as the interoperability layer:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!eBEl!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffa4fae5a-e2b5-4566-a3dc-cf256f175fe0_2102x1116.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!eBEl!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffa4fae5a-e2b5-4566-a3dc-cf256f175fe0_2102x1116.png 424w, https://substackcdn.com/image/fetch/$s_!eBEl!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffa4fae5a-e2b5-4566-a3dc-cf256f175fe0_2102x1116.png 848w, https://substackcdn.com/image/fetch/$s_!eBEl!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffa4fae5a-e2b5-4566-a3dc-cf256f175fe0_2102x1116.png 1272w, https://substackcdn.com/image/fetch/$s_!eBEl!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffa4fae5a-e2b5-4566-a3dc-cf256f175fe0_2102x1116.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!eBEl!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffa4fae5a-e2b5-4566-a3dc-cf256f175fe0_2102x1116.png" width="1456" height="773" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/fa4fae5a-e2b5-4566-a3dc-cf256f175fe0_2102x1116.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:773,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:288716,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!eBEl!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffa4fae5a-e2b5-4566-a3dc-cf256f175fe0_2102x1116.png 424w, https://substackcdn.com/image/fetch/$s_!eBEl!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffa4fae5a-e2b5-4566-a3dc-cf256f175fe0_2102x1116.png 848w, https://substackcdn.com/image/fetch/$s_!eBEl!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffa4fae5a-e2b5-4566-a3dc-cf256f175fe0_2102x1116.png 1272w, https://substackcdn.com/image/fetch/$s_!eBEl!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Ffa4fae5a-e2b5-4566-a3dc-cf256f175fe0_2102x1116.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Thus, on the purely technical level, BigQuery Storage APIs already mostly fit the bill of table transfer protocols that I&#8217;m proposing.</p><p>However, there is a huge non-technical issue with BigQuery Storage APIs: Google completely controls their development. This makes it very unlikely that both databases and processing engines will adopt the BigQuery Storage APIs, especially considering that both the subject databases and processing engines usually directly compete with BigQuery and Google&#8217; Vertex AI engine.</p><p>Also, BigQuery Storage APIs are too specialised for BigQuery&#8217;s managed storage and cloud environments. For example, these APIs are not optimised for direct interaction with storage nodes, but only for access through proxies that most open-source databases don&#8217;t even have in their designs. This point is discussed further in the section &#8220;Table Read protocol overview and comparison with Arrow Flight&#8221; below.</p><h4><strong>Arrow Flight protocol</strong></h4><p>Arrow Flight consists of two protocol layers: lower-level <a href="https://arrow.apache.org/docs/format/Flight.html">Arrow Flight RPC</a> and higher-level <a href="https://arrow.apache.org/docs/format/FlightSql.html">Arrow Flight SQL</a>. Arrow Flight RPC layer is responsible for the distribution of data transfer among possibly both database (storage) nodes and client (processing engine) nodes.</p><p>Arrow Flight can be combined with Arrow Dissociated IPC for accelerator-aware point-to-point data transfer.</p><p>Arrow Flight is a subproject of Apache Arrow. Thus, Arrow Flight&#8217;s development and governance are open, unlike the development and governance of BigQuery Storage APIs.</p><p>However, there are also a few very unfortunate limitations in Arrow Flight.</p><p>First, Arrow Flight SQL defines distribution only on the read (query) path. The write path (data ingestion) connects a single writer node and a single database (storage) node. Write distribution is needed when the processing engine wants to write the results of a distributed job back into the database. If the storage is based on open table formats (Iceberg, Hudi, or Delta Lake), the table catalog can organise parallelised writing, bypassing Arrow Flight. However, most distributed OLAP databases don&#8217;t want to use open-format tables as their primary storage because this would <a href="https://engineeringideas.substack.com/p/the-future-of-olap-table-storage">limit their query performance and efficiency</a>, as I noted above.</p><p>Second, Arrow Flight always transfers columnar data in <a href="https://arrow.apache.org/docs/format/Columnar.html">Arrow columnar format</a>. This inflates the network IO, CPU, and memory usage of storage nodes if all that is needed from these nodes is to read highly compressed column data from disks and send this data to the processing engine or to replication workers, without any filtering or transformation.</p><p>This network IO inflation makes Arrow Flight rather inefficient in some of the use cases of open table formats: cross-cloud backup/replication and large-scale JOINs where no pre-aggregation or row-level filter can be pushed down to the level of storage nodes. This is unfortunate because it means that <strong>even if the data team is happy with their OLAP database&#8217;s performance in user-facing queries, and even if this database supports Arrow Flight access, there are lingering use cases that are not supported well and can make the data team to second-guess their choice and perhaps even switch to open table formats, sacrificing the performance and cost efficiency gains.</strong></p><p>This adds to the gravity of open table formats like Iceberg and prevents diverse OLAP and time-series databases from rejoicing in the diverse ecosystem of processing engines without at least the very cumbersome and wasteful always-on, two-way sync between database&#8217;s native storage formats and metadata management, and open table formats.</p><p>Arrow Flight also misses some interesting possibilities for improving extensibility, resilience, data availability, and load distribution. See the section &#8220;Table Read protocol overview and comparison with Arrow Flight&#8221; below for elaboration.</p><p>Considering all these factors in aggregate, and that Arrow Flight is still implemented by very few databases<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-2" href="#footnote-2" target="_self">2</a>, <strong>I think there is a strong case for creating a new set of table transfer protocols</strong>, drawing the ideas and learnings from</p><ul><li><p>Open table formats: Iceberg, Hudi, and Delta Lake, and the catalogs that implement authentication, authorization, and <a href="https://www.youtube.com/watch?v=9tUCy-v6gxg">replication</a> for these table formats,</p></li><li><p>Distributed OLAP databases and data warehouses: ClickHouse, Druid, Pinot, Doris, StarRocks, BigQuery, Snowflake, Redshift, and others,</p></li><li><p>Distributed storage systems that achieve certain properties with the help of &#8220;fat clients&#8221;, such as <a href="https://engineering.fb.com/2021/06/21/data-infrastructure/tectonic-file-system/">Facebook&#8217;s Tectonic</a> and <a href="https://cppconf.ru/en/archive/2022/talks/93be214997614a66a22a7493dc82c202/">OK.ru&#8217;s S3-compatible storage</a>,</p></li><li><p>BigQuery Storage API,</p></li><li><p>Arrow Flight and Arrow Dissociated IPC,</p></li><li><p>&#8220;<a href="https://memoria-framework.dev/docs/applications/storage/">Computational storage</a>&#8221; in <a href="https://memoria-framework.dev/">Memoria</a>,</p></li><li><p><a href="https://rsocket.io/">RSocket</a>: a protocol providing Reactive Streams semantics,</p></li><li><p>Accelerator-aware async data transfer protocols: <a href="https://proceedings.mlsys.org/paper_files/paper/2023/hash/47d096470b10eba0c1805697c4445101-Abstract-mlsys2023.html">PyTorch RPC</a> and <a href="https://mercury-hpc.github.io/user/overview/">Mercury</a>,</p></li><li><p>Flexible columnar data formats: <a href="https://github.com/facebookincubator/nimble">Nimble</a>, <a href="https://blog.lancedb.com/lance-v2/">Lance</a>, and <a href="https://github.com/spiraldb/vortex">Vortex</a>,</p></li><li><p>Distributed metadata management: <a href="https://streamnative.io/blog/introducing-oxia-scalable-metadata-and-coordination">Oxia</a>,</p></li></ul><p>and other systems.</p><h2>Table transfer protocols</h2><p>First, disclaimer: in this and the following articles, I don&#8217;t aim to describe the table transfer protocols in complete detail. If such protocols are to be developed, they should be designed openly with inputs from many people with diverse perspectives and expertise. So, the descriptions below are sometimes not very precise.</p><p>My two primary goals with these protocol descriptions are to demonstrate that:</p><ol><li><p>Improvements too significant to dismiss are possible over the current design of Arrow Flight.</p></li><li><p>A single set of protocols can cover <em>all</em> functions of open table formats like Iceberg, for most data teams, including atomic distributed table writes and replication.</p></li></ol><p>However, I describe only Table Read protocol below to reduce the size of this article (already way too long). I describe <a href="https://engineeringideas.substack.com/p/table-write-protocol-for-interop">Table Write protocol</a> and a <a href="https://engineeringideas.substack.com/i/148485754/table-replication-method">table replication method</a> in the following article.</p><h3>Basic principles</h3><p>In the protocol design that I present below, I tried to follow three main principles:</p><p><strong>Progressive</strong>: there are simpler and more advanced versions of distribution and work splitting, columnar data encoding, transport, and other aspects that different sides of the protocol interaction can support. The sides negotiate using the most suitable and efficient methods that they both support.</p><p><strong>Cooperative</strong>: reliability and resilience, speed and resource efficiency, trust and security can be achieved most effectively when all nodes participating in the protocol interaction on both sides act cooperatively.</p><p><strong>Not opinionated</strong>: the protocol doesn&#8217;t specifically favour</p><ul><li><p>Cloud or on-premise setups,</p></li><li><p>Disaggregated object storage or disk-based storage,</p></li><li><p>Single node, distributed, or serverless databases and processing engines (clients),</p></li><li><p>IO-bound or compute bound-processing patterns,</p></li><li><p>Any specific query language or API: SQL, Spark APIs, dataframe APIs, etc.</p></li></ul><h3>Cross-cutting and out-of-scope concerns</h3><p>I omit the discussion of authentication, access authorization, security, and proxying aspects in the protocol descriptions below.</p><p>Authentication and encryption could be added straightforwardly with proven mechanisms already used in Arrow Flight, BigQuery Storage APIs, and many other protocols.</p><p>Access authorization I think should better be left to higher-level systems that build <em>on top</em> of table transfer protocols:</p><ul><li><p>SQL querying and transaction (BEGIN..COMMIT) facades</p></li><li><p>Table replication systems</p></li><li><p>Data governance proxies/facades such as Unity Catalog</p></li><li><p>Semantic layers such as Rill, Hashboard, Cube, etc.</p></li><li><p>Feature stores, ML training and inference systems</p></li></ul><p>Consequently, the primary concerns of these and other similar systems are out of scope for table transfer protocols.</p><p>Note the difference from Arrow Flight SQL, which covers SQL queries and transactions. Thus, the table transfer protocols described below are lower-level than Arrow Flight SQL.</p><p>At the same time, table transfer protocols are higher-level than Arrow Flight RPC. Arrow Flight RPC is oblivious to table-level processing logic such as projections, filtering, aggregations, table read consistency, and table data partitioning:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!emli!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4feccdf3-7282-4bbf-9d17-4048bff69106_1826x789.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!emli!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4feccdf3-7282-4bbf-9d17-4048bff69106_1826x789.png 424w, https://substackcdn.com/image/fetch/$s_!emli!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4feccdf3-7282-4bbf-9d17-4048bff69106_1826x789.png 848w, https://substackcdn.com/image/fetch/$s_!emli!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4feccdf3-7282-4bbf-9d17-4048bff69106_1826x789.png 1272w, https://substackcdn.com/image/fetch/$s_!emli!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4feccdf3-7282-4bbf-9d17-4048bff69106_1826x789.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!emli!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4feccdf3-7282-4bbf-9d17-4048bff69106_1826x789.png" width="1456" height="629" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4feccdf3-7282-4bbf-9d17-4048bff69106_1826x789.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:629,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:183496,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!emli!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4feccdf3-7282-4bbf-9d17-4048bff69106_1826x789.png 424w, https://substackcdn.com/image/fetch/$s_!emli!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4feccdf3-7282-4bbf-9d17-4048bff69106_1826x789.png 848w, https://substackcdn.com/image/fetch/$s_!emli!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4feccdf3-7282-4bbf-9d17-4048bff69106_1826x789.png 1272w, https://substackcdn.com/image/fetch/$s_!emli!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4feccdf3-7282-4bbf-9d17-4048bff69106_1826x789.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>For other differences from Arrow Flight, see the section "Table Read protocol overview and comparison with Arrow Flight&#8221; below.</p><h4><strong>Node roles</strong></h4><p>I&#8217;ll call a <strong>Read job</strong> the entire distributed Table Read protocol interaction between all node roles.</p><p>Within this article, I use the following terms for node roles participating in the Read job:</p><p><strong>Agent</strong> is responsible for orchestrating the Read job on the <strong>client side</strong>, i.e., the side of the processing engine or other <em>table data consumer</em>. This role can be played by Spark Master, for example.</p><p><strong>Coordinator</strong> is responsible for orchestrating the Read job on the <strong>server side</strong>, (also called <strong>database side</strong> interchangeably), i.e., the side of a database, a storage system, or other <em>table data producer</em>.</p><p>In databases with query broker and data server separation, such as Apache Doris, Apache Druid, or Apache Pinot, Coordinator&#8217;s role can be played by the query broker node/process (called Frontend/FE in Doris, and Broker in Druid and Pinot) that serves the Read job. In databases without such separation, such as ClickHouse, Coordinator&#8217;s role is played by any database node.</p><p><strong>Clients</strong> are the workers who request and consume some portion of the requested table data (this portion is determined by Agent). This role can be played by Spark&#8217;s Executors, for example. If the client side is a single process, such as a local dataframing library, Client can be implemented by a bunch of threads within the same process with Agent&#8217;s logic.</p><p><strong>Servers</strong> (identified by <strong>locations</strong>) are the nodes or serverless data access processes that serve portions of table data to Clients and optionally do some storage-side processing of the data, such as row-level filtering or aggregation.</p><p>This role can be played by stateful database processes such as ClickHouse or Doris&#8217;s Backend node, or serverless functions that read table data from disaggregated table storage, such as LanceDB or MotherDuck.</p><p>Also, the <em>processing engine&#8217;s workers can play the role of Servers for subsequent stages in the multi-stage processing plan</em>, or in Table Write protocol interactions. I will discuss this in more detail in the next article.</p><h4><strong>Base RPC and session layers</strong></h4><p>All protocol steps can be layered on top of gRPC with Protobuf or FlatBuffers encoding, although this is not significant for any of the protocol design aspects, and is merely a &#8220;default&#8221; choice that is already used by Arrow Flight protocol and BigQuery Storage APIs.</p><p>The exception is <a href="https://github.com/apache/arrow/issues/43762">accelerator-aware column streaming</a>: see steps 11-&#8230; of Table Read protocol, described in the section &#8220;Streaming column data from Server to Client&#8221;.</p><h2>Table Read protocol walkthrough</h2><h3><strong>The initial request and Coordinator&#8217;s logic</strong></h3><p><code>1 . Agent &#8594; Coordinator:<br>&nbsp;&nbsp;table processing plan: Substrait, partitioning hints<br>2. Agent &#8592; Coordinator:<br>&nbsp;&nbsp;[ slice: (filter, processing plan, [partition,]), ]<br>// partition&#8217; type:<br>&nbsp;&nbsp;&nbsp;(filter, [ location: (URI, serving hints), ])</code></p><h4><strong>Table processing plan</strong></h4><p>The <em>table processing plan</em> (encoded in the <a href="https://substrait.io/">Substrait</a> format) is an arbitrary processing plan with filters, projections, grouping and window aggregations <em>on a single table or relation</em>. The relation doesn&#8217;t need to be materialised on the server side before the beginning of the Read job: in fact, it could be the output relation of a multi-table join that the server side performs concurrently with serving the output to the client. Alternatively, if Agent (such as Spark Master) specifically wants to do a heavy join on the client (Spark&#8217;s) side, it can start two Read jobs in parallel and then plan them together. So, the requirement for the processing plan to be single-table doesn&#8217;t principally constrain the applicability of the Table Read protocol, but limits its scope and simplifies implementations.</p><p>Agent doesn&#8217;t need to know beforehand whether the server side supports the aggregation function or other pieces of the submitted plan. If the server side can&#8217;t do some parts of the plan, <em>Coordinator can push the corresponding parts of the table processing plan back to the client side</em>, retaining only what it can perform on Servers, as described below. This permits very &#8220;thin&#8221; server sides, such as Parquet (ORC, Lance) format-aware object storage nodes to participate in Table Read protocol, assuming that the client is a processing engine whose Clients are ready to take up the table processing plan, potentially involving distributed row shuffle between Clients.</p><p>This &#8220;partial processing plan push-back&#8221; is included in the scope of the protocol, rather than, for example, Coordinator simply responding with an error to plans that the server side can&#8217;t execute because the whole plan can inform the slice and partition breakdown that Coordinator returns to Agent.</p><h4><strong>Slices and partitions</strong></h4><p>Coordinator returns to Agent a set of <em>slices</em>. Slices are minimal (i.e., most granular) groups of <em>partitions</em>, such that completing the table processing plan on the client side doesn&#8217;t require any data exchange between different slices. If Agent goes on to task one Client with consuming and processing data of each slice, these Clients (each dedicated to their slice) won&#8217;t need to exchange any data with each other to compute a subset of the results of the table processing plan. However, Agent cannot create a Client large enough to process all of the slice&#8217;s data, Agent will need to schedule intermediate shuffling or data movement stages. See the section &#8220;Agent&#8217;s logic&#8221; below for further discussion.</p><p>Slices are related to data distribution on the client side. Partitions are related to data distribution on the server side of completing the Read job.</p><p>If Coordinator hasn&#8217;t pushed any processing logic back to the client side, Coordinator <em>must</em> return each partition wrapped into its own slice (1-1 correspondence), because partitions will already contain the results of the table processing plan.</p><p>In the context of this protocol description, slices and partitions are logical and are defined by their <em>filters</em>: boolean-valued functions encoded in Substrait. Partition may not coincide with the notion of <em>data partition</em> that may be used within the database, such as a physical file or section containing a portion of the table data. Some databases also use the term <em>data</em> <em>segment</em> for the latter; below, I&#8217;ll also call them &#8220;data segments&#8221; to prevent confusion with &#8220;partitions&#8221;, as I use &#8220;partitions&#8221; in a different meaning here.</p><p>An informal expectation set by the protocol is that the server side only returns partitions that Servers can effectively fetch without touching (most of) the rows that don&#8217;t match the partition filter. This can be achieved by checking the partition filter against the data segment&#8217;s metadata, or if Servers have indexes for these columns (or have the data segment&#8217;s rows sorted by these columns, which traditional databases call &#8220;cluster indexing&#8221;). However, partitions could be more granular than data segments: one segment corresponds to multiple partitions, less granular: one partition includes multiple segments, or a mixture of these: more granular along some dimensions and less granular along others.</p><p>Neither Agent nor Clients have to be able to execute the partition filter in its entirety, for example, if the database uses a proprietary hash function for data partitioning, or if they use a partition key that doesn&#8217;t end up a result column. Still, filters have to be encoded in Substrait so that Agent can extract the remaining partitioning information from them to inform the workload distribution among Clients.</p><p>Along with each slice filter, Coordinator returns to Agent the <em>slice processing plan</em> that Servers could still apply to the rows in this slice on their side, before returning the results to Clients<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-3" href="#footnote-3" target="_self">3</a>. The slice processing plan could be a simpler part of the table processing plan, potentially all the way to simple fetch of the input table&#8217;s columns and returning them to Clients without any processing on the server side. For consistency, each slice processing plan also includes the corresponding slice filter.</p><p>The reasons why Coordinator may push processing back to Clients for the slice could be:</p><ul><li><p>None of Servers that host the slice&#8217;s data can perform the table processing plan in full, e.g. if Servers don&#8217;t know how to apply the specified aggregation, or</p></li><li><p>The table processing plan has a window or a group-by aggregation that demands that rows should be moved between Servers, and the database doesn&#8217;t want to do any distributed processing for this Read job and prefers to push it back to the client side that is specialised in distributed processing.<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-4" href="#footnote-4" target="_self">4</a></p></li></ul><p>For example, if Agent sends to Coordinator the table processing plan that includes a group-by on a column that is not part of the database&#8217;s distribution/partitioning key for the table, Coordinator can return a single slice whose filter is taken from the table processing plan, and the slice processing plan which is a simple fetch of the input table&#8217;s columns. In other words, Coordinator has pushed all processing apart from the predicate pushdown back to the client side.</p><p>Note that the processing push-back may not be uniform across all slices. The partitioning strategy for the table in the database may differ for recent data and older data segments. This may affect the capacity of the Servers that host this or that partitions to perform the table processing plan on their side.</p><h4><strong>Slice and partition breakdown</strong></h4><p>Filters of all returned slices must logically add up (i.e., if OR&#8217;ed together) to the table processing plan&#8217;s filter, and the filters of all partitions within a slice must logically add up to their parent slice&#8217;s filter.<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-5" href="#footnote-5" target="_self">5</a></p><p>Partition filters can include conditions that determine data distribution/segmentation on the server side, as well as conditions on sort columns or columns with range access indexes <em>within</em> individual data segments. Since Agent may not know the database&#8217;s internal data partitioning scheme for the table, let alone the indexing strategy, Agent doesn&#8217;t know <em>a priori</em> how many slices and partitions Coordinator will return, and what extra conditions will Coordinator include in slice and partition filters.</p><p>The slice and partition breakdown returned by Coordinator is partially determined by the distribution of data segments on Servers<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-6" href="#footnote-6" target="_self">6</a>: Coordinator cannot return fewer partitions (and, therefore, slices, because every partition can belong only to a single slice) than is necessary to reflect the differences in the lists of Server locations that host different partitions (see the section &#8220;Partition locations&#8221; below). For example, if one data segment is stored only on Server A and another segment is stored only on Server B, Coordinator cannot return fewer than two partitions in total. Meanwhile, it depends on the semantics of the table processing plan whether Coordinator will put these two partitions within a single slice (if the execution of the remaining parts of the table processing plan will require moving around partition rows), or can put each partition into a separate slice.</p><p>The above consideration may still under-determine the slice and partition breakdown. Coordinator may have a latitude in augmenting the slice and partition filters with different columns from the database&#8217;s partitioning key for the table, or with different columns that are indexed on the data segment level.</p><p>If Coordinator has pushed back to the client side a part of the table processing plan that includes a time-based window aggregation or a grouping aggregation, and the time or grouping columns can be included in the partition filters, Coordinator <em>must</em> do this in order to help the client side reduce fan-in/out factor of the ensuing shuffle or aggregation.</p><p>Further, partition sizing can depend on some client-side factors:</p><ul><li><p>The maximum number of Clients that can consume data in this Read job,</p></li><li><p>Whether these Clients all consume the same data (such as, if the client executes a broadcast join with the table consumed in this Read job) or not, and</p></li><li><p>The priority and latency requirements of this Read job: such as, whether this Read job is a piece of an interactive user-facing query or a low-priority background job.</p></li></ul><p>As well as server-side factors, such as the priority of the database to serve this client, or permit this client to consume only a small portion of the database&#8217;s network and disk IOPS and bandwidth, so that the latency of the main query load and data ingestion traffic in the database is unaffected by this Read job.</p><p>The main tradeoff in partition sizing is the following: more IOPS and processing overhead on the server side (bad for the server side, if it minds this) could enable better saturation of the bisection bandwidth between Servers and Clients, or more fine-grained or favourable distribution of workload on the client side.</p><p>Designing a generic algorithm or protocol for negotiating all these factors between Agent and Coordinator is not the goal of this article. I&#8217;ve called <em>partitioning hints</em> whatever information Agent will send to Coordinator in this negotiation at step #1.</p><p>Perhaps suffice to say here that there exists a baseline heuristic that doesn&#8217;t require any negotiation and should work at least as well as the read path with open table formats (Parquet, Hudi, or Delta Lake): Coordinator can size the total number of partitions that it returns to Agent to <em>approximately</em> match the number data segments that pass the table processing plan&#8217;s filter. These partitions could correspond to data segments one-to-one, or group together approximately N data segments whereas approximately 1/Nth of each data segment&#8217;s rows are selected. As was noted above, this &#8220;alternative partitioning&#8221; could be motivated by the grouping or time-based aggregation in the table processing plan.</p><h4><strong>Partition locations</strong></h4><p>For every partition, Coordinator returns not a single Server location, but several locations that can serve that partition. This is possible if the database&#8217;s serving replication factor is greater than one.</p><p>Returning several locations enables Agent to optimise the physical placement of Clients and load distribution between Servers. Coordinator does not know how to optimally distribute the load between Servers yet because Coordinator doesn&#8217;t know the details of the overall distributed job that Agent is doing (the Read job that is the subject of Table Read protocol is a part of this overall job, but perhaps not the only one). In turn, these details may not be determined by Agent before it receives the partition breakdown and Server locations from Coordinator, so Agent cannot pass all the necessary information to Coordinator at step #1. See the section &#8220;Agent&#8217;s logic&#8221; below for further discussion.</p><p>Coordinator returns <em>serving hints</em> alongside each location. Serving hints could be specific for each unique partition&#8212;(Server) location pair, not just location alone. Serving hints could include:</p><ul><li><p><em>Performance priority hint</em> can define the order among locations that Coordinator deems optimal. This may be informed by</p><ul><li><p>The data sorting and indexing may be different in different locations and thus more or less conducive to their parent slice processing plan (and the expected additions to these plans with grouping columns at step #3).</p></li><li><p>The extra costs: a location could point to a serverless function (e.g., AWS Lambda) that will pull the partition data from the object storage (e.g., S3). The interaction with this location will cost extra money for both serverless runtime and object storage access. Still, this could be a viable fall-back location if the &#8220;primary&#8221; Servers fail, or cannot sustain the Read job&#8217;s bursty bandwidth requirements.</p></li><li><p>The maximum bandwidth limit that the Server will cap this client or this Read job with. As noted above, the database may intentionally limit the IO resources that can be consumed by demands from external clients.</p></li><li><p>Current load of the Server, if known to Coordinator.</p></li></ul></li><li><p><em>Server-side processing behaviour</em>: whether the Server <em>always accepts</em> execution of the corresponding processing plan (as sent to it at step #4), <em>always refuses</em> execution (e.g., if this is a &#8220;thin&#8221; Server that doesn&#8217;t have the resources for any non-trivial processing), or <em>dynamic</em>: the Server accepts or refuses execution based on the current load of the Server at the moment of the request from Client (step #4).</p></li><li><p><em>Serving parallelism limit</em>: the maximum number of partitions the Server can serve concurrently to all Clients within this Read job.</p></li></ul><h3><strong>Agent&#8217;s logic</strong></h3><p>Agent determines which partitions each Client should request and consume from Servers based on the overall processing job that it is doing. This overall job may be equal to the Read job which is the subject of Table Read protocol interaction, or the Read job could be just a part of a bigger, distributed (cross-database) join, a broadcast join, or something else. Then,</p><p><strong>For each Client:<br></strong><code>3. Agent &#8594; Client:<br>&nbsp;&nbsp;[ (slice processing plan,<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[partition: (filter, locations, consumption token),]), ]</code></p><p>The lists of partitions for the specific slice (identified by slice processing plan here) that Agent sends to different Clients shouldn&#8217;t necessarily include <em>all</em> partitions for the given slice as Coordinator sent them to Agent at step #2. Indeed, in many Read jobs, these lists of partitions in multi-partition slices will be reduced to just one specific partition sent to each Client. Consider the example that was used above, in which Coordinator receives the table processing plan with a grouping on a column that is not a part of table&#8217;s partitioning key on the database side. Thus, Coordinator pushes back this plan and returns a single slice with many partitions. Upon receiving such a slice and partition breakdown and faced with the need to perform grouping and aggregation on the client side, Agent sends the partitions to different Clients that will just shuffle the rows by the grouping column. Agent also arranges that the shuffled rows are consumed by another stage in the processing pipeline that does the final aggregation.<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-7" href="#footnote-7" target="_self">7</a></p><p>Agent may throttle sending these requests to Clients rather than doing them in one burst if doing the latter would predictably saturate the serving parallelism limits of some of the Server locations.</p><p>If the client and server sides share the resource manager, and Agent spawns or selects Clients specifically for this Read job, Agent should use the information about Server locations for network-aware scheduling.</p><p>When sizing memory and CPU resources for Clients, Agent should also take into account the server-side processing behaviour of the Servers each Client is going to consume data from: that is, if Servers <em>always accept</em> the slice processing plan, Clients are guaranteed to use fewer resources than if Servers <em>always refuse</em> processing or have <em>dynamic</em> behaviour.</p><p>Agent could also modify Server location&#8217;s serving hints when Agent sends it to different Clients. Imagine 100 Clients do broadcast join and each Client needs to consume the same partition. Coordinator indicated that two Server locations can serve this partition. Agent can then explicitly modify priority hints of the two locations sent to Clients such that exactly 50 Clients think that one Server is preferable, and 50 Clients think that another Server is preferable. This is needed because Clients don&#8217;t communicate and coordinate with each other in Table Read protocol. Coordinator may have indicated that these two servers have equal priority. Absent of Agent&#8217;s tie-breaking, Clients may only select Server locations with equal priority at random, but this may skew the load of Servers unnecessarily.</p><p>Another reason to modify Server&#8217;s priorities (as sent to different Clients) is to ensure that no Server will hit its serving parallelism limit, at least in the &#8220;no failure case&#8221;, that is, when all Servers respond to Clients&#8217; requests and the load is <em>not</em> redistributed to the remaining Servers.</p><p>For the description of the <em>consumption token</em>, see the section &#8220;Preemption of partition consumption&#8221; below.</p><h3>Client&#8217;s logic</h3><p><strong>Steps 4-9 determine the exact Server each Client is going to consume each partition from.</strong> In these steps, Clients and Servers also determine whether the slice processing plan will be executed on the server or the client side.</p><p>Steps 4-9 are embedded in somewhat complicated asynchronous logic, executed on each Client. This complexity addresses the need to handle dynamic server-side processing behaviour, rejections, Server unavailability, and backoff due to exceeded serving parallelism limits.</p><pre><code>location_queue = new concurrent queue&lt;(location, partition)&gt;

Upon receiving the step #3 or step #9 request from Agent:
    for every received (slice_processing_plan, partitions):
        for partition in partitions:
            partition.processing_plan = slice_processing_plan
            partition.try_server_side_processing = true
            partition_queue.add(partition)
    
consumer_queue =
  new concurrent queue&lt;(partition, location, consumer info, plan)&gt;
partition_queue = new concurrent queue&lt;partition&gt;

async for every (location, partition) from location_queue:
    if partition.try_server_side_processing and \\
      location.serving_hints.server_side_processing_behaviour != Always Refuse:
        server_side_plan = partition.processing_plan
        my_plan = no_processing
    else:
        server_side_plan = no_processing
        my_plan = partition.processing_plan
    <strong>4. Client &#8594; Server (identified by location):
      partition.filter, server_side_plan, partition.consumption_token,
      consumer_hints</strong>
    <strong>5. Client &#8592; Server:
      status: Processing Accepted | Processing Refused |
        Serving Rejected | On Hold,
      consumer_info</strong>
    if Processing Accepted:
        consumer_queue.add(
          (partition, location, consumer_info, my_plan))
    else:
        if Processing Refused:
            partition.locations[location].refused = true
        elif Serving Rejected, or Server didn't respond:
            // Try with another candidate Server.
            partition.locations.remove(location)
        elif On Hold (if Server reached its serving parallelism limit):
            // Try with another candidate Server, or wait before a retry
            //   if there are no other Servers.
            partition.locations[location].on_hold_backoff_period = ...
        partition_queue.add(partition)

async for for every partition from partition_queue:
    if all(map(partition.locations, lambda loc: loc.refused)):
        // All Servers refused to do the processing on their side,
        //   now ask them again without imposing any non-trivial plan.
        partition.try_server_side_processing = false
    location = ... (Select a priority location for this partition
      that hasn't rejected serving yet and hasn't refused the slice
      processing plan (if any), while respecting locations' "On Hold"
      backoffs.)
    if location:
        location_queue.add((location, partition))
    else:
        <strong>6. Client &#8594; Agent: partition.filter, partition.processing_plan</strong>
        // Steps 7-9 repeat steps 1-3 on the scope of this specific
        //   partition's filter and parent slice processing plan:
        <strong>7. Agent &#8594; Coordinator:
          partition.processing_plan &amp; partition.filter, ...
        8. Agent &#8592; Coordinator: ...</strong> // See step #2
        <strong>9. Agent &#8594; Client(s): ...</strong> // See step #3
        // Then Client(s) that received step #9 requests execute the
        //   "Upon receiving the step #3 or step #9 request from Agent:"
        //   block above.
        

async for every (partition, location, consumer_info, plan)
  from consumer_queue:
    (See section "Streaming column data from Server to Client" below.)<code>
</code></code></pre><p>In step #4, Client sends to one selected Server the partition filter and the corresponding slice processing plan. Server can respond (step #5) with one of the following statuses:</p><p><strong>Processing Accepted</strong>: Server is going to execute the requested processing plan on its side. Server <em>may</em> start background disk or object storage I/O and processing plan execution immediately, expecting Client to start requesting the results soon (see steps 10-&#8230; below).</p><p>Server also <em>pins all data segments underlying the requested partition</em>, so that even if table data rebalancing is initiated in the database cluster concurrently, Server is guaranteed to keep these data segments until after the streaming of this partition&#8217;s data from Server to Client is complete. However, this partition on this Server may already become inaccessible for all other requesters, ensuring that the Server is not stuck with keeping this partition indefinitely because some requesters repeatedly request to serve it.</p><p><strong>Processing Refused</strong>: Server refuses to execute the requested processing plan because Server is CPU- or memory-bound at the moment, but Server can still serve the input columns of the table to Client. Client will try to find another Server location that won&#8217;t refuse to execute the partition plan. Client <em>must</em> be able to execute the plan on its side if all Server locations for the partition have refused executing the plan.</p><p>Server <em>must not</em> respond with &#8220;Processing Refused&#8221; if the requested processing plan is trivial (called <code>no_processing</code> in the above pseudocode block), i.e., after Client already got a refusal from all candidate Servers and now tries just to fetch the input table columns. However, if Server still wants to shed this Client&#8217;s request due to temporary overload, it can respond with &#8220;On Hold&#8221; status.</p><p><strong>Serving Rejected</strong>: Server no longer serves the requested partition. This can routinely happen if table data rebalancing has happened in the database cluster since Coordinator&#8217;s response at step #2. If all locations in Client&#8217;s list reject serving the partition or go unresponsive, Client initiates another round of fetching the partition&#8217;s Server locations from Coordinator: see steps 6-9.</p><p>Note that the database cluster (represented by Coordinator during this Read job) is not obliged to halt all cluster rebalancing operations over the entire length of the Read job. Such pinning is only needed for the specific Server&#8212;Client interaction since the Server has responded with &#8220;Processing Accepted&#8221; and until the data consumption is complete, as noted above.</p><p><strong>On Hold</strong>: Server can serve the partition, but not right now because Server&#8217;s serving parallelism limit is reached, or the Server is generally overloaded. Client can then request the partition from other locations, or from the same Server after some backoff period. (Note: the exact back-off logic is not detailed in the above pseudocode.)</p><h4><strong>Consumption structure: column groups</strong></h4><p>If Server returns &#8220;Processing Accepted&#8221; at step #5, it also returns <em>consumer info</em>. Consumer info specifies how result columns can be consumed by Client from Server. Consumer info can have the following data type:<br><code>[column group:<br>&nbsp;&nbsp;[column: [section: (transfer encodings, indexes),],],]</code></p><p>First, columns are arranged into one or more <em>column groups</em>. Column groups are the way for Server to indicate that some groups of columns <em>must</em> be consumed by Client in lockstep, that is, with a shared consumption offset.</p><p>Server may want to impose this limitation because there is a shared I/O or CPU processing that is needed to serve these columns, and if Client was free to consume these columns independently one after another rather than in lockstep, it would make Server either hold the I/O or CPU processing results for the whole partition in memory, which might not be even possible if the partition&#8217;s data is bigger than Server&#8217;s memory, or repeat this I/O or CPU processing multiple times.</p><p>The opposite of this is shared-nothing column I/O or processing, such as when Server&#8217;s column serving amounts to fetching these columns from files on disk in a columnar format like Parquet or Lance, and relaying the column data to Client over the network. In this case, even larger-than-memory column consumption doesn&#8217;t impose shared I/O, and columns could be consumed by Client serially, i.e., one after another (almost) as effectively as in lockstep. Then, Server can return each column nested in its own column group. Client could still consume them in lockstep if its own processing logic demands this, but is not obliged to.</p><h4><strong>Column sections and transfer encodings</strong></h4><p>Second, each column is divided into one or more <em>sections</em>, and each column section can be transferred in one <em>encoding</em> from the list of available <em>transfer encodings</em> for the section.</p><p>The whole purpose of sections is to reflect the differences in the lists of available transfer encodings (and indexes, see below) <em>across</em> sections. In turn, the point of offering Client to choose among transfer encodings is permitting transfer in the highly compressed on-disk column format, in addition to the standard <a href="https://arrow.apache.org/docs/format/Columnar.html">Arrow columnar format</a>.</p><p>Thus, as well as slices and partitions, sections are logical entities and their boundaries may <em>not</em> coincide with the boundaries of the data segments underlying the requested partition on this Server.</p><p>If Server does non-trivial processing of a column, Server is expected to return just one section for this column, offering either only one transfer encoding (Arrow), or two encodings: Arrow and a re-compression transfer encoding.</p><p>If Server does <em>not</em> process column data before serving it to Client, Server can return the list of sections corresponding to the list of data segments underlying the requested partition. Each section offers two transfer encodings: the on-disk format in which the column is stored in the specific data segment and the Arrow encoding. Client can always fall back to the Arrow encoding if it doesn&#8217;t know how to deserialise Server&#8217;s on-disk encoding for the given column section. In this case, section boundaries for the column <em>do</em> coincide with data segment boundaries.</p><p>Columns within a single group <em>must</em> have the same number of sections, and these sections <em>must</em> hold the same numbers of result rows so that streaming the column group from Server to Client can be organised with a single consumption offset, as indicated above. The exact row numbers themselves may not be known in advance, such as if Server performs row-level filtering.</p><p>Columns within different groups, however, may have different numbers of sections, or even different counts of result rows altogether. Cf. &#8220;Feature 3: Flexibility&#8221; in <a href="https://blog.lancedb.com/lance-v2/">Lance v2</a> description. This feature could be used to access columns in feature stores like <a href="https://medium.com/airbnb-engineering/chronon-airbnbs-ml-feature-platform-is-now-open-source-d9c4dba859e8">Chronon</a> and other data stores with materialised aggregations, such as <a href="https://github.com/MaterializeInc/materialize">Materialize</a> or <a href="https://github.com/risingwavelabs/risingwave">RisingWave</a>.</p><p>If Client prioritises reducing the network data transfer size over everything else, such as if this Read job exports data from the database hosted in a cloud provider that charges for egress traffic, Client may send the desired (highly compressed) column encodings as a <em>consumer hints</em> at step #4, and Server may agree to perform this re-compression on its side by offering these transfer encodings back, alongside the on-disk and Arrow encodings.</p><h4><strong>Column indexes</strong></h4><p>Apart from different transfer encodings, Server may also offer Client to transfer some of the available indexes for each column section, such as inverted index, Bloom filter, geo-index, etc. (see examples of <a href="https://docs.pinot.apache.org/basics/indexing">Apache Pinot&#8217;s indexes</a>), provided that Client knows how to deserialise (access) and use them.</p><p>Arrow&#8217;s <a href="https://arrow.apache.org/docs/format/Columnar.html#dictionary-messages">Dictionaries</a> for dictionary-encoded columns can be treated as a kind of index, too, so that Client can skip downloading the dictionaries for some columns if Client doesn&#8217;t need them.</p><p>The option to transfer indexes alongside column data is also useful for table or database replication systems that can be built on top of Table Read protocol.</p><h4><strong>Column sections vs. partitions</strong></h4><p>The notion of column sections may appear to duplicate the notion of partitions themselves: why not mandate that each partition spans <em>at most</em> one data segment (or a fraction of a data segment) that ensures that each partition can have only one <em>list</em> of available transfer encodings and one <em>list</em> of available indexes, obliterating the need for sections?</p><p>I kept column sections in the protocol to leverage databases with <a href="https://streamnative.io/blog/introducing-oxia-scalable-metadata-and-coordination">Oxia</a>-based (or &#8220;Oxia-style&#8221;) metadata management, that is, databases in which <em>detailed data segment&#8217;s metadata is co-located on Servers with the data segments themselves</em>. In such systems, Coordinator doesn&#8217;t hold most of the metadata and even the specific data segment boundaries that appear on the Servers, and <em>partitions are not only Table Read protocol-introduced logical unit of table data but also the database&#8217;s own internal unit of table data distribution</em>, more coarse than data segments.</p><p>I don&#8217;t know of any database that uses Oxia in particular, yet. Some databases may already have Oxia-style metadata management, but I&#8217;m not sure. In any case, I&#8217;d argue that this style of metadata management would make a lot of sense for scalable OLAP data warehouses: storing all metadata in ZooKeeper is a known scalability bottleneck of Apache Druid and Apache Pinot, for example, among other systems. So, I expect more databases to adopt Oxia-style metadata management in the future.</p><h3><strong>Streaming column data from Server to Client</strong></h3><p><strong>Executed on each Client:</strong></p><pre><code>async for every (partition, location, consumer_info, plan)
  from consumer_queue:
    <em>// Sequentially, async, or in parallel:</em>
    for every column_group in consumer_info:
        num_sections = len(column_group[0])
        <em>// Sequentially only!</em>
        for section_number in range(num_sections): 
            per_column_transfer_encodings =
              map(column_group, lambda col: ... (Select the transfer
                encoding among the options, based on Client's priorities
                (speed vs. transfer size) and what it <em>can</em> decode.))
            indexes_to_transfer =
              ... (Select what Client needs for its plan.)
            <strong>10. Client &#8594; Server:
              group.id, section_number, row_offset,
              per_column_transfer_encodings, indexes_to_transfer</strong>
            <strong>11-... Client &#8596; Server:
              data plane characteristics negotiation</strong> // Multiple steps
            <strong>1X-... Client &#8596; Server:
              async streaming of Arrays w/ flow control</strong> // Many steps
        async apply the plan and the downstream logic imposed by Agent
          (out of scope of Table Read protocol) to the accumulated
          column data; depending on the downstream needs, this may also
          be outside of the (parallel)
          "for every column_group in consumer_info:" block,
          and applied to all column groups in lockstep.<code>
</code></code></pre><p>Steps 11-&#8230; constitute a generic <a href="https://github.com/apache/arrow/issues/43762">streaming protocol for columnar data</a> that I designed specifically for this Table Read protocol because Arrow <a href="https://arrow.apache.org/docs/format/DissociatedIPC.html">Dissociated IPC</a> appeared too <em>ad hoc</em> to me. Dissociated IPC protocol is also just a couple of months old, so I&#8217;m not breaking some established convention here. But the rationale and functionality of this proposed streaming protocol are the same as of Dissociated IPC: enable packing server-side streams of (Arrow) Arrays into contiguous regions of memory on Client, ready for parallel processing, e.g., on GPU.</p><p>Another objective of the new streaming protocol for columnar data is to be flexible enough to accommodate non-Arrow-encoded columns, such as those that are permitted by different column transfer encodings (see discussion in the previous section).</p><p>Note that each column group&#8217;s <em>section</em> is an independent streaming protocol interaction between Client and Server, with independent flow control. This is because different sections&#8217; column transfer encodings may result in different data plane configurations in the streaming protocol.</p><p>Client <em>must not</em> request sections within a column group concurrently, only sequentially. Server may decline a streaming protocol interaction if another interaction (with the previous section number) is still in progress. This is the memory control provision for the server side. If the client side needs more transfer parallelism, Agent may request that as a partitioning hint at step #1 above to begin with, and Coordinator <em>may</em> respond with smaller partitions.</p><p>Client <em>may</em> consume different column groups concurrently, although as an extra resource-controlling measure, perhaps Server may add to <code>consumer_info</code> at step #5 an indicator that column groups must also be consumed by Client only sequentially. If Server permits concurrent consumption of column groups, Client <em>may</em> consume them in lockstep because the streaming protocol uses application-level flow control embedded in Client&#8217;s code, rather than transport-level or otherwise &#8220;hidden&#8221; flow control. This idea is inherited from <a href="https://rsocket.io/about/faq">RSocket</a> and <a href="https://reactivex.io/">Reactive Streams</a>.</p><p>Transfer semantics of <em>indexes</em> (see the section &#8220;Column indexes&#8221; above) are equivalent to transfer semantics for <a href="https://arrow.apache.org/docs/format/Columnar.html#dictionary-messages">DictionaryBatches</a>: see the discussion of DictionaryBatches in the <a href="https://github.com/apache/arrow/issues/43762">streaming protocol description</a>. In fact, Dictionaries themselves are treated just as a specific kind of index.</p><p>The <code>row_offset</code> that Client sends to Server at step #10 is a provision for Table Write protocol, which is based on Table Read protocol. For Read jobs that are not parts of Table Write protocol&#8217;s interactions, <code>row_offset</code> always equals 0.</p><h4><strong>Data segment-wide buffer tagging and transfer deduplication</strong></h4><p>The transfer of <em>data segment-wide buffers</em> in the style of <a href="https://blog.lancedb.com/lance-v2/">Lance v2</a> (called &#8220;file-wide buffers&#8221; there) may need to be deduplicated across different column groups. It should be relatively straightforward to implement tagging and transfer deduplication for such buffers, for example, by off-loading their transfers a separate &#8220;synthetic stream&#8221; (see &#8220;mode 4&#8221; in the <a href="https://github.com/apache/arrow/issues/43762">streaming protocol for columnar data</a>, and the section on &#8220;multiplexing&#8221;). Client can then check if it still holds a copy of this buffer, and skip its transfer if yes.</p><h3>Availability, consistency, and resilience</h3><h4><strong>Table data availability</strong></h4><p>If some portion of data segments needed for the Read job are temporarily unavailable on the database side, for example, if the only Server hosting them is restarting, Coordinator should return an <em>empty list of locations</em> for the corresponding partitions. Agent can then periodically retry step #1 with the slice processing plan specialised with the partition filter, as at step #7.</p><p>Steps 6-9 (see the section &#8220;Client&#8217;s logic&#8221; above) cover the possible partition unavailability if the database side performs table data rebalancing among Servers concurrently with the Read job.</p><h4><strong>High Availability (HA) of Agent and Coordinator</strong></h4><p>High availability, as well as progress checkpointing and crash recovery of Agent and Coordinator are out of scope for table transfer protocols. If some client or a database chooses to implement high availability or either Agent or Coordinator, respectively, these node roles might be played by distributed systems in themselves (or, a Kubernetes pod). But as far as the table transfer protocols are concerned, they are single nodes, however.</p><p>By default, a crash of either Agent or Coordinator entails a failure of the Read job. Agent and Coordinator should check each other for aliveness, and terminate all protocol interaction&#8217;s activities and resources from their side (client or server side, respectively) if they detect that their counterpart is down.</p><h4><strong>Read consistency</strong></h4><p>Support for read consistency in the face of failing partition requests (due to table data rebalancing on the database side) and failing Clients can be layered on top of the above description of Table Read protocol. At step #2, Coordinator may augment all slice processing plans with a special predicate that ensures that a certain snapshot of table data is read. This special predicate may be implemented as a <a href="https://substrait.io/extensions/">Substrait extension</a> if the server side&#8217;s table consistency model lays outside of table semantics, or simply as an extra filter a-la <code>row._last_updated &lt; $TIME</code> if this is the database&#8217;s approach to consistent reads.</p><p>More sophisticated distributed databases may use a <a href="https://en.wikipedia.org/wiki/Vector_clock">vector clock</a> with MVCC sequence versions rather than a simple scalar time. If the vector clock is too huge to pass around Clients and Servers, Coordinator may generate a shorthand &#8220;id&#8221; for this vector clock specifically for this Read job. However, with such a design, Servers should dereference this &#8220;id&#8221; upon receiving requests at step #4 from Clients, which also takes extra time.</p><p>Regardless of the server side&#8217;s consistency model, all the steps after step #2 in this Read job just propagate the slice processing plans downward without touching the parts they don&#8217;t understand, including these predicates for read consistency.</p><p>Upon receiving the step #7 request from Agent, Coordinator recognises that the requested table processing plan already includes the read consistency predicate, thus realising that this is a retry request, and maintains the predicate in the processing plan(s) returned at step #8.</p><p>For read consistency to be maintained at step #8, Coordinator must prepare its response wrt. a <a href="https://en.wikipedia.org/wiki/Serializability">serlializable</a> metadata view, that is, the mapping between Servers and data segments that they host. This requirement is trivially satisfied if Coordinator is a single node, but is more demanding if Coordinator is a distributed system itself (see the previous section). Most open-source databases use <a href="https://zookeeper.apache.org/">ZooKeeper</a> to ensure this. <a href="https://streamnative.io/blog/introducing-oxia-scalable-metadata-and-coordination">Oxia</a> also offers similar guarantees.</p><h4><strong>Preemption of partition consumption</strong></h4><p>If Agent loses the connection to a Client that is in the process of consuming a lot of data from the server side, assumes the Client dead, and respawns a new Client to do the same consumption, while the original Client is actually still alive and keeps consuming data from Servers, this &#8220;accidental overprovisioning&#8221; of Clients endangers Servers&#8217; serving parallelism limits and may make the &#8220;secondary&#8221; Client(s) predictably fail due to timeouts, and either fail the entire Read job along with it or at least make the Read job several times longer.</p><p>To prevent this failure scenario, Agent should generate a &#8220;consumption token&#8221; for each Client&#8212;partition pair and send them to Clients at step #3. When Agent assumes some Client is dead and respawns a new Client, it creates new tokens that refer to the dead Client&#8217;s tokens as &#8220;parents&#8221;. Then, if Server receives requests (step #4) with new tokens, it immediately aborts the partition data processing and streaming associated with parent tokens, thus freeing the necessary resources.</p><p>Consumption tokens could also be used to implement workload re-distribution (&#8221;stealing&#8221;) from slow Clients or Servers. This problem may be a result of data skew.</p><h3>Table Read protocol: implementation notes</h3><p>Table Read protocol&#8217;s implementation complexity could be partially mitigated by creating libraries for certain operations that different node roles should perform, particularly surrounding Substrait plan wrangling. It should be possible to implement these functions only once by using Rust to implement the logic and FlatBuffers to pass Substrait plans across the language boundary in Java, C++, or Go runtimes from and to Rust.</p><p>Default implementations of the <a href="https://github.com/apache/arrow/issues/43762">streaming protocol for columnar data</a> could be derived from <a href="https://rsocket.io/about/implementations">RSocket implementations</a>.</p><h2>Table Read protocol overview and comparison with Arrow Flight</h2><p>In this section, I summarise the differences between Table Read protocol and Arrow Flight. This section doesn&#8217;t add new information about the protocol over the &#8220;Table Read protocol walkthrough&#8221; above. For the differences in scope between Table Read (and Table Write) protocol and Arrow Flight, see the section &#8220;Cross-cutting and out-of-scope concerns&#8221; above.</p><p>Table Read protocol makes load distribution (both on the client and server sides), reliability, awareness of/readiness to table data redistribution in the database, network data transfer optimisation, and database-side resource (CPU, memory, disk I/O, network I/O, etc.) management explicit, first-class concerns.</p><p>This enables flexible layering of other protocols and systems on top of Table Read protocol. Table <em>Write</em> protocol is the foremost example: it leverages the properties of Table Read protocol (wrt. load distribution, reliability, and other concerns) to provide efficiency and <em>exactly once</em> writing guarantees. I will describe Table Write protocol in the next article (spoiler: client and database sides are swapped, and the database nodes consume &#8220;partitions to be written&#8221;).</p><p>Table Read protocol&#8217;s amenability to composition is due to these concerns (load distribution, reliability, resource management, etc.) <em>shared</em> between the client and the server sides in the Read job.</p><p>On the surface level, Arrow Flight is simpler than Table Read protocol, but for achieving the same properties as Table Read protocol wrt. load distribution, reliability, etc., a lot of complexity should be encapsulated on the database side. In fact, cooperative system design allows achieving these properties using simpler techniques. Therefore, the database-side complexity for implementing &#8220;resilient Arrow Flight&#8221; should be even greater than the complexity of Table Read protocol, described above. So, this (relative) simplicity of Arrow Flight is deceptive.</p><p>Moreover, achieving some of these properties is impossible without a layer of database-specific reverse proxy nodes between &#8220;core&#8221; database nodes and Clients. Usually, only &#8220;very serious&#8221; cloud-native data warehouses such as BigQuery, Redshift, Azure Synapse, or Snowflake have such proxies in their design, and most open-source OLAP databases don&#8217;t have them. Also, these proxies prevent data transfer off-loading to NVLink- or InfiniBand-based RDMA protocols<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-8" href="#footnote-8" target="_self">8</a>.</p><p>I defer a comprehensive comparison of table transfer protocols with open table format-based catalogs (Iceberg, Delta Lake, and Hudi) to the <a href="https://engineeringideas.substack.com/i/148607428/table-transfer-protocols-enable-the-benefits-of-iceberg-without-its-limitations">following article</a>.</p><div><hr></div><p>Thanks to <a href="https://rilldata.com/">Rill Data</a> for sponsoring this work. Rill Data is interested in developing the open data ecosystem rather than promoting any specific database solution. <a href="https://github.com/rilldata/rill">Rill&#8217;s technology</a> is compatible with various databases mentioned in this article, including ClickHouse, Apache Druid, and DuckDB.</p><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-1" href="#footnote-anchor-1" class="footnote-number" contenteditable="false" target="_self">1</a><div class="footnote-content"><p>See &#8220;<a href="https://research.google/pubs/biglake-bigquerys-evolution-toward-a-multi-cloud-lakehouse/">BigLake: BigQuery&#8217;s Evolution toward a Multi-Cloud Lakehouse</a>&#8221; (Levandoski et al., 2024).</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-2" href="#footnote-anchor-2" class="footnote-number" contenteditable="false" target="_self">2</a><div class="footnote-content"><p>At the moment, I know only about Apache Doris and InfluxDB to implement Arrow Flight.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-3" href="#footnote-anchor-3" class="footnote-number" contenteditable="false" target="_self">3</a><div class="footnote-content"><p>Individual Servers could still push back processing to Clients on the partition level: see the discussion of <em>server-side processing behaviour</em> hint below.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-4" href="#footnote-anchor-4" class="footnote-number" contenteditable="false" target="_self">4</a><div class="footnote-content"><p>This could be additionally controlled by a boolean hint that Agent sends to Coordinator about whether the client side prefers Servers to take up this distributed processing stage, or prefers Servers to push it back to Clients.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-5" href="#footnote-anchor-5" class="footnote-number" contenteditable="false" target="_self">5</a><div class="footnote-content"><p>With a possible exception for certain window aggregation processing semantics: it may demand partition filters to &#8220;overhang&#8221; their parent slice&#8217;s filter.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-6" href="#footnote-anchor-6" class="footnote-number" contenteditable="false" target="_self">6</a><div class="footnote-content"><p>Either as primary durable storage or as disk cache for data segments durably stored in the object storage: I mentioned these different designs in the <a href="https://engineeringideas.substack.com/i/147163081/data-warehouses-designed-for-olap-manage-their-table-storage-themselves">previous article</a>.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-7" href="#footnote-anchor-7" class="footnote-number" contenteditable="false" target="_self">7</a><div class="footnote-content"><p>The interface between shuffling Clients and the second stage of such a processing job is outside of the scope of Table Read protocol.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-8" href="#footnote-anchor-8" class="footnote-number" contenteditable="false" target="_self">8</a><div class="footnote-content"><p>Excepting, perhaps, the cloud provider&#8217;s own accelerator platforms that are privy to the corresponding data warehouse&#8217;s internal APIs, such as Google&#8217;s Vertex AI (integrated with BigQuery), Amazon&#8217;s SageMaker (integrated with Redshift), etc.</p><p></p></div></div>]]></content:encoded></item><item><title><![CDATA[The future of OLAP table storage is not Iceberg]]></title><description><![CDATA[Introduction]]></description><link>https://engineeringideas.substack.com/p/the-future-of-olap-table-storage</link><guid isPermaLink="false">https://engineeringideas.substack.com/p/the-future-of-olap-table-storage</guid><dc:creator><![CDATA[Roman Leventov]]></dc:creator><pubDate>Tue, 30 Jul 2024 18:37:49 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!EJj2!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F55443e67-0a66-4164-8473-09b13a2e90ca_256x256.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2>Introduction</h2><p>In the last few years, table catalogs based on Apache Iceberg, Apache Hudi, or Delta Lake <em>table formats</em> (a.k.a. table catalog specifications) for data warehousing, embodying the <a href="https://vutr.substack.com/p/do-we-need-the-lakehouse-architecture">lakehouse architecture</a>, have been widely adopted by data teams and celebrated as a success of the open data management ecosystem.</p><p>All these table formats entirely rely on object storage services (like Amazon S3) or distributed file systems (like HDFS) for storing both the data partition files (usually in Parquet format) and the metadata about the tables and the data partitions. This alleviates table catalogs from worrying about data and metadata durability, read availability, and write availability.</p><p>However, as I detail below in this post, this way to modularise table catalogs is fundamentally limited in performance and cost efficiency relative to the architecture in which <strong>table storage is integrated with query (pre-)processing and data ingestion functionalities</strong>, such as in BigQuery, ClickHouse, Apache Doris, Apache Druid, Firebolt, Apache Pinot, Redshift, StarRocks, and other data warehouses. These limitations are especially pronounced in <em>high query volume or low query latency (&#8220;online&#8221;) </em>use cases (OLAP).</p><p>These inefficiencies increase the costs (and/or query and data ingestion latency) for all data teams that use table catalogs based on Iceberg, Hudi, or Delta Lake as &#8220;single gateways&#8221; to their data, either as higher service provider bills or increased provision requirements in self-managed setups. There are also additional drawbacks:</p><ul><li><p>In SaaS setups, the data function is exposed to service failure and service quality risks from more distinct service providers.</p></li><li><p>In self-managed setups, data teams have to manage three separate systems: the object storage (or distributed FS), the table catalog, and the data processing engine, instead of two: the data warehouse that implements all the table catalog, data ingestion, and query processing functions and, optionally, the object storage (or distributed FS) for cheaper storage of cold data.</p></li></ul><p>I suggest an <strong>open table transfer protocols</strong> functionally equivalent to <a href="https://cloud.google.com/bigquery/docs/reference/storage">BigQuery Storage APIs</a>. The protocols should be implemented by open-source OLAP data warehouses. It would make the data just <strong>as accessible from different processing engines as object storage-based table formats do</strong>. But unlike adopting these table formats, this would come at <strong>no additional cost, system risk, and operational complexity for data teams who already use some OLAP data warehouse</strong> for its performance benefits and don&#8217;t plan to migrate off of it.</p><div><hr></div><p>This post is the first part of the four-article series. In this article, I zoom into the architectural limitations of object storage-based table formats relevant to OLAP use cases.</p><p>In the <a href="https://engineeringideas.substack.com/p/table-transfer-protocols-for-universal">second article</a>, I introduce table transfer protocols and describe the design of Table Read protocol.</p><p>In the <a href="https://engineeringideas.substack.com/p/table-write-protocol-for-interop">third article</a>, I will describe Table Write protocol and table replication method.</p><p>In the <a href="https://engineeringideas.substack.com/p/table-transfer-protocols-improved">fourth article</a>, I summarise the preceding articles and discuss table transfer protocols&#8217; trade-offs relative to object storage-based table formats from the data team&#8217;s perspective. Disclaimer: I think there are few, and if the table transfer protocols was supported by data warehouses and processing engines as widely as Iceberg is supported today, most teams would choose to &#8220;unlock&#8221; the data in their OLAP data warehouse via the table transfer protocols rather than Iceberg for purely technical reasons.</p><div><hr></div><h2>Data warehouses designed for OLAP manage their table storage themselves</h2><p>All OLAP data warehouses with transparent data tiering between different types of disks and/or nodes in the cluster ClickHouse, Apache Doris, StarRocks, Apache Druid and Apache Pinot<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-1" href="#footnote-1" target="_self">1</a> have to manage their table storage<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-2" href="#footnote-2" target="_self">2</a> on top of the ordinary file system, memory management, and networking APIs in Linux. This includes taking care of data and metadata durability, read availability, and write availability at the level of the distributed system.</p><p>ClickHouse, Apache Doris, and StarRocks can also evict cold data from the primary (node-attached) disk storage to object storage or a distributed FS for storage efficiency<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-3" href="#footnote-3" target="_self">3</a>, but it doesn&#8217;t change the fact that they need to manage their tables on their own, coherently across both disk and object storage tiers.</p><p>Most other data warehouses that have a disaggregated architecture with object storage in the bottom, namely Databend, Firebolt, Amazon Redshift (with Redshift Managed Storage), and Snowflake implement read- and write-through SSD caching (e.g., <a href="https://blog.det.life/i-spent-7-hours-reading-another-paper-to-understand-more-about-snowflakes-internal-4960b2a68841">distributed ephemeral storage</a> in Snowflake) and <em>de facto</em> also have to maintain a table storage view on top of these SSD disks, even if they asynchronously store table metadata in Iceberg. The SSD cache management is pretty much equivalent to &#8220;full&#8221; table catalog/storage management, with only minor differences in replication and eviction strategies.</p><p>The performance and efficiency trade-offs between these architectural approaches in OLAP-ready data warehouses are very nuanced and application-specific:</p><ol><li><p>Transparent storage tiering between node types, disk types, and object storage (or distributed FS), as in ClickHouse, Apache Doris, and StarRocks.</p></li><li><p>Lending all data and metadata in the object storage and doing SSD caching on top, as in Databend, Firebolt, Amazon Redshift (with RMS), and Snowflake (native storage).</p></li><li><p>A custom, node-disaggregated table storage, as in BigQuery (native storage).</p></li><li><p>Synchronisation of metadata between the data warehouse&#8217;s custom metadata management system and Iceberg, as in Snowflake (with Iceberg tables managed in Snowflake catalog) and BigQuery (with BigLake-managed Iceberg tables).</p></li><li><p>Other hybrid approaches that fit neither of the above descriptions, such as in Apache Druid and Apache Pinot.</p></li></ol><p>Discussing these trade-offs is beyond the scope of this article. The point that I want to make here is that in <em>all</em> these approaches, data warehouses manage table storage themselves in one way or another rather than rely on austere object storage-based table formats and their implementations as separate services (such as Apache Hive&#8217;s Metastore, Tabular, Databricks Unity Catalog, AWS Glue Data Catalog, Dremio, etc.)<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-4" href="#footnote-4" target="_self">4</a> Otherwise, their OLAP performance and efficiency would suffer. I explain why in the next section.</p><h2>Why object storage-based table formats are inefficient for OLAP use cases</h2><h4><strong>Network IO amplification: inability to filter or pre-aggregate rows on the storage side</strong></h4><p>When a query includes a simple filter on a table column that is not a sort column in the Parquet file nor the table partition column, the object storage has to send the entire column of the Parquet file over the network to be filtered on the side of the query processing node. This is wasteful if the filter is highly selective and is simple (e.g., an equality or a numeric comparison) so it doesn&#8217;t require much of the storage node&#8217;s CPU time to apply this filter.</p><p>Read amplification also occurs when the query computes total (i.e., non-grouped) aggregates (or aggregates grouped by a low-cardinality column) such as sum, min, max, sum + count (to compute the average in the end), or <a href="https://datasketches.apache.org/">data sketches</a> for approximate quantiles, distinct count, and more. The object storage nodes cannot compute the pre-aggregation results per data partition file and then send these results to query processing nodes for the final aggregation across partitions. The data sketch structure, let alone a single numerical aggregation result is order(s) of magnitude smaller than the original column to send over the network.</p><h4><strong>Request amplification when accessing many data partition files on the same storage nodes</strong></h4><p>Often, there are many more data partition files to be processed in a query than there are query processing nodes (and storage nodes, with self-managed object storage or distributed FS). To read each partition file, a separate <em>series</em> <em>of network requests</em> should be made to the object storage (one request to read the Parquet file footer, then a separate request to read every needed column within each row group) because the query processing nodes don&#8217;t know how file&#8217;s blocks are physically placed on the object storage nodes.</p><p>This request amplification costs money on the most popular S3, GCS, and Azure Blob object storage services: they all charge for every request made to their services.</p><p>However, even if the object storage service doesn&#8217;t charge extra for each request (e.g., Wasabi), query processing nodes can still endure the overhead of opening and managing 1-2 orders of magnitude more network connections, data buffers, and query execution sub-streams that would otherwise be needed in a setup with a data warehouse-managed table storage on disks or self-managed object storage if the data was transmitted using just one network connection per each pair of storage nodes and query processing nodes that had to hand over the data for a particular query and execution topology.</p><h4><strong>The tradeoff between ingestion data latency and &#8220;small file problem&#8221; with storage amplification</strong></h4><p>The copy-on-write approach in the object storage-based table formats to updating metadata and <a href="https://www.dremio.com/blog/row-level-changes-on-the-lakehouse-copy-on-write-vs-merge-on-read-in-apache-iceberg/">copy-on-write or merge-on-read</a> approaches to updating data partitions during ingestion lead to a high write and storage amplification due to the object storage overhead of managing a lot of small files (the so-called &#8220;small file problem&#8221;) if the data engineer wants to commit data to the object storage with high frequency, e.g., once every few minutes, to make the ingested data available for querying with that latency.</p><p>Table catalogs mitigate this storage amplification with background compaction and &#8220;vacuum&#8221; procedures. These procedures themselves are relatively CPU-intensive and lead to even <em>more</em> write amplification. The latter is not a concern for almost all object storage services that don&#8217;t charge anything extra for written bytes and file deletes, but this could be somewhat of a concern in setups with self-managed object storage or distributed FS because the burden of the heightened disk write volume and file churn will fall on their shoulders. </p><p>However, even if the data team is ready to pay this write amplification price for the data ingestion latency of a few (tens of) minutes, <em>instant</em> insertion latency is completely unachievable unless stateful ingestion nodes with disks are considered by the table catalog. This cannot fit into object storage-only table format designs of Iceberg, Delta Lake, and Hudi.</p><p>This is why ClickHouse, Druid, Pinot, Doris, StarRocks, Firebolt, and other data warehouses ingest data on nodes with SSD disks (making these inserts queryable instantly) and manage batching, indexing, and compaction of the data partitions into columnar format (stored also on disks, or in object storage) asynchronously. This is also why Snowflake has ultimately added <a href="https://docs.snowflake.com/en/user-guide/tables-hybrid">hybrid tables</a>. Object storage-based table catalogs are blind to this freshly ingested data by design.</p><h2>Object storage-based table formats miss the innovations in file formats for data partitions</h2><p>There is a lot of innovation in the space of file formats for columnar data partitions: see <a href="https://www.youtube.com/watch?v=bISBNVtXZ6M&amp;ab_channel=VeloxCon">Nimble</a>, <a href="https://blog.lancedb.com/lance-v2/">Lance</a>, <a href="https://github.com/maxi-k/btrblocks">BtrBlocks</a>, <a href="https://github.com/spiraldb/vortex">Vortex</a>, not to mention internal file formats of ClickHouse, Doris, Druid, Pinot, StarRocks, and other data warehouses that also steadily improve.</p><p>Apart from &#8220;mundane&#8221; improvements in the file layout for columnar data and skip indexing that permits reading as few file blocks as possible, the new file formats innovate on new column data types and encodings, such as for vector embeddings. These file formats also have first-class support for secondary indexes, such as inverted/bitmap, full-text, vector, geo, or star-tree indexes. These indexes deliver the most benefit in use cases with a high volume of (OLAP) queries of a particular kind, such as those generated by interactive analytics, text search, geo search, and AI apps.</p><p>Secondary indexes in data partition files also synergise with storage-side filtering and pre-aggregation (as discussed in the section &#8220;Network IO amplification&#8221; above) because secondary indexes reduce the CPU and memory requirements of these pre-computations and thus permit storage nodes (which can be relatively CPU- and memory-poor) to do more queries with such pre-computations in parallel.</p><p>Note that the argument in this section is not purely technical, and is not about using object storage per se. Data warehouses can benefit from innovative data partition file formats even for the cold data that is stored in the object storage rather than on the disks attached to the data warehouse&#8217;s nodes.</p><p>Rather, this argument is about the fact that object storage-based table formats are forced to make the data partition file formats the parts of their specifications.</p><p>Although the &#8220;big three&#8221; table formats allow some flexibility in data partition file formats, that is, choosing between Apache Avro, ORC, and Parquet, they couldn&#8217;t easily add new formats to this list because the ability to read these new formats should be supported by all processing engines separately rather than just the table catalog implementations. Many processing engines would lag in adding support for these new file formats. This would undermine the original selling point of the table formats, namely, unlocking the table data for querying from arbitrary processing engines in parallel to the primary data warehouse.<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-5" href="#footnote-5" target="_self">5</a></p><p>In practice, even if Iceberg, Hudi, or Delta Lake eventually add new data partition file formats (such as Nimble), it will take a lot of time in discussions among the numerous stakeholders of these table formats.</p><p>I don&#8217;t imply that new things should be added hastily to open-source table formats on which a lot of stakeholders depend. Unfortunately, on-disk format specifications necessarily move very slowly.</p><p>However, a table transfer <em>network protocol</em> would be a more compact interface that can nevertheless benefit from the innovation in the storage layer, while also <em>enabling</em> this innovation by abstracting from storage layout concerns, as I describe in the <a href="https://engineeringideas.substack.com/p/table-transfer-protocols-for-universal">second part</a> of this three-article series.</p><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-1" href="#footnote-anchor-1" class="footnote-number" contenteditable="false" target="_self">1</a><div class="footnote-content"><p>Apache Druid and Apache Pinot delegate to the object storage for the durability of &#8220;historical&#8221; data partitions but ensure read and write availability, as well as the durability of freshly ingested data on their own.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-2" href="#footnote-anchor-2" class="footnote-number" contenteditable="false" target="_self">2</a><div class="footnote-content"><p>I use the term &#8220;table storage&#8221; here rather than &#8220;table catalog&#8221; because few of these data warehouses explicitly encapsulate the functions of table catalogues (such as Iceberg) in an internal component or abstraction. Rather, the realisation of these functions is speared across the data warehouse internals and is intertwined with the implementation of query execution, resource management, and other things that data warehouses do. This lack of encapsulation and, therefore, the lack of (process) isolation of the table storage abstraction is not an issue in itself, except in very exotic situations such as the data warehouse failing cluster-wide due to a &#8220;poison pill&#8221; query. If the data warehouse was to implement the open table storage protocol that I propose in the second part of this two-article series, it would naturally introduce this table storage abstraction at least on the level of their source code organisation.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-3" href="#footnote-anchor-3" class="footnote-number" contenteditable="false" target="_self">3</a><div class="footnote-content"><p>Object storage and distributed file systems apply <a href="https://en.wikipedia.org/wiki/Erasure_code">erasure coding</a> to achieve &lt;1.5x storage overhead for durability. In all open-source data warehouses with disk-based storage that I know of, erasure coding is not implemented (<a href="https://github.com/ClickHouse/ClickHouse/issues/2804#issuecomment-410338530">and is probably impractical because it also involves query performance trade-offs</a>) and a simple replication scheme is used. This entails 2x or 3x storage overhead.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-4" href="#footnote-anchor-4" class="footnote-number" contenteditable="false" target="_self">4</a><div class="footnote-content"><p>An example of the latter, &#8220;table catalog-first&#8221; architecture is Redshift Spectrum (or Redshift Serverless) + AWS Glue Data Catalog for managing Iceberg tables + AWS S3 for storing Iceberg data and metadata. If this approach was performance-optimal and delivered acceptable latency in OLAP use cases, there would be no need for the Redshift Manage Storage offering.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-5" href="#footnote-anchor-5" class="footnote-number" contenteditable="false" target="_self">5</a><div class="footnote-content"><p>This concern would be somewhat alleviated if a lot of these query engines converged on using <a href="https://datafusion.apache.org/">Apache DataFusion</a> as an embedded library for storage access. Then, only this library would need to promptly add support for reading the new data partition file formats.</p><p></p></div></div>]]></content:encoded></item><item><title><![CDATA[simplicity/acc: Why We Must End Human Programming Jobs]]></title><description><![CDATA[Software engineers often gravitate towards projects with minimal non-software components and minimal direct interaction with the real world.]]></description><link>https://engineeringideas.substack.com/p/simplicityacc-why-we-must-end-human</link><guid isPermaLink="false">https://engineeringideas.substack.com/p/simplicityacc-why-we-must-end-human</guid><dc:creator><![CDATA[Roman Leventov]]></dc:creator><pubDate>Mon, 15 Jul 2024 17:33:09 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!EJj2!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F55443e67-0a66-4164-8473-09b13a2e90ca_256x256.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Software engineers often gravitate towards projects with minimal non-software components and minimal direct interaction with the real world. This tendency, akin to searching for lost keys under a streetlight, stems from their desire to avoid real-world bottlenecks and business risks that can leave them feeling idle or powerless to influence the fate of the product they are working on.</p><p>It's well-documented that the financial industry has grown disproportionally and its present GDP share is much bigger than its actual contribution to the economy. However, this over-bloated financial industry still fails to protect the economy from major crises, such as the Great Recession of 2007-2008.</p><p>I'd conjecture that the same happens with software.</p><p>Nathan Marz of <a href="https://redplanetlabs.com/">Red Planet Labs</a> suggests radically simplifying the development of scalable web apps (by 100x in terms of software engineering effort, while also generally making systems more reliable and efficient) by cutting through <a href="https://blog.redplanetlabs.com/2024/01/09/everything-wrong-with-databases-and-why-their-complexity-is-now-unnecessary/">bloated and over-complicated database programming paradigm</a>. Software engineers don't seem to be overly excited about this. These developments can reduce a lot of well-paid software engineer jobs at large companies. Software engineers act as bureaucrats who hold to their power by retaining the headcount.</p><p>This &#8220;bureaucratisation&#8221; of the software industry may seem like a (relatively) benign way to distribute resources in the economy. This is how banks have established and grown their compliance departments in part as a &#8220;social responsibility&#8221; response, to employ a lot of accountants and other back-office workers whose jobs became unnecessary with the computer automation of finance and accounting operations in the 1990s.</p><p>Alas, bloated, inefficient, unreliable, wicked software will be written by human software engineers to increase their job security. <strong>The side effect of this is that the software brings less value to its users and other stakeholders.</strong></p><p>Open-source business models also incentivise companies to create software that is difficult to operate because then these companies can sell their support services. Open-source software companies are also incentivised to create too complicated and/or huge service APIs (or just new interfaces, standards, and protocols, leading to the fragmentation of standards) to lock in their customers by making it harder for competitor companies or open-source enthusiasts to re-implement these APIs.</p><p>To be clear, I don&#8217;t claim that professional programmers always write software as complicated and bloated as possible and are not motivated by the real-world value of their products. This would be absurd. Of course, many programmers care about the elegance and simplicity of the software they are creating. I also don&#8217;t think that most programmers overcomplicate software consciously and deliberately.</p><p>Creating <em>ideally simple</em> software for the task, i.e., with no <a href="https://en.wikipedia.org/wiki/No_Silver_Bullet">accidental complexity</a> at all, requires a lot of cognitive effort in itself which may be impractical to expend, given the expected lifetime of the software. So, practically created software is expected to have a little accidental complexity.</p><p>However, at the end of the day, it appears that the vast majority of software systems (created by human programmers today) are significantly overcomplicated beyond that optimum. And many important systems are over-complicated astronomically.</p><p>So, regardless of whether this should be explained by bad incentives or simply cognitive limitations of human programmers (creating simple software requires thinking a little harder), I argue that <strong>we, human software engineers should replace ourselves with AI software engineers as soon as possible and as fully as possible.</strong></p><p>AI programming is coming. AI will be able even to make sense of large swaths of spaghetti code, scattered across dozens of files in a million-LOC codebases. AI could soon write 99% of new production code, but will not do so in certain industries, as described below.</p><h3><strong>Software-regulated industries</strong></h3><p>In areas and industries where it will be mandated that all code is still reviewed and vetted by people, such as aerospace, the hardware designs and the safety standards will likely grow only more complicated, in part because systems and software engineers (humans) assisted by AIs could &#8220;hold together&#8221; larger and more complicated designs. Safety specifications and protocols also tend to grow ever more complicated.</p><p>Apart from aerospace engineering, this may happen in nuclear, power systems, and medical device engineering. This will unlikely make this software noticeably safer and more reliable (sans significant breakthroughs in <a href="https://groups.google.com/g/guaranteed-safe-ai">AI-assisted automatic systems verification</a>), but will surely increase its development and maintenance costs.</p><p>Fortunately, this seems unlikely to happen in car autopilots, where Tesla already replaced complicated autopilot software with end-to-end NNs (i.e., <a href="https://karpathy.medium.com/software-2-0-a64152b37c35">software 2.0</a>), and regulators didn&#8217;t object.</p><h3><strong>Other industries</strong></h3><p>In the industries without software certification for safety or strong &#8220;human programmer lobby&#8221; (but there are few such industries: perhaps, OS, compiler, and database engineering), when it will become evident for the business that AI can program better than humans <em>and</em> debug software better than human <em>and</em> explain the behaviour of the software to stakeholders (including by writing pseudocode and drawing architecture diagrams if needed) better than humans, the business should eventually dismiss almost all human programmers from their jobs entirely, so that humans don&#8217;t even review the code written by AI.</p><p>I&#8217;m unsure about the strength of the &#8220;human programmer lobby&#8221; in the financial and banking industries (and not everything depends on this lobby). But it would be very unfortunate if finance and banking succumbed to the paradigm where people are required to review and vet all code, as described in the previous section.</p><p>Presently, in most software development teams, only human programmers themselves (rather than product designers, product managers, or business analysts) ultimately hold the most complete view of the functional behaviour of the software, let alone its operational characteristics. To dismiss human programmers, the model of software&#8217;s behaviour should be externalisable (e.g., to documentation), recoverable from source rather than programmers&#8217; heads, and explainable to people at any requested level of detail, all by AI. So, I think it&#8217;s a good idea to develop projects in this area, such as <strong>AI tools for generating, improving, and finding inconsistencies in software documentation, software architecture diagramming, etc.</strong></p><h3>Governing software complexity with metrics</h3><p>After the business gives up the idea that humans should understand all the code that operates the products, the complexity of their stacks should be governed by a suit of <a href="https://en.wikipedia.org/wiki/Programming_complexity#Measures">software complexity metrics</a>. I think it&#8217;s probably a good idea to develop new such metrics today.</p><p>Governing software complexity is important not just internally for the business, e.g. because hard-to-predict emergent failure modes may stem from complicated interaction of too many components, and so that AI doesn&#8217;t accidentally write software it won&#8217;t know how to fix later (cf. <a href="https://www.laws-of-software.com/laws/kernighan/">Kernighan&#8217;s Law</a>).</p><p>The users and other stakeholders of software products should also govern its complexity because, as I noted above, over-complicated software tends to be less efficient and harder to maintain and operate, i.e., have higher a total cost of ownership. Without external oversight, it will be too easy for software vendors to argue that their software has minimal accidental complexity and externalise the overhead to the users.</p><h3>Open-source software</h3><p>I expect rapid commodification in the open-source ecosystem. Open-source software vendors will lose their clout if &#8220;AI SREs/DevOps/DBOps&#8221; emerge that can operate their software as well as humans.</p><p>The software shouldn&#8217;t necessarily be no-configuration, low-configuration, and &#8220;self-running&#8221; by design: it&#8217;s fine and relatively cheap for an LLM-based AI agent to operate the software. But it&#8217;s important for the software to have a good observability harness, or perhaps even first-class thinking about the accompanying SRE agent. I think it&#8217;s a good idea to <strong>develop frameworks for creating such SRE agents for various bespoke software from source, docs, tests, and telemetry.</strong></p><p>When choosing open-source software these days, I&#8217;d recommend paying attention to the quality of its observability harness, as well as the helpfulness, understandability, and configurability of its logs, or its <a href="https://en.wikipedia.org/wiki/Instrumentation_(computer_programming)">instrumentability</a> more than before.</p><p>One of the important effects of open source software is the reduced cost of software creation thanks to the re-use of components, as well as sharing the competencies of operating certain software (such as databases) between companies, considering that growing such competencies in human operators and SREs is expensive and takes a long time.</p><p>With frameworks for building AI software operators, this should get much cheaper and faster, hence it will make more sense to more bespoke, integrated software for the needs of a particular product. At the same time, software integration permits reducing the integral complexity of the system, as Nathan Marz observes <a href="https://blog.redplanetlabs.com/2024/01/09/everything-wrong-with-databases-and-why-their-complexity-is-now-unnecessary/">here</a>.</p><p>Thus, it&#8217;s also plausible that open-source software, unlike API standards and specifications, will deteriorate. Instead, AI programmers will tend to create &#8220;collapsed&#8221; software bundles (&#8220;<a href="https://www.monolithic.dev/">monoliths</a>&#8221; if you wish) tailored for the specific task. Generally, this should be a good thing, albeit retaining some affinity to a limited number of software architecture patterns will still be important for explaining software to humans.</p><h3><strong>The reaction of human programmers</strong></h3><p>As long as human software engineers are employed by companies, they will have an incentive to grow the complexity of their software stacks for job security. Thus, <em>for the benefit of the stakeholders of these companies, they should shred human software engineers as quickly as possible.</em> This is what Musk did when he bought Twitter, but less extreme. Or perhaps, this fast reaction was the only way to perform the &#8220;surgery&#8221; and not trigger an &#8220;immune reaction&#8221; by the organisation that may have killed it.</p><p>Unfortunately, this is not for the benefit of these software engineers and their families. Furthermore, software engineers often don&#8217;t have a lot of transferrable skills.</p><p>The reaction of many software engineers will be to start their businesses to develop software products.</p><p>As per the observation at the beginning of this post, these products will be biased towards being software-centric, i.e., software for software that manages other software, thus still promoting the software bloat and excessive (suboptimal) level of competition in these software-centric areas industries such as database engineering, observability SaaS engineering, DevOps and CloudOps engineering, etc.</p><p>I don&#8217;t see a policy measure that could effectively counteract this dynamic. But <strong>everything that makes real-world-facing product engineering broadly smoother, easier, and less frustratingly slow for programmers should help</strong>, such as:</p><ul><li><p>Better and cheaper sensors and other robotic and IoT components</p></li><li><p>Open hardware standards and interfaces</p></li><li><p>Better customer feedback systems, perhaps borrowing or developing some ideas from <a href="https://pol.is/home">Pol.is</a></p></li><li><p>Temporal pattern recognition, pattern categorisation, anomaly and emergent behaviour detection AI on top of raw multimodal sensor data (video, audio, telemetry). Example: <a href="https://www.motifanalytics.com/">Motif Analytics</a>, but think about the same ideas applied to robotics, hardware products, and swarm systems analytics.</p></li><li><p>Systems for temporally joining multimodal data and metrics from different systems and sources operating at the same time and place (or used by the same company or human), with <a href="https://engineeringideas.substack.com/p/the-open-source-stack-for-decision">causal inference</a>, anomaly detection, and root cause analysis on top of these correlated data streams. This should make it easier to debug unanticipated system interference (or seize the benefit of unanticipated system synergy) in real-world deployments.</p></li></ul><p>And even something relatively extravagant, such as <a href="https://www.earthspecies.org/">decoding animal languages</a> which may create new markets of product markets for animals (I&#8217;m not joking).</p><h3>Summary: the simplicity/acc manifesto</h3><ul><li><p>Apply AI power to create simple software.</p></li><li><p>Create more a la carte tools (such as debuggers, observability, modellers, simulators, security analysers, verifiers, AI-first DevOps, CI/CD tools) to empower AI to create, maintain, and explain simple software more reliably and effectively.</p></li><li><p>Create more real-world-facing software than software-facing software.</p></li><li><p>Make it easier for system designers and developers to receive and account for the diverse feedback from the real world and the stakeholders.</p></li><li><p>Spend the software complexity &#8220;budget&#8221; on the essential complexity of accommodating diverse, interacting users&#8217; and stakeholders&#8217; needs rather than on the accidental complexity of &#8220;self-consumed&#8221; software.</p></li></ul><div><hr></div><p>P.S. Thanks to <a href="https://world.hey.com/dhh">David Heinemeier Hansson</a>, <a href="https://www.youtube.com/playlist?list=PLZdCLR02grLrEwKaZv-5QbUzK0zGKOOcr">Rich Hickey</a>, and <a href="https://x.com/nathanmarz">Nathan Marz</a> (in alphabetical order) whose writing and presentations inspired a good part of my thinking above.</p>]]></content:encoded></item><item><title><![CDATA[The two-tiered society]]></title><description><![CDATA[On AI and Jobs: How to Make AI Work With Us, Not Against Us With Daron Acemoglu]]></description><link>https://engineeringideas.substack.com/p/the-two-tiered-society</link><guid isPermaLink="false">https://engineeringideas.substack.com/p/the-two-tiered-society</guid><dc:creator><![CDATA[Roman Leventov]]></dc:creator><pubDate>Mon, 13 May 2024 07:58:55 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!EJj2!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F55443e67-0a66-4164-8473-09b13a2e90ca_256x256.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>On <a href="https://www.humanetech.com/podcast/ai-and-jobs-how-to-make-ai-work-with-us-not-against-us-with-daron-acemoglu">AI and Jobs: How to Make AI Work With Us, Not Against Us With Daron Acemoglu</a></p><p>Here is Claude.ai's summary of Daron Acemoglu's main ideas from the podcast:</p><blockquote><ul><li><p>Historically, major productivity improvements from new technologies haven't always translated into benefits for workers. It depends on how the technologies are used and who controls them.</p></li><li><p>There are concerns that AI could further exacerbate inequality and create a "two-tiered society" if the benefits accrue mainly to a small group of capital owners and highly skilled workers. Widespread prosperity is not automatic.</p></li><li><p>We should aim for "machine usefulness" - AI that augments and complements human capabilities - rather than just "machine intelligence" focused on automating human tasks. But the latter is easier to monetize.</p></li><li><p>Achieving an AI future that benefits workers broadly will require changing incentives - through the tax system, giving workers more voice, government funding for human-complementary AI research, reforming business models, and effective regulation.</p></li><li><p>Some amount of "steering" of AI development through policy is needed to avoid suboptimal social outcomes, but this needs to be balanced against maintaining innovation and progress. Regulation should be a "soft touch."</p></li><li><p>An "AI disruption reduction act," akin to climate legislation, may be needed to massively shift incentives in a more pro-worker, pro-social direction before AI further entrenches a problematic trajectory. But some temporary slowdown in AI progress as a result may be an acceptable tradeoff.</p></li></ul></blockquote><p>The prospect of a two-tiered socioeconomic order looks very realistic to me, and it is scary.</p><p>On the one hand, this order won't be as static as feudal or caste systems: sure thing, politicians and technologists will create (at least formal) systems for vertical mobility from the lower tier, i.e., people who just live off UBI, and the higher level, politicians, business leaders, chief scientists, capital and land owners.</p><p>On the other hand, in feudal and caste systems people in all tiers have their role in the societal division of labour from which they can derive their sense of usefulness, purpose, and self-respect. It will be more challenging for those "have-nots" in the future AI world. Not only their labour will not be valued by the economy, their family roles will also be eroded: teacher for their own kids (why kids would respect them if AI will be vastly more intelligent, empathetic, ethical, etc.?), lover for their spouse (cf. &nbsp;VR sex), bread-winner (everyone is on UBI, including their spouse and kids). And this assumes they will have a family at all, which is increasingly rare, whereas in feudal and caste societies most people were married and had kids.</p><p>Vertical mobility institutions will likely grow rather dysfunctional as well, akin to the education systems in East Asia where the youth are totally deprived of childhood and early adulthood in the cutthroat competition for a limited number of cushy positions at corporations, or the academic tenure in the US. If the first 30 years of people's lives is a battle for a spot in the "higher tier" of the society, it will be very challenging for them to switch to a totally different mindset of meditative, non-competitive living like doing arts, crafts, gardening, etc.</p><p>Although many people point out the dysfunctionality of positional power institutions like the current academia, governments, or corporations, the alternative "libertarian" spin on social mobility in the age of AI is not obviously better: if AI enables very high leverage in the business, social, or media entrepreneurship, the resulting frenzy may be too intense either for the entrepreneurs, their customers, or both.</p><h2>Response approaches</h2><p>I'm not aware of anything that looks to me like a comprehensive and feasible alternative vision to the two-tiered society (if you know such, please let me know).</p><p>Daron Acemoglu proposes five economic and political responses that sound at least like they could help to steer the economy and the society in some alternative place, without knowing what place that is (which in itself is not a problem: vice versa, thinking of any alternative vision as a likely target would be a gross mistake and disregard for unknown unknowns):</p><ul><li><p>Tax reforms to favour employment rather than automation</p></li><li><p>Foster labour voice for better power balance at the companies</p></li><li><p>A federal agency that provides seed funding and subsidies for human-complementary AI technologies and business models. Subsidies are needed because "machine usefulness" is not as competitive as "machine intelligence/automation", at least within the current financial system and economic fabric.</p></li><li><p>Reforming business models, e.g., a "digital ad tax" that should change the incentives of media platforms such as Meta or TikTok, and improve the mental health. Cf. <a href="https://www.heymaven.com/">Maven social network</a> without followers and likes.</p></li></ul><p>This all sounds good to me, but this is not enough. We also need other political responses (cf. <a href="https://cip.org/">The Collective Intelligence Project</a>), and new design ideas in methodology of human--AI cooperation (such as in the <a href="https://engineeringideas.substack.com/i/143489768/interlude-why-bother">business analytics space</a>), social engineering (cf. <a href="https://www.gameb.wiki/index.php?title=Game_B">Game B</a>), and psychology, as a minimum.</p><p>If you know some interesting research in some of these directions or other directions to help reach a non-tiered society that I missed, please comment.</p><p>Upd. See comments on <a href="https://forum.effectivealtruism.org/posts/DQjcCtDFiJQPyyA4i/the-two-tiered-society">EA Forum</a> and <a href="http://lesswrong.com/posts/P6LHd2Js7jGdvf4E8/the-two-tiered-society">Lesswrong</a>.</p>]]></content:encoded></item><item><title><![CDATA[The vision for AI-assisted decision-making in 3-5 years]]></title><description><![CDATA[In the previous post, I suggested a possible AI-first technological stack for (business) decision intelligence, almost not saying anything about the decision-making method itself, apart from the first paragraph where I said that it should be based on state-of-the-art decision theories.]]></description><link>https://engineeringideas.substack.com/p/the-vision-for-ai-assisted-decision</link><guid isPermaLink="false">https://engineeringideas.substack.com/p/the-vision-for-ai-assisted-decision</guid><dc:creator><![CDATA[Roman Leventov]]></dc:creator><pubDate>Thu, 11 Apr 2024 17:04:25 GMT</pubDate><enclosure url="https://substackcdn.com/image/youtube/w_728,c_limit/oEJBH5pFims" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In the <a href="https://engineeringideas.substack.com/p/the-open-source-stack-for-decision">previous post</a>, I suggested a possible AI-first <em>technological stack</em> for (business) decision intelligence, almost not saying anything about the decision-making <em>method</em> itself, apart from the first paragraph where I said that it should be based on state-of-the-art decision theories. But in reality, telling decision makers in business or public service that they should use &#8220;quantum-like Bayesian decision theory&#8221; is just counterproductive not only because these people obviously won&#8217;t treat such advice seriously and won&#8217;t have time for that, but also because people <em>already</em> use evolutionarily optimal decision theories intuitively, and it often backfires to try making well-honed intuitive processes more conscious (&#8221;rational&#8221;).</p><h3>&#8220;Behind the scenes&#8221; decision-making management</h3><p>If we don&#8217;t consider direct brain-computer interfacing (on the longer term, we must consider it, but this is out of the scope of this writing), <strong>the best way to improve human decision making is for the AI to converse with people naturally, propose and debate different options/solutions</strong>, surface various considerations and decision constraints, and discuss the risks. This conversation should not necessarily be exclusively oral: it may include phases where people or AIs prepare, read, and edit decision documents a-la Amazon&#8217;s six-pagers.</p><p>Below in this writing, <strong>I will call this concept of an AI that collaborates with people to make better decisions a </strong><em><strong>co-executive AI</strong></em><strong> (cEAI).</strong></p><p>cEAI needs to build &#8220;theories of the mind&#8221; (ToMs) of the decision makers and experts it is interacting with (while also recognising and accounting for the fundamental limitation of such mental modelling, that it will never be very accurate or complete), identify the weaknesses in the collective understanding or the main disagreements between the people who are involved in making the decision, as well as including oneself (i.e., the cEAI) into this circle, and planning the further preparation, discussion, and making the call.</p><p>Of course, this &#8220;decision-making process management&#8221; done by cEAI should be transparent to people, whether the decision makers themselves or other people who are supervising, investigating, or reflecting on the process, either in real-time or <em>post factum.</em> cEAI might itself proactively reveal some aspects of this management backstage to the decision makers if cEAI deems this will be useful in the given situation for ultimately making a better decision. But in general, <strong>during a tough decision making process, human attention should be freed as much as possible from this kind of &#8220;meta&#8221; process management and instead focused fully on the &#8220;object-level&#8221; problem at hand.</strong> Human attention is a very limited resource!</p><h3>Improving decision makers&#8217; world models</h3><p>Among other steps in the decision-making process, cEAI may conclude that some of the people involved are not familiar with some evidence or even don&#8217;t have some foundational theories or skills that are important for making reasonably informed and high-quality judgments in the given context.</p><p>The &#8220;evidence&#8221; may be some numerical facts (&#8221;What&#8217;s our customer churn and ROI in the last quarter?&#8221;) or the elements of some quantitative causal models of the problem domain (&#8221;What&#8217;s the causal relationship between individual vaccination and the risk of getting a disease?&#8221;) or anecdotal evidence: such as cEAI may recommend the decision makers to talk with the actual customers to get the feel of their experience. Note that even if cEAI has access to the recordings of the interviews with these customers and can process this anecdotal feedback much better at scale than human decision-makers, considering the ToM limitations that I mentioned above, it will generally be better to try to expose human decision-makers to as much &#8220;raw&#8221; uncompressed information as possible (which might still not be very much though, given their humanly time and information processing bandwidth constraints).</p><p>The &#8220;foundational theories of skills&#8221; could be anything from basic math (cf. the recurring proposals of making some math proficiency level at the time of the election a formal eligibility criterion for the U.S. presidency) or sciences (can people who are not professional social psychologists, demographers, or anthropologists by trade be in charge of a social policy, or simply consulting these experts or an AI that have read all the textbooks and paper on these subjects is enough?) to the mastery of the professional domain (can someone who hasn&#8217;t progressed through the rungs of an industrial company such as an automaker or a fast-food chain from the bottom be an effective leader in such a company, maybe setting aside the trust and authority aspects and focusing only on the quality of the decisions?).</p><p>There are some interesting open questions on whether some of these things are actually needed: there is a general Enlightenment-inspired idea that better education is always better for ethics and decision making, but the evidence is not black and white: for example, in <em>The Tyranny of Merit</em>, Michael Sandel points out that many of the best government leaders were <em>not</em> well-educated. In turn, this raises a reasonable counter-argument that perhaps the <em>content</em> of the traditional university education or MBA programs is not what leaders should learn.</p><p>Regardless, I think that human decision makers should at least understand the mathematical models that cEAI may suggest to use for the domain, such as regressions or differential equation models. The models that are suitable for most problem domains are not very difficult to grasp (namely, regressions and differential equation models are late middle school or early high school level of math), but in specific domains calling for more complex models, the quality of decisions may be limited by the ability of the people to understand these models. I expand on this point below in this writing.</p><p>I mention the scenario of &#8220;cEAI recommending the human to upskill or learn some theory before making a decision&#8221; to generalise the idea that to make a better judgment, humans exercise not just their business or political intuition or ethics in isolation, but the entirety of models in their heads (on all levels: <a href="https://www.lesswrong.com/posts/fqfAmAGFLKpsnjfJB/goal-alignment-without-alignment-on-epistemology-ethics-and">methodology, science, and fact</a>). These models couldn&#8217;t be discerned when the judgement is made. The &#8220;decision-making discussion&#8221; between humans and the cEAI may and should help to mutually correct the models of the world that they hold, but probably mostly on the fact and domain model levels, rather than on the basic science and methodological levels.</p><h3>Interlude: why bother?</h3><p>You may wonder at this point: if cEAI will have so much more knowledge, &#8220;reasoning compute&#8221;, attention space, and probably soon even the human theory of mind, why should businesses and governments even bother keeping humans in the loop and not delegate decision making completely to the AI?</p><p>The temporary answer that should hold for just about the next 3-5 years is that people can glue together the observations from many sources which may span across the organisational boundaries into a unified model, such as when a decision maker visits the customer&#8217;s site and talks to their employees offline. The AI alone cannot cross these boundaries very soon: at the very least, it will take at least the next 3-5 years until always-on wearable recording devices such as <a href="https://humane.com/">AI Pin</a> are adopted in business en masse. And this will take even longer than 5 years in the public sector where it will be met with much stronger resistance due to the concerns about privacy/security and the general conservatism. Replacing humans with robots altogether would also, obviously, take longer than just equipping people with small wearables.</p><p>There are other temporary answers, such as:</p><ul><li><p>Humans are better than AIs at noticing subtle patterns and clues of something going wrong from a stream of multimodal unstructured data: video/audio observations and chatting with people.</p></li><li><p>Humans are better than AIs at curiosity-driven exploration and inquiry that may lead to the discovery of these patterns from the previous item.</p></li><li><p>Humans are better than AIs in weighing multiple aspects of a decision: technical/engineering, economic, legal, PR, social, ethical, etc.</p></li><li><p>Humans are better than AIs at glueing the pieces of their world models, not only across the organisational boundaries as discussed above, but also across the different system levels: from the interpersonal relations among the team members to macro-economic and political trends.</p></li></ul><p>While probably mostly true as of 2024, I think these advantages of humans will not hold against AI for more than three years. Therefore, after that point, the AI&#8217;s decision quality will be limited by the ability to do the &#8220;leg work&#8221; to gather the multimodal unstructured data that today enables people to make better intuitive inferences and thus decisions. In other words, this is the same limitation that I noted first in this section. The AI will overcome it with the sufficient uptake of wearable recording devices, and, for non-digital businesses, with the installation of more cameras at the production and service sites.</p><p>Then it will come the turn of legal, political and economic answers:</p><ul><li><p>The laws will not change anytime soon and will maintain that only <em>humans</em> are liable for all business, public service, medical, financial, and legal decisions, and it&#8217;s absurd to hold people accountable for the decisions (made on their behalf by AI copilots) that they <em>cannot</em> understand. In turn, this will steer the market offerings of AI decision-making copilots such that they can in principle teach people the models the AI is using in decision making, save for criminal negligence due to laziness or YOLO attitude.</p></li><li><p>Even if the employee functions will effectively be reduced to carrying the AI device around and rubber-stumping its decisions, trade unions or other forces in corporate politics will prevent businesses from replacing humans in these roles with robots altogether.</p></li><li><p>Paying people salaries for doing meaningless jobs (as in the previous item) is a more effective system of economic resource distribution (and, perhaps, of social order) than replacing all people with robots that will force the governments to pay all the same people the same money via universal basic income. People on UBI may overflow all the touristic sites, become alcohol/drug/gaming addicts in unhealthy numbers, and generally be less healthy and live less happily without the constraints of a daily routine. It may take decades to transition society into the new regime in which all today&#8217;s decision-making jobs could be handed off to robots and this won&#8217;t cause sudden adverse effects for either the economy or the society.</p></li></ul><p>The first two of these three answers might plausibly play out and stall the AI proliferation in decision making for decades, though, I can also imagine that the monetary incentives will cause mass non-compliance or regulatory arbitrage and thus these restrictions will be ineffective.</p><p>But it&#8217;s still interesting to understand whether these legal and political obstacles are &#8220;accidental evil&#8221; (or an &#8220;accidental good&#8221; if we consider that they buy time for the societal transition mentioned in the third item), or they help to protect a <em>good</em> blueprint for human&#8212;AI collaboration in high-stakes decision making. After all, the laws and political decisions ultimately ought to promote and protect the <em>collective good</em> to the best of our guess, rather than to ossify historical accidents. I&#8217;m not satisfied with politically convenient platitudes from the marketing playbooks of AI startups like &#8220;we believe in empowering humans in their work rather than replacing them with AIs&#8221;.</p><p>And I think I&#8217;ve found a deep reason why <strong>we should augment human decision makers rather than replace humans with AI executives altogether: this is the only way to maintain the </strong><em><strong>relevance of human ethical judgement</strong></em><strong> and thus to keep </strong><em><strong>alignment</strong></em><strong> a meaningful target even in principle.</strong> In the absence of really high-fidelity human brain simulations, it dawned on me that it may be a category error to call various &#8220;scalable oversight/alignment&#8221; approaches <em>alignment</em> in very complex situations which no human has been able to comprehend: the humane, ethical, or &#8220;aligned&#8221; judgement may not just be unknown, it may not <em>exist</em> in this case. There is more to discuss here about how economics and society should be structured in order to make this comprehension feasible (barring breakthroughs in brain-computer interfacing), but this is out of the scope of this writing.</p><p>It remains to note in this section that <strong>we must not squander the next 3-5 years when human&#8212;AI executive teams will still have an advantage over independent AI executives (agents)</strong>: we should capitalise on this temporary edge (literally, through VC funding and technology and product development) to keep the human&#8212;AI collaboration competitive for as long as possible (cf. <a href="https://twitter.com/AndrewCritchPhD">Andrew Critch&#8217;s humane/acc</a>) to make it comparatively easier for politicians, legislators, and the public to resist to the temptation to enable an unhinged economy with AI agents.</p><p><a href="https://blog.research.google/2024/01/amie-research-ai-system-for-diagnostic_12.html">Google&#8217;s medical diagnosis system</a> outperforming human clinicians assisted by the very same system demonstrates that first, we don&#8217;t have much time left (although physiology is more &#8220;closed world&#8221; than business and public service, which makes medical decisions simpler), and second, that AIs designed to perform independently don&#8217;t become good human assistants as a byproduct: <em><strong>collaborativity</strong></em><strong> must be an explicit and key design goal of cEAI, not just interpretability</strong> (apart from accuracy, robustness, adaptability, and other usual design criteria for decision systems).</p><h3>Functions of the co-executive AI</h3><p>The best form factor for cEAI appears to be a natural-language interface accessible across different apps, a la Copilot for Microsoft 365.</p><p>Compared to the &#8220;chat with your data&#8221; wave of AIs such as Julius or Hex, cEAI could be better summarised as &#8220;<strong>chat with your problem</strong>&#8221;.</p><p>When the human initiates the discussion, <strong>cEAI understands the problem: what domain it belongs to and whether the situation requires some decision or not:</strong> per Peter Drucker, this should be the first step in every decision-making process! At this stage, the cEAI only uses textbooks about management and optionally description of the structure and the domain breakdown of the business (usually maintained in a corporate wiki).</p><p>For the given domain and the problem, <strong>cEAI builds a qualitative causal model if it doesn&#8217;t exist yet from natural-language conversations with the executive or domain experts</strong>, challenging humans&#8217; models if eEAI&#8217;s own common sense diverges from the human models. Products like <a href="http://Rainbird.ai">Rainbird.ai</a> already implement this: </p><div id="youtube2-oEJBH5pFims" class="youtube-wrap" data-attrs="{&quot;videoId&quot;:&quot;oEJBH5pFims&quot;,&quot;startTime&quot;:null,&quot;endTime&quot;:null}" data-component-name="Youtube2ToDOM"><div class="youtube-inner"><iframe src="https://www.youtube-nocookie.com/embed/oEJBH5pFims?rel=0&amp;autoplay=0&amp;showinfo=0&amp;enablejsapi=0" frameborder="0" loading="lazy" gesture="media" allow="autoplay; fullscreen" allowautoplay="true" allowfullscreen="true" width="728" height="409"></iframe></div></div><p>.</p><p>If the qualitative model is insufficient for making a decision, <strong>cEAI generates one or several quantitative models</strong> (that is, parameterisations/augmentations of the qualitative causal model) as alternative explanations for the historical data observed in the domain. This could be done with something like <a href="https://github.com/OpenCodeInterpreter/OpenCodeInterpreter">Open Code Interpreter</a> in conjunction with AutoML techniques. To make this possible, the variables from the qualitative causal model should be connected with (integrated into) the <a href="https://www.google.com/search?q=semantic+layer">semantic layer</a> of the data. The semantic layer should also include the notion of domain boundaries to limit what cEAI needs to cover with the quantitative model.</p><p><strong>For human data scientists, analysts, and decision makers, the quantitative model, even if it is getting built, represents just a part of the deeper understanding of the problem domain that people acquire when they eyeball the data points, explore various data visualisations, debug erroneous data, the code for features, or the semantic layer, and observe the performance of other models that are tried before the &#8220;final&#8221; one is chosen.</strong> If cEAI does the data science for people, it still needs to help people to build this deeper picture in their heads by <strong>creating custom &#8220;curriculums&#8221; which may consist of all the same things: data point examples, visualisations, semantic layer code or configs, model comparisons, or even small </strong><em><strong>tasks</strong></em><strong> designed deliberately to calibrate the quantitative model in people&#8217;s heads</strong>, such as prediction, estimation, and fill-in-the-blank tasks. The main difference from humans doing this on their own is that a guided learning process will take much less time for anyone who is not an extremely skilful data scientist. In terms of the implementation, the teaching part of this function is similar to existing teacher AIs such as <a href="https://khanmigo.ai/">Khanmigo</a>, but the curriculum generation part seems to be genuinely novel.</p><p>As I started to discuss in previous sections of this post, <strong>cEAI should maintain a theory of mind of the human decision maker to know when to defer to human judgement because they have access to some evidence that cEAI doesn&#8217;t</strong> or because human&#8217;s expertise is hard or impractical at the moment to communicate as an explicit causal model, and conversely, when the human judgement is different from cEAI&#8217;s likely due to human ignorance rather than their superior expertise. Further, cEAI could learn something about people&#8217;s <strong>preferences</strong> from their decisions and use this e.g. for helping multiple executives to find an agreeable solution for a problem. Although SoTA LLMs already can build surprisingly decent ToMs &#8220;intuitively&#8221; (<a href="http://arxiv.org/abs/2302.02083">Kosinski, 2023</a>), cEAI probably needs to manage these ToMs more explicitly for transparency and debuggability.</p><p>Finally, cEAI can do some downstream functions related to causal modelling and decision intelligence leveraging existing algorithms, such as inferring, augmenting, or verifying the causal graph from the data (see <a href="https://github.com/py-why/causal-learn">causal-learn</a>), detecting and explaining data anomalies (<a href="http://arxiv.org/abs/1912.02724">Janzing et al., 2019</a>), and generating solutions for a problem (see <a href="https://evolution.ml/">evolution.ml</a>).</p><h3>Simpler models are even more important for collaborativity than interpretability</h3><p>Making models simpler is good for robustness, computational efficiency, and interpretability, but it becomes even more important for cEAI&#8217;s collaborativity. Due to the opacity of the human mind to itself as well as cEAI, assessing how well humans are calibrated wrt. complicated models is impossible, and reliably teaching them to human executives also becomes almost impossible.</p>]]></content:encoded></item><item><title><![CDATA[The Open-Source Stack for Decision Intelligence]]></title><description><![CDATA[Probabilistic models are integral to state-of-the-art decision theories, such as Bayesian a.k.a.]]></description><link>https://engineeringideas.substack.com/p/the-open-source-stack-for-decision</link><guid isPermaLink="false">https://engineeringideas.substack.com/p/the-open-source-stack-for-decision</guid><dc:creator><![CDATA[Roman Leventov]]></dc:creator><pubDate>Mon, 11 Mar 2024 19:53:37 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!EJj2!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F55443e67-0a66-4164-8473-09b13a2e90ca_256x256.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>Probabilistic models are integral to state-of-the-art decision theories, such as <a href="https://www.lesswrong.com/tag/evidential-decision-theory">Bayesian a.k.a. evidential</a>, <a href="https://www.sciencedirect.com/science/article/abs/pii/S0360835221002114">quantum-like Bayesian</a>, <a href="https://plato.stanford.edu/entries/decision-causal/">causal</a>, and <a href="https://www.lesswrong.com/tag/functional-decision-theory">functional</a>/<a href="https://www.lesswrong.com/tag/updateless-decision-theory">updateless</a>/<a href="https://www.lesswrong.com/tag/timeless-decision-theory">timeless</a> decision theories. To enable widespread and inclusive adoption of these decision theories by businesses and in public service, there is a pressing need for an open-source decision intelligence stack. This stack should span from sensing (data collection) and actuation to online learning and natural-language decision assistance.</p><h2>The Decision Intelligence Stack</h2><p>The proposed decision intelligence (DI) stack can be broken down into the following levels:</p><ol><li><p>Sensors and edge devices: cameras, wearables, etc.</p></li><li><p>IoT device management, data collection and processing systems, and databases: MQTT brokers/servers, log collectors, change data capture, Airbyte, Kafka, Flink, data lake storage, Spark, Ray, ClickHouse, Rockset, Postgres, etc.</p></li><li><p>ML computing frameworks: PyTorch, JAX/Flax</p></li><li><p>Probabilistic ML algorithms for time-series and other forms of data: probabilistic <a href="https://probml.github.io/ssm-book/root.html">state-space models</a>, (Bayesian) RNNs, regression trees, VAEs, GNNs. Recent libraries like <a href="https://github.com/probml/dynamax">dynamax</a> and <a href="https://github.com/pymc-devs/pymc-bart">PyMC-BART</a> are filling the gap in perpetually developed and supported implementations of these algorithms.</p></li><li><p>DNN (mechanistic) interpretability libraries and frameworks: needed for communicating inferences to humans (via LLMs). Currently non-existent, to the best of my knowledge.</p></li><li><p>Frameworks for probabilistic inference over a system of components: Stan, <a href="https://github.com/pymc-devs/pymc">PyMC</a>, <a href="https://github.com/pyro-ppl/numpyro">NumPyro</a>. They support various approximate inference methods, including sampling-based, variational, particle-based, and <a href="https://arxiv.org/abs/2402.05098">GFlowNet-based methods</a>. See <a href="https://repository.kaust.edu.sa/server/api/core/bitstreams/89397792-401a-4f18-a964-e74eaf7eab9e/content">&#352;trumbelj et al. (2024)</a> for an overview.</p></li><li><p>MLOps frameworks for ML and probabilistic inference: Airflow-like tools integrated with PyMC or NumPyro, automatically scheduling online learning tasks when new observations are available (a-la <a href="https://github.com/probml/rebayes">rebayes</a>), and updating past states via retrospective inference.</p></li><li><p>Hyperparameter optimization/AutoML frameworks: Optuna</p></li><li><p>Causal discovery and inference libraries: <a href="https://github.com/py-why/causal-learn">causal-learn</a>, <a href="https://github.com/py-why/dowhy">DoWhy</a>, <a href="https://github.com/pymc-labs/CausalPy">CausalPy</a></p></li><li><p>Libraries of domain-specific models and probabilistic program templates: <a href="https://github.com/pymc-labs/pymc-marketing">PyMC-Marketing</a>, <a href="https://github.com/microsoft/BatteryML">BatteryML</a></p></li><li><p>Baseline knowledge bases for augmenting proprietary models: <a href="https://orkg.org/">Open Research Knowledge Graph</a>, <a href="https://www.system.com/">system.com</a></p></li><li><p>Data catalog/metadata storage to help LLMs generate probabilistic model code: OpenMetadata</p></li><li><p>LLM to generate and modify probabilistic model code, using previous model versions, results, domain knowledge, data catalogs, and public knowledge as inputs: <a href="https://discourse.pymc.io/t/i-created-a-pymc-gpt-on-openai/13612">PyMC-GPT</a> is a first step in this direction.</p></li><li><p>UI to visualize and explore data, causal models (applying DNN interpretability if needed), and counterfactual predictions. Current options include Python visualization libraries (matplotlib, seaborn, etc.), Graphviz-style causal graph visualization, <a href="https://github.com/microsoft/lida">LIDA</a> for LLM-generated visualizations, <a href="https://github.com/rilldata/rill">Rill</a> for data exploration, and <a href="https://github.com/causalens/dara">Dara</a> for causal-graph-aware visual app building.</p></li><li><p>API frontend for causal inference: frameworks like <a href="https://github.com/bentoml/BentoML">BentoML</a></p></li><li><p>Decision-making LLM that uses the (discovered) causal graph for <a href="https://github.com/RManLuo/Awesome-LLM-KG">LLM+KG reasoning</a> and causal inference API as a tool (<a href="https://github.com/lucidrains/toolformer-pytorch">Toolformer</a>-style): <a href="https://arxiv.org/abs/2402.02392">DeLLMa</a></p></li></ol><h2>Challenges and Opportunities</h2><p>While some key layers in this stack are well-populated with mature tools, many others have few actively developed options. Apart from established data processing and ML components not specific to causal inference, the layers are rarely integrated with each other.</p><p>The depth and complexity of the stack can be daunting, and it's likely that no organization in the world has implemented it in an approximately complete form. As <a href="https://causalens.com/resources/white-papers/i-need-causal-ai-now-what/">argued by causaLens</a>, it's currently impractical for organizations to weave together a stack of open-source tools for end-to-end causal inference instead of opting for a vertically integrated solution. However, this highlights the need for an accessible and well-integrated open-source stack.</p><p>Given the recent <a href="https://redmonk.com/sogrady/2024/02/07/pendulum-return/">consolidation trend</a> in the software industry, the focus should be on good integration and user experience with an opinionated, general-purpose combination of components and algorithms, rather than on configurability and flexibility. Both the <a href="https://github.com/py-why">PyWhy</a> and <a href="https://github.com/pymc-devs">PyMC</a> ecosystems, the most notable probabilistic and causal inference ecosystems in Python today, may be focusing too much on implementing diverse algorithms instead of polishing a vertically integrated experience.</p><p>Note that choosing specific components for the stack doesn&#8217;t mean cutting off possible use cases: the stack should remain broad in capability. Rather, choosing components is about removing the choice among functionally equivalent options, such as databases supporting the same query patterns, or probabilistic inference algorithms achieving approximately the same result through different means.</p><p>While the DI stack itself should be as general and broad-capability as possible, the go-to-market strategy for propelling it should initially focus on one application domain at a time. Infrastructure and application monitoring (and cost management) is an interesting choice as one of the first such domains, currently dominated by expensive SaaS platforms (Datadog, New Relic, Splunk) with a few dynamic open-source challengers (<a href="https://github.com/signoz/signoz">SigNoz</a>, <a href="https://github.com/highlight/highlight">Highlight</a>, <a href="https://github.com/coroot/coroot">Coroot</a>). Many of the higher levels of the DI stack could be omitted for infrastructure monitoring, and non-parametric models are sufficient for infrastructure performance monitoring. SigNoz and Highlight also notably share the &#8220;opinionated integration philosophy&#8221; that I recommended for the DI stack above.</p>]]></content:encoded></item><item><title><![CDATA[AI alignment as a translation problem]]></title><description><![CDATA[Yet another way to think about the alignment problem]]></description><link>https://engineeringideas.substack.com/p/ai-alignment-as-a-translation-problem</link><guid isPermaLink="false">https://engineeringideas.substack.com/p/ai-alignment-as-a-translation-problem</guid><dc:creator><![CDATA[Roman Leventov]]></dc:creator><pubDate>Mon, 05 Feb 2024 13:23:22 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!279E!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec061b10-e2cd-45fc-9cee-2e66506fce65_1222x686.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h3>Yet another way to think about the alignment problem</h3><p>Consider two learning agents (humans or AIs) that have made different measurements of some system and have different interests (concerns) regarding how the system should be evolved or managed (controlled). Let&#8217;s set aside the discussion of bargaining power and the wider game both agents play and focus on how the agents can agree about a specific way of controlling the system, assuming the agents have to respect each other&#8217;s interests.</p><p>For such an agreement to happen, both agents must see the plan for controlling the system of interest as beneficial from the perspective of their models and decision theories<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-1" href="#footnote-1" target="_self">1</a>. This means that they can find a <em>shared model</em> that they both see as a generalisation of their respective models, at least in everything that pertains to describing the system of interest, their respective interests regarding the system, and control of the system.</p><p>G&#246;del&#8217;s theorems prevent agents from completely &#8220;knowing&#8221; their own generalisation method<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-2" href="#footnote-2" target="_self">2</a>, so the only way for agents to arrive at such a shared understanding is to present each other some symbols (i.e., classical information) about the system of interest, learn from it and incorporate this knowledge into their model (i.e., generalise from the previous version of their model)<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-3" href="#footnote-3" target="_self">3</a>, and check if they can come up with decisions (plans) regarding the system of interest that they both estimate as net positive.</p><p>Per Quine&#8217;s <a href="https://en.wikipedia.org/wiki/Indeterminacy_of_translation">indeterminacy of translation</a> argument, the agents cannot access the actual <em>meaning</em> (semantics, knowledge) that they attach to the symbols that they exchange with each other, both during the &#8220;generalisation&#8221; and &#8220;decision/plan selection&#8221; steps (because decisions and plans are also communicated through symbols!) Therefore, the agents cannot know that they generalise &#8220;correctly&#8221;, <em>actually</em> <em>possess a shared model</em>, and haven&#8217;t been fooled (advertently or inadvertently) by each other.</p><p>Note that without the loss of generality, the above process could be interleaved with actual control according to some decisions and plans deemed &#8220;good enough&#8221; or sufficiently low-risk after some initial alignment and collective deliberation episode. After the agents collect new observations, they could have another alignment episode, then more action, and so on.</p><h3>Scalable oversight, weak-to-strong generalisation, and interpretability</h3><p>To me, the above description of the alignment problem demonstrates that &#8220;<a href="https://www.lesswrong.com/posts/hw2tGSsvLLyjFoLFS/scalable-oversight-and-weak-to-strong-generalization">scalable oversight and weak-to-strong generalisation</a>&#8221; are largely misconceptions of this problem, except insofar as oversight is the implementation of the <em>power balance</em> between humans and AIs<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-4" href="#footnote-4" target="_self">4</a> or the <em>prevention of deception</em> (I factored out both these aspects from the above picture).</p><p>Yes, there will always be <em>something</em> that humans perceive about their systems of interest (including themselves) that AIs won&#8217;t perceive, but this looks to be on track to shrink rapidly (consider glasses or even contact lenses that record all visual and audio to assist people). There will probably be much more information about systems of interest that AIs perceive and humans don&#8217;t. So, rather than a weak-to-strong generalisation problem, we have a <strong>(bidirectional) AI&#8212;human </strong><em><strong>translation</strong></em><strong> problem</strong>, with more emphasis on <em>human learning from AIs</em> than <em>AIs learning from humans</em>.</p><p>This is also why I think Lucius Bushnaq&#8217;s &#8220;<a href="https://www.lesswrong.com/posts/FDrgcfY8zs5e2eJDd/charbel-raphael-and-lucius-discuss-interpretability">reverse engineering</a>&#8221; agenda is stronger than the mechanistic interpretability agenda. Both are a kind of &#8220;translation from AIs to humans&#8221;, but the first aims to <em>teach humans AI&#8217;s &#8220;native&#8221; concepts</em>, whereas the latter at least to some degree tries to impose the pre-existing human belief structure onto AIs.</p><h3>More &#8220;natural&#8221; and brain-like AI</h3><p>The &#8220;translation&#8221; problem statement presented above also implies that if we care about the generalisation trajectory of the civilisation, we should better equip AIs with our inductive biases (i.e., generalisation methods) rather than make AIs with less of our inductive biases and then hope to align them with weak-to-strong generalisation.</p><p>Most generally, this makes me think that <strong>&#8220;<a href="https://bostonglobalforum.org/news/letter-on-a-natural-ai-based-on-the-science-of-computational-physics-biology-and-neuroscience-policy-and-societal-significance/">Natural AI</a>&#8221; (a.k.a. <a href="https://www.lesswrong.com/s/HzcM2dkCq7fwXBej8">brain-like AI</a>) is one of the most important among theoretical, &#8220;long shot&#8221; alignment agendas</strong>.</p><p>More incrementally, and &#8220;prosaically&#8221; if you wish, I think AI companies should implement &#8220;<a href="https://arxiv.org/abs/1709.08568">the consciousness prior</a>&#8221; in the reasoning of their systems. Bengio has touched on this recently in his <a href="https://slideslive.com/39014230/towards-quantitative-safety-guarantees-and-alignment">recent talk</a>:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!279E!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec061b10-e2cd-45fc-9cee-2e66506fce65_1222x686.jpeg" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!279E!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec061b10-e2cd-45fc-9cee-2e66506fce65_1222x686.jpeg 424w, https://substackcdn.com/image/fetch/$s_!279E!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec061b10-e2cd-45fc-9cee-2e66506fce65_1222x686.jpeg 848w, https://substackcdn.com/image/fetch/$s_!279E!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec061b10-e2cd-45fc-9cee-2e66506fce65_1222x686.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!279E!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec061b10-e2cd-45fc-9cee-2e66506fce65_1222x686.jpeg 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!279E!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec061b10-e2cd-45fc-9cee-2e66506fce65_1222x686.jpeg" width="1222" height="686" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/ec061b10-e2cd-45fc-9cee-2e66506fce65_1222x686.jpeg&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:686,&quot;width&quot;:1222,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:299112,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/jpeg&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!279E!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec061b10-e2cd-45fc-9cee-2e66506fce65_1222x686.jpeg 424w, https://substackcdn.com/image/fetch/$s_!279E!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec061b10-e2cd-45fc-9cee-2e66506fce65_1222x686.jpeg 848w, https://substackcdn.com/image/fetch/$s_!279E!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec061b10-e2cd-45fc-9cee-2e66506fce65_1222x686.jpeg 1272w, https://substackcdn.com/image/fetch/$s_!279E!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fec061b10-e2cd-45fc-9cee-2e66506fce65_1222x686.jpeg 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>I won&#8217;t even mention other inductive biases that neuroscientists, cognitive scientists, and psychologists argue people have, such as the algorithms that people use in making decisions, the kinds of models that they learn, the role of emotions in learning and decision-making, etc. because I don&#8217;t know the full landscape well enough. Bengio&#8217;s &#8220;consciousness prior&#8221; is the one that I&#8217;m aware of and that seems to me completely uncontroversial because the structure of human language is strong evidence for it. If you disagree with me on this or know other human inductive biases that are very uncontroversial, please leave a comment.</p><p>Since merely &#8220;preaching&#8221; AI companies to adopt more human-like approaches to AI won&#8217;t help, the prosaic call for action on this front is to <strong>develop algorithms, ML architectures, and systems that make the adoption of more human-like AI economically attractive</strong>. (This is also a prerequisite for making it politically feasible to discuss turning this guideline into a policy if needed.)</p><p>One particularly promising lever is showing enterprises that by adopting AI that <a href="https://openreview.net/forum?id=25D2NyVVpr">samples compact causal models</a> that explain the data, they can <em>mine new knowledge and scale the decision intelligence across the organisational levels more cheaply</em>: two AIs trained on different data and for different narrow purposes can come up with causal explanations (i.e., new knowledge) on the intersection of their competence without re-training, but rather trying to combine the causal models that they sample and back-test them for support (which is very fast).</p><p>Another interesting approach that might apply to sequential time datasets (with a single context/stream) is to train a foundation <a href="https://github.com/topics/state-space-models">state-space model</a> (SSM) for predicting the time-series data, run the model through the timeseries data, and treat the hierarchy of state vectors at the end of this run as a hierarchy of &#8220;possible causal circuits in <a href="https://www.lesswrong.com/tag/superposition">superposition</a>&#8221; which could then be recombined with causal graphs/circuits from different AIs or learned by the same AI from different context.</p><p>Finally, we could create an external (system-level) incentive for employing such AIs at organisations: enable <a href="https://www.lesswrong.com/posts/AKBkDNeFLZxaMqjQG/gaia-network-a-practical-incremental-pathway-to-open-agency">cross-organisational learning in the space of causal models</a>.</p><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-1" href="#footnote-anchor-1" class="footnote-number" contenteditable="false" target="_self">1</a><div class="footnote-content"><p>For brevity, I will call &#8220;model(s) and decision theories&#8221; used by an agent simply a <em>model</em> of an agent.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-2" href="#footnote-anchor-2" class="footnote-number" contenteditable="false" target="_self">2</a><div class="footnote-content"><p>See &#8220;<a href="https://www.lesswrong.com/posts/xqxXrAohXSD3akYCg/meaningful-things-are-those-the-universe-possesses-a">Meaningful things are those the universe possesses a semantics&nbsp;for</a>&#8221;.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-3" href="#footnote-anchor-3" class="footnote-number" contenteditable="false" target="_self">3</a><div class="footnote-content"><p>Let&#8217;s also set aside the concern that agents try to manipulate each other&#8217;s beliefs, and assume the trust and deception issue is treated separately.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-4" href="#footnote-anchor-4" class="footnote-number" contenteditable="false" target="_self">4</a><div class="footnote-content"><p>However, it doesn&#8217;t seem so to me: if humans can oversee AIs and control the <em>method</em> of this oversight, it seems to me they must already have compete power over AIs.</p><p></p></div></div>]]></content:encoded></item><item><title><![CDATA[Gaia Network: An Illustrated Primer]]></title><description><![CDATA[This post is primarily written by Rafael Kaufmann, my contributions were minimal.]]></description><link>https://engineeringideas.substack.com/p/gaia-network-an-illustrated-primer</link><guid isPermaLink="false">https://engineeringideas.substack.com/p/gaia-network-an-illustrated-primer</guid><dc:creator><![CDATA[Roman Leventov]]></dc:creator><pubDate>Thu, 25 Jan 2024 11:35:02 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d9bddf6-5cf3-4c4d-8c13-0970087ca215_873x461.webp" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p><em>This post is primarily written by Rafael Kaufmann, my contributions were minimal. Warning: a long read!</em></p><p>In our <a href="https://www.lesswrong.com/posts/AKBkDNeFLZxaMqjQG/gaia-network-a-practical-incremental-pathway-to-open-agency">first LW post</a> on the Gaia Network, we framed it as a solution to the challenges of building safe, transformative AI. However, the true potential of Gaia as a &#8220;world-wide web of causal models&#8221; goes far beyond that, and in fact, justifying it in terms of its value to other use cases is key to showing its viability for AI safety. At the same time, the previous post focused more on the &#8220;what&#8221; and &#8220;why&#8221;, and didn&#8217;t talk much about the &#8220;how&#8221;. In this piece, we&#8217;ll correct both of these flaws: we&#8217;ll visually walk through the Gaia Network&#8217;s mechanics, with concrete use cases in mind.</p><p>The first two parts will cover use cases related to making science more effective and efficient. These would already be sufficient to justify the importance of building the Gaia Network: as&nbsp;<em>&#8220;<a href="https://www.goodreads.com/quotes/213539-science-is-the-only-news-when-you-scan-a-news">science is the only news</a>&#8221;</em>, improving science can have a huge positive multiplier effect on our future survival and prosperity. Yet despite a workforce of 8.8 million researchers and funding that adds up to 1.7% of global GDP, science is rightly criticized for inefficiency and limited accountability. The third part will expand beyond the epistemic (scientific) benefits of the Gaia Network and towards pragmatic impact - ie, making&nbsp;<em>all</em> decision-making more effective and efficient, which impacts the entire world population and GDP. And the last two sections will focus on the applications of the Gaia Network on existential risk - first specifically with regard to AI safety, and finally as a general tool for collective sensemaking and coordination around the Metacrisis.</p><p>For brevity&#8217;s sake, we will not<em>&nbsp;</em>cover any of the implementation details or mathematical grounding. We&#8217;ll focus on the core concepts and capabilities, and try to explain them in plain language. We&#8217;ll also skim over much of the &#8220;hard parts&#8221;: the economics and trust modeling. Finally, we will not cover the arguments for convergence and resilience of the network; these have been already sketched out in our&nbsp;<a href="https://www.lesswrong.com/posts/AKBkDNeFLZxaMqjQG/gaia-network-a-practical-incremental-pathway-to-open-agency#:~:text=anti%2Dcollusion%20mechanisms.-,The%20convergence%20and%20resilience%20arguments,-Will%20Gaia%20do">previous paper</a>, and merit a more formal and in-depth analysis than we can incorporate into this primer. If there&#8217;s some hand-waving in the below that makes you uncomfortable, please let us know in the comments and we will attempt to assuage you.</p><p>The beginning will take a bit long with Bayesian statistics, as these are foundational concepts for the Gaia architecture. Feel free to skip the footnotes if you&#8217;re overwhelmed. Also, note that everything below assumes explicit or clear-box models (where model parameters have names that reflect their intended semantics). In a future article, we&#8217;ll discuss how to incorporate black-box models like neural networks, where most components (neurons) have opaque semantics (or are mostly <a href="https://www.anthropic.com/index/towards-monosemanticity-decomposing-language-models-with-dictionary-learning">polysemantic</a>).</p><p>So let&#8217;s get started. Fast forward to a few years from now&#8230;<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-1" href="#footnote-1" target="_self">1</a></p><h2>Better science bottom-up</h2><p>You&#8217;re a plant geneticist working on the analysis of some experimental results that you want to publish. You have a model of how your new maize strain improves yields, and you&#8217;ve tested it against an experimental data set. (In the example pseudocode below, we use a Python-based syntax for concreteness, but this could be implemented in any statistical analysis software or framework, like R or Julia or even Excel spreadsheets.)</p><pre><code>def model(strainplanted, soiltype, rainfall, cropyield):
    ## Set parameter priors
    deltayield ~ Normal(...)
    avgyield_control ~ Normal(...)
    avgyield_experimental ~ Normal(avgield_control + deltayield, ...)
    &#120573;_soiltype ~ Normal(...)
    &#120573;_rainfall ~ Normal(...)
    ...


    ## Define likelihood of the target variable cropyield
    ## given the covariates and parameters:
    ## p(cropyield | strainplanted, soiltype, rainfall, ...params)
    with field = plate("field"):
        with t = plate("t"):
            if strainplanted == "control":
                baseyield = avgyield_control
            else:
                baseyield = avgyield_experimental
            soiltype_effect = &#120573;_soiltype[soiltype]
            rainfall_effect = &#120573;_rainfall * rainfall
            cropyield ~ Normal(&#120572;_yield + &#120573;_soiltype + &#120573;_rainfall)</code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!N3Uc!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F804c8474-02e4-4c0a-9373-4f956d2eb2a0_1452x968.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!N3Uc!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F804c8474-02e4-4c0a-9373-4f956d2eb2a0_1452x968.png 424w, https://substackcdn.com/image/fetch/$s_!N3Uc!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F804c8474-02e4-4c0a-9373-4f956d2eb2a0_1452x968.png 848w, https://substackcdn.com/image/fetch/$s_!N3Uc!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F804c8474-02e4-4c0a-9373-4f956d2eb2a0_1452x968.png 1272w, https://substackcdn.com/image/fetch/$s_!N3Uc!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F804c8474-02e4-4c0a-9373-4f956d2eb2a0_1452x968.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!N3Uc!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F804c8474-02e4-4c0a-9373-4f956d2eb2a0_1452x968.png" width="1452" height="968" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/804c8474-02e4-4c0a-9373-4f956d2eb2a0_1452x968.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:968,&quot;width&quot;:1452,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:364884,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!N3Uc!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F804c8474-02e4-4c0a-9373-4f956d2eb2a0_1452x968.png 424w, https://substackcdn.com/image/fetch/$s_!N3Uc!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F804c8474-02e4-4c0a-9373-4f956d2eb2a0_1452x968.png 848w, https://substackcdn.com/image/fetch/$s_!N3Uc!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F804c8474-02e4-4c0a-9373-4f956d2eb2a0_1452x968.png 1272w, https://substackcdn.com/image/fetch/$s_!N3Uc!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F804c8474-02e4-4c0a-9373-4f956d2eb2a0_1452x968.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Like most scientific analyses, this is a hierarchical model, where your local variables represent observations or states of the current context &#8211; say, the yield in each given season and field &#8211; and are influenced by&nbsp;<em>parameters</em> that represent more generic or abstract variables &#8211; average yield for your strain across all fields and seasons, which in turn depends on the expected yield improvement from a given genomics technique. (The latter is generic enough that it&#8217;s not really specific to your study, which is why it&#8217;s highlighted in orange below.)</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!lNEG!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3713e8e2-a443-4da9-91bf-fa1d56841060_548x356.webp" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!lNEG!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3713e8e2-a443-4da9-91bf-fa1d56841060_548x356.webp 424w, https://substackcdn.com/image/fetch/$s_!lNEG!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3713e8e2-a443-4da9-91bf-fa1d56841060_548x356.webp 848w, https://substackcdn.com/image/fetch/$s_!lNEG!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3713e8e2-a443-4da9-91bf-fa1d56841060_548x356.webp 1272w, https://substackcdn.com/image/fetch/$s_!lNEG!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3713e8e2-a443-4da9-91bf-fa1d56841060_548x356.webp 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!lNEG!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3713e8e2-a443-4da9-91bf-fa1d56841060_548x356.webp" width="548" height="356" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/3713e8e2-a443-4da9-91bf-fa1d56841060_548x356.webp&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:356,&quot;width&quot;:548,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:5560,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/webp&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!lNEG!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3713e8e2-a443-4da9-91bf-fa1d56841060_548x356.webp 424w, https://substackcdn.com/image/fetch/$s_!lNEG!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3713e8e2-a443-4da9-91bf-fa1d56841060_548x356.webp 848w, https://substackcdn.com/image/fetch/$s_!lNEG!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3713e8e2-a443-4da9-91bf-fa1d56841060_548x356.webp 1272w, https://substackcdn.com/image/fetch/$s_!lNEG!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F3713e8e2-a443-4da9-91bf-fa1d56841060_548x356.webp 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Running this model on a data set can be understood as propagating information through the graph. First, the priors for the parameters inform the expected distributions for the local variables. Then as we gather observations for some variables, that information flows back up, giving updated posteriors for the parameters. The amount of information (uncertainty reduction or negentropy) being propagated can be understood as a flow on this graph<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-2" href="#footnote-2" target="_self">2</a> and indeed can be estimated as an output of many kinds of common inference algorithms.<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-3" href="#footnote-3" target="_self">3</a></p><p>It&#8217;s really useful to think informally of the&nbsp;<em>free energy</em> of the model as the discrepancy between the inferred distribution and the information we have available, between priors and observations.<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-4" href="#footnote-4" target="_self">4</a> Zero free energy is the ideal state in which all information has been fully incorporated into the inference, is completely internally consistent, and explains away all the uncertainty in the system. Typically we can&#8217;t achieve zero free energy, as there&#8217;s always some uncertainty (whether aleatoric or epistemic), but we want to minimize it so that our model doesn&#8217;t have &#8220;extra&#8221;, unwarranted uncertainty. To get a better understanding of the concept of free energy and its role in Bayesian modeling and active inference, there are many excellent resources available; we particularly recommend&nbsp;<a href="https://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1008420">this paper by Gottwald and Braun</a>. Going forward, you can just think of Free Energy Reduction (FER) as a standard unit of account used by each model.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!CHg-!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d9bddf6-5cf3-4c4d-8c13-0970087ca215_873x461.webp" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!CHg-!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d9bddf6-5cf3-4c4d-8c13-0970087ca215_873x461.webp 424w, https://substackcdn.com/image/fetch/$s_!CHg-!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d9bddf6-5cf3-4c4d-8c13-0970087ca215_873x461.webp 848w, https://substackcdn.com/image/fetch/$s_!CHg-!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d9bddf6-5cf3-4c4d-8c13-0970087ca215_873x461.webp 1272w, https://substackcdn.com/image/fetch/$s_!CHg-!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d9bddf6-5cf3-4c4d-8c13-0970087ca215_873x461.webp 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!CHg-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d9bddf6-5cf3-4c4d-8c13-0970087ca215_873x461.webp" width="873" height="461" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/6d9bddf6-5cf3-4c4d-8c13-0970087ca215_873x461.webp&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:461,&quot;width&quot;:873,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:42910,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/webp&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!CHg-!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d9bddf6-5cf3-4c4d-8c13-0970087ca215_873x461.webp 424w, https://substackcdn.com/image/fetch/$s_!CHg-!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d9bddf6-5cf3-4c4d-8c13-0970087ca215_873x461.webp 848w, https://substackcdn.com/image/fetch/$s_!CHg-!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d9bddf6-5cf3-4c4d-8c13-0970087ca215_873x461.webp 1272w, https://substackcdn.com/image/fetch/$s_!CHg-!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F6d9bddf6-5cf3-4c4d-8c13-0970087ca215_873x461.webp 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption"><em>Source:&nbsp;<a href="https://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1008420">Gottwald and Braun (2020)</a></em></figcaption></figure></div><p>But here&#8217;s a problem: How do you set priors for your parameters in the first place? Sure, you expect your strain to increase yield, but it would be circular reasoning to build that expectation into the priors. The common practice is to use a&nbsp;<em>flat prior</em> (also known as a weakly informative or regularization prior), that incorporates only information that you have an objective or incontrovertible reason to believe in (ex: penalizing unreasonably low or high values). This can be seen as &#8220;not sneaking information into the model&#8221;, to avoid fooling yourself (and your stakeholders, the people who will use your study results to make decisions) by publishing unjustifiably confident results.<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-5" href="#footnote-5" target="_self">5</a> However, typically, most parameters in your study do&nbsp;<em>not</em> represent hypotheses you&#8217;re actively trying to learn about; instead, they represent assumptions that&nbsp;<em>are&nbsp;</em>justified by previous studies or expert opinions. For those, you want the opposite kind of prior, a&nbsp;<em>sharp&nbsp;</em>or&nbsp;<em>strong prior.</em></p><p>In the past, if you were very lucky, there would be a published meta-analysis about the parameters for each of your assumptions, to save you the pain of combing through thousands of PDFs, understanding each, and copy-pasting numbers from the relevant tables into your workspace. Unfortunately, this work was so mind-numbingly boring, expensive, thankless and error-prone, that high-quality meta-analyses were exceedingly rare.<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-6" href="#footnote-6" target="_self">6</a> To make matters worse, unlike the toy example above, real-world scientific models often utilize hundreds to thousands of parameters, and often far more if machine learning is used. Gathering the outputs of every relevant study for every relevant parameter, by hand, was infeasible, so we ended up with constant wheel reinvention and cargo-culted, unjustified assumptions, often used as point estimates with no uncertainty attached.<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-7" href="#footnote-7" target="_self">7</a></p><p>No longer: now you can simply connect your local model to the Gaia Network by annotating each parameter (in our example, average yield and drought tolerance, for both the control group of traditional maize and the experimental group of genetically modified maize). Your annotation attaches each parameter to a global namespace called the Gaia Ontology. You can browse the Ontology to see the exact definition of the parameter, with example code, and make sure you&#8217;re using the right one. Many other scientists have published their own studies on the Gaia Network; each published study contributes a posterior distribution for its parameters, and these are algorithmically aggregated into a &#8220;sort of weighted average&#8221; called a&nbsp;<em>pooled distribution.</em><a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-8" href="#footnote-8" target="_self">8</a><a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-9" href="#footnote-9" target="_self">9</a></p><p>So at inference time, the Gaia engine just queries the network for the current pooled distributions for each of these parameters &#8211; effectively conducting a meta-analysis on the fly &#8211; and adopts them as priors.<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-10" href="#footnote-10" target="_self">10</a><a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-11" href="#footnote-11" target="_self">11</a></p><pre><code>@gaia_bind(deltayield={
    "v0.Agronomy.YieldImprovementPct: {
        "species": "v0.Agronomy.Species.Maize",
        "intervention": "v0.Agronomy.Genomics.CRISPR"}})

def&nbsp;model(strainplanted,&nbsp;soiltype,&nbsp;rainfall, cropyield):
&#9;## Model code is unchanged</code></pre><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!nN4s!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb3f0b4a7-b23f-40b8-8e76-074acf75ce38_614x488.webp" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!nN4s!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb3f0b4a7-b23f-40b8-8e76-074acf75ce38_614x488.webp 424w, https://substackcdn.com/image/fetch/$s_!nN4s!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb3f0b4a7-b23f-40b8-8e76-074acf75ce38_614x488.webp 848w, https://substackcdn.com/image/fetch/$s_!nN4s!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb3f0b4a7-b23f-40b8-8e76-074acf75ce38_614x488.webp 1272w, https://substackcdn.com/image/fetch/$s_!nN4s!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb3f0b4a7-b23f-40b8-8e76-074acf75ce38_614x488.webp 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!nN4s!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb3f0b4a7-b23f-40b8-8e76-074acf75ce38_614x488.webp" width="614" height="488" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/b3f0b4a7-b23f-40b8-8e76-074acf75ce38_614x488.webp&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:488,&quot;width&quot;:614,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:9010,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/webp&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!nN4s!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb3f0b4a7-b23f-40b8-8e76-074acf75ce38_614x488.webp 424w, https://substackcdn.com/image/fetch/$s_!nN4s!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb3f0b4a7-b23f-40b8-8e76-074acf75ce38_614x488.webp 848w, https://substackcdn.com/image/fetch/$s_!nN4s!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb3f0b4a7-b23f-40b8-8e76-074acf75ce38_614x488.webp 1272w, https://substackcdn.com/image/fetch/$s_!nN4s!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fb3f0b4a7-b23f-40b8-8e76-074acf75ce38_614x488.webp 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>As the illustration above shows, your model is importing information from other studies in the network and using it to increase FER. Gaia keeps track of the &#8220;<a href="https://stats.stackexchange.com/questions/421741/what-is-the-credit-assignment-problem-in-machine-learning-and-deep-learning">credit assignment</a>&#8221;, which will prove valuable starting in the next step, which is to publish your work.</p><p>To contribute to the network, all you have to do is commit your study to GitHub. Gaia will save your posterior distributions for all parameters that you&#8217;ve annotated, and share them back with every other study in the network. Your study and your peer studies each have an&nbsp;<em>update chain</em>, an append-only sequence of distributions representing the state of posteriors from each study&#8217;s perspective. These are effectively independent representations of the state of knowledge of the parameters in question.<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-12" href="#footnote-12" target="_self">12</a></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Yvnc!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F14dcd994-66a7-43c7-9159-f7795be4fd11_1600x805.webp" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Yvnc!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F14dcd994-66a7-43c7-9159-f7795be4fd11_1600x805.webp 424w, https://substackcdn.com/image/fetch/$s_!Yvnc!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F14dcd994-66a7-43c7-9159-f7795be4fd11_1600x805.webp 848w, https://substackcdn.com/image/fetch/$s_!Yvnc!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F14dcd994-66a7-43c7-9159-f7795be4fd11_1600x805.webp 1272w, https://substackcdn.com/image/fetch/$s_!Yvnc!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F14dcd994-66a7-43c7-9159-f7795be4fd11_1600x805.webp 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Yvnc!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F14dcd994-66a7-43c7-9159-f7795be4fd11_1600x805.webp" width="1456" height="733" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/14dcd994-66a7-43c7-9159-f7795be4fd11_1600x805.webp&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:733,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:172468,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/webp&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Yvnc!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F14dcd994-66a7-43c7-9159-f7795be4fd11_1600x805.webp 424w, https://substackcdn.com/image/fetch/$s_!Yvnc!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F14dcd994-66a7-43c7-9159-f7795be4fd11_1600x805.webp 848w, https://substackcdn.com/image/fetch/$s_!Yvnc!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F14dcd994-66a7-43c7-9159-f7795be4fd11_1600x805.webp 1272w, https://substackcdn.com/image/fetch/$s_!Yvnc!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F14dcd994-66a7-43c7-9159-f7795be4fd11_1600x805.webp 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>So, immediately you can see that any other agricultural studies about different experimental strains will have their posteriors affected by adding your study to the pool of updates.<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-13" href="#footnote-13" target="_self">13</a> This effect can be quite large if few studies are being pooled, but it converges, so that after some point the updates become minimal.<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-14" href="#footnote-14" target="_self">14</a></p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!9AEe!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7bc9548d-28bb-46e0-b842-bef9ad328694_891x451.webp" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!9AEe!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7bc9548d-28bb-46e0-b842-bef9ad328694_891x451.webp 424w, https://substackcdn.com/image/fetch/$s_!9AEe!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7bc9548d-28bb-46e0-b842-bef9ad328694_891x451.webp 848w, https://substackcdn.com/image/fetch/$s_!9AEe!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7bc9548d-28bb-46e0-b842-bef9ad328694_891x451.webp 1272w, https://substackcdn.com/image/fetch/$s_!9AEe!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7bc9548d-28bb-46e0-b842-bef9ad328694_891x451.webp 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!9AEe!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7bc9548d-28bb-46e0-b842-bef9ad328694_891x451.webp" width="891" height="451" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/7bc9548d-28bb-46e0-b842-bef9ad328694_891x451.webp&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:451,&quot;width&quot;:891,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:10736,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/webp&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!9AEe!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7bc9548d-28bb-46e0-b842-bef9ad328694_891x451.webp 424w, https://substackcdn.com/image/fetch/$s_!9AEe!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7bc9548d-28bb-46e0-b842-bef9ad328694_891x451.webp 848w, https://substackcdn.com/image/fetch/$s_!9AEe!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7bc9548d-28bb-46e0-b842-bef9ad328694_891x451.webp 1272w, https://substackcdn.com/image/fetch/$s_!9AEe!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F7bc9548d-28bb-46e0-b842-bef9ad328694_891x451.webp 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>But Gaia doesn&#8217;t just propagate posterior updates to &#8220;sibling&#8221; studies: If there are higher-level models for which your parameter is a leaf, it will propagate up to those as well. For instance, a model that forecasts advances in crop technology and their impact on global food security:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!piR9!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa3a5d9ec-9ba2-4b65-8392-ac82ecfe8e54_600x727.webp" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!piR9!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa3a5d9ec-9ba2-4b65-8392-ac82ecfe8e54_600x727.webp 424w, https://substackcdn.com/image/fetch/$s_!piR9!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa3a5d9ec-9ba2-4b65-8392-ac82ecfe8e54_600x727.webp 848w, https://substackcdn.com/image/fetch/$s_!piR9!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa3a5d9ec-9ba2-4b65-8392-ac82ecfe8e54_600x727.webp 1272w, https://substackcdn.com/image/fetch/$s_!piR9!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa3a5d9ec-9ba2-4b65-8392-ac82ecfe8e54_600x727.webp 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!piR9!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa3a5d9ec-9ba2-4b65-8392-ac82ecfe8e54_600x727.webp" width="600" height="727" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/a3a5d9ec-9ba2-4b65-8392-ac82ecfe8e54_600x727.webp&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:727,&quot;width&quot;:600,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:15586,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/webp&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!piR9!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa3a5d9ec-9ba2-4b65-8392-ac82ecfe8e54_600x727.webp 424w, https://substackcdn.com/image/fetch/$s_!piR9!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa3a5d9ec-9ba2-4b65-8392-ac82ecfe8e54_600x727.webp 848w, https://substackcdn.com/image/fetch/$s_!piR9!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa3a5d9ec-9ba2-4b65-8392-ac82ecfe8e54_600x727.webp 1272w, https://substackcdn.com/image/fetch/$s_!piR9!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fa3a5d9ec-9ba2-4b65-8392-ac82ecfe8e54_600x727.webp 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Note that, by publishing your model on the Network, you&#8217;re&nbsp;<em>not</em> exporting any information other than updates to the values of the specific parameters that you&#8217;ve connected &#8211; in particular, you&#8217;re not sharing any of the underlying data. (This is a &#8220;privacy-centric&#8221; inference approach, analogous to&nbsp;<a href="https://en.wikipedia.org/wiki/Federated_learning">federated learning</a>. In a follow-up article, we&#8217;ll discuss how we can solve the problems of trust that this imposes.)</p><p>As mentioned above, the Gaia Protocol assigns credit to every publication (also called attribution). The mechanism for attribution is primarily &#8220;subjective&#8221;: each node (ie, each study) just measures the net FER impact of each contribution as it&#8217;s incorporated into its own update chain.</p><p>Above, we mentioned that the pooled distribution is a &#8220;sort of&nbsp;<strong>weighted</strong>&#8221; average between each study&#8217;s posterior. So where do the weights come from? The Gaia Protocol also answers this question in a bottom-up, &#8220;subjective&#8221; way. Nodes can independently infer the &#8220;right&#8221; weights for each parameter and study. To do so, they can use arbitrary &#8220;metamodels&#8221;, ranging from simple &#8220;beauty contest&#8221; models that just aggregate the net FER impact that&nbsp;<em>other&nbsp;</em>studies have attributed to a contribution, to &#8220;web of trust&#8221; models that try to factor out more sophisticated ones that infer the presence of low-quality studies or deliberate fraud via social-type network analysis; to true &#8220;metamodels&#8221; that infer study quality and parameter relevance, using outside data such as the publisher&#8217;s credentials, analyses of the model code and third-party verifications of the data. This means that, at least in the short term, the pooled distribution for a given parameter is actually different depending on which node you ask! Even if all nodes have seen all the updates in the same order, they can give arbitrarily different weights to them. But as the different metamodels themselves accumulate quality signals, nodes eventually converge on a shared inference of the right metamodel to use on which kind of parameter. (As discussed in the introduction, we will not attempt to justify the claim that this protocol converges and is resilient to noise and misinformation/fraud. For now, see the arguments&nbsp;<a href="https://www.lesswrong.com/posts/AKBkDNeFLZxaMqjQG/gaia-network-a-practical-incremental-pathway-to-open-agency#:~:text=anti%2Dcollusion%20mechanisms.-,The%20convergence%20and%20resilience%20arguments,-Will%20Gaia%20do">here</a>.)</p><h2>Funding science &#8211; retroactively and prospectively</h2><p>Now approaching this from the opposite perspective, say you're an analyst at a philanthropic foundation, trying to make recommendations for a prize that will be awarded to the most impactful scientific studies. Rather than solely rely on recommendations from the scientific community, or use &#8220;impact factors&#8221; that just measure popularity, you can query the Gaia Network to get quantitative, apples-to-apples impact metrics.</p><p>First, we should just note that being able to understand the &#8220;graph of science&#8221; in a live, transparent way &#8211; what are the research questions, how well developed, how much intensity in explore vs exploit mode, and how they connect to each other &#8211; is a game-changer. In the past, you needed to pay expensive fees for products like Web of Science and Scopus, which were based on manual curation and benefitted from the opaqueness of text-on-PDFs as the primary means of scientific communication. Having all the world&#8217;s science directly represented as machine-readable and connected models on Gaia &#8211; just like code and its dependencies on a package manager &#8211; makes all analytics orders of magnitude easier.</p><p>Now, back to the question of impact. Here we should distinguish two kinds of impact: epistemic impact - how much a given study has contributed to reducing uncertainty in the Network; and pragmatic impact - how much it has contributed to improving decisions. We&#8217;ll leave the pragmatic impact for later and focus on the epistemic impact for now.</p><p>So, for every model on the network, it&#8217;s easy to compute how much it contributed to FER flow across the network &#8211; what&#8217;s called credit assignment in neural networks. We just look at the net flow across the model boundary, which is accounted by the Gaia Protocol:</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!E_Wl!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2baec940-c36b-41c0-91bc-c91c446377e7_1154x1130.webp" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!E_Wl!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2baec940-c36b-41c0-91bc-c91c446377e7_1154x1130.webp 424w, https://substackcdn.com/image/fetch/$s_!E_Wl!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2baec940-c36b-41c0-91bc-c91c446377e7_1154x1130.webp 848w, https://substackcdn.com/image/fetch/$s_!E_Wl!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2baec940-c36b-41c0-91bc-c91c446377e7_1154x1130.webp 1272w, https://substackcdn.com/image/fetch/$s_!E_Wl!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2baec940-c36b-41c0-91bc-c91c446377e7_1154x1130.webp 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!E_Wl!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2baec940-c36b-41c0-91bc-c91c446377e7_1154x1130.webp" width="1154" height="1130" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2baec940-c36b-41c0-91bc-c91c446377e7_1154x1130.webp&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1130,&quot;width&quot;:1154,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:22474,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/webp&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!E_Wl!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2baec940-c36b-41c0-91bc-c91c446377e7_1154x1130.webp 424w, https://substackcdn.com/image/fetch/$s_!E_Wl!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2baec940-c36b-41c0-91bc-c91c446377e7_1154x1130.webp 848w, https://substackcdn.com/image/fetch/$s_!E_Wl!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2baec940-c36b-41c0-91bc-c91c446377e7_1154x1130.webp 1272w, https://substackcdn.com/image/fetch/$s_!E_Wl!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2baec940-c36b-41c0-91bc-c91c446377e7_1154x1130.webp 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Some care needs to be taken here. First of all, note that the FER credited to a model due to its contributions is always computed by the model that&#8217;s&nbsp;<em>receiving</em> the contributions (it&#8217;s a&nbsp;<em>subjective&nbsp;</em>value). Plus, there might be significant differences in modeling practices between different fields, which may distort calculations. Later on, when we talk about economics, we&#8217;ll see that the Protocol also needs a way to turn that subjective value accounting into intersubjective, mutually agreed upon &#8220;local exchange rates&#8221;. For now, let&#8217;s just say that you compute a normalization constant for each domain and use it to get a normalized, apples-to-apples net FER flow across domains.</p><p>So this covers&nbsp;<a href="https://eightify.app/summary/economics-and-finance/retroactive-public-goods-funding-by-jonas-seiferth#:~:text=TLDR%20Retroactive%20public%20goods%20funding,instead%20of%20worrying%20about%20funding.">retroactive funding</a> in the form of prizes. But this isn&#8217;t (and shouldn&#8217;t be) how most science gets funded. Most researchers cannot internalize the risk and cost of self-funding their own work upfront and hoping for retroactive funding later. Instead, funders &#8211; who have access to cheaper capital costs, lower marginal risk sensitivity, and the other advantages that come with a big pile of cash &#8211; contract with researchers upfront to trade capital now for a future flow of impact. Before the Gaia Network, establishing effective contracts was very challenging, as it was extremely hard to predict impact, even for the researchers themselves, let alone for the funders. (In economic parlance, it was a classic agent-principal problem created by uncertainty and information asymmetry.) Now, the Gaia Network itself provides the solution: it contains&nbsp;<em>metascience models&nbsp;</em>that model the flow of FER across the network and use it to design interventions &#8211; adding more models and more data to specific fields and individual lines of research &#8211; that are likely to deliver the highest future flow of FER. Funders and researchers can equally use these models to guide where they should spend the most time and resources.<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-15" href="#footnote-15" target="_self">15</a> Compared with the recent past, where there were no meaningful metrics of scientific productivity or value added, let alone predictive models of how to improve these, the Gaia Network is a game-changer for science funding.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!thaz!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4e24914a-302b-4b11-9284-773c405e4d11_607x535.webp" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!thaz!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4e24914a-302b-4b11-9284-773c405e4d11_607x535.webp 424w, https://substackcdn.com/image/fetch/$s_!thaz!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4e24914a-302b-4b11-9284-773c405e4d11_607x535.webp 848w, https://substackcdn.com/image/fetch/$s_!thaz!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4e24914a-302b-4b11-9284-773c405e4d11_607x535.webp 1272w, https://substackcdn.com/image/fetch/$s_!thaz!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4e24914a-302b-4b11-9284-773c405e4d11_607x535.webp 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!thaz!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4e24914a-302b-4b11-9284-773c405e4d11_607x535.webp" width="607" height="535" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/4e24914a-302b-4b11-9284-773c405e4d11_607x535.webp&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:535,&quot;width&quot;:607,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:10730,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/webp&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!thaz!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4e24914a-302b-4b11-9284-773c405e4d11_607x535.webp 424w, https://substackcdn.com/image/fetch/$s_!thaz!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4e24914a-302b-4b11-9284-773c405e4d11_607x535.webp 848w, https://substackcdn.com/image/fetch/$s_!thaz!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4e24914a-302b-4b11-9284-773c405e4d11_607x535.webp 1272w, https://substackcdn.com/image/fetch/$s_!thaz!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F4e24914a-302b-4b11-9284-773c405e4d11_607x535.webp 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h2>A distributed oracle for decision-making</h2><p>The above covers the advancement of science as its own objective. However, the same capabilities can aid&nbsp;<em>any</em> decision-making that pertains to the real world<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-16" href="#footnote-16" target="_self">16</a> &#8211; what we&#8217;ve called pragmatic impact above. Indeed, the Gaia Network has given everyone an actionable, reliable way to &#8220;trust the science&#8221; &#8211; not just on big things like climate change and pandemics, but also on day-to-day things like your diet, exercise, relationships, and so on. And the same applies to business decision-making, which is where we&#8217;ll focus next.</p><p>Say you manage Ada&#8217;s Acres, a large farming operation in the US Midwest. You&#8217;re planning your next planting for your 30 thousand hectares, and as usual, your suppliers are trying to push you new seeds, new herbicides and all manner of hardware and software. Meanwhile, your usual buyers are all calling to let you know that global demand forecasts are through the roof, so you stand to gain a lot of money if you have an outstanding harvest. However, you&#8217;ve noticed that the soil has been increasingly poor and in need of fertilizer and that herbicide resistance has increased a lot as well. The weather has been increasingly volatile, and you know it&#8217;s a matter of time before you have a major crop failure. Maybe it&#8217;s time to start giving regenerative farming a real shot?</p><p>Luckily, your farm operations software is now connected to the Gaia Network. It gives you a predictive digital twin of your farm that directly learns not just from every scientific experiment in agronomy, but from the &#8220;natural experiments&#8221; carried out by every other farm that uses the Network. So you can simulate the effects of any combination of practices, seed strains and products and estimate the outcomes, both short-term (expected yield and probability of crop failure for the next harvest) and long-term (soil health and herbicide resistance).</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!ypQC!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcc1a814b-b3d9-48d0-aff8-a9cb84ef6cde_541x628.webp" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!ypQC!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcc1a814b-b3d9-48d0-aff8-a9cb84ef6cde_541x628.webp 424w, https://substackcdn.com/image/fetch/$s_!ypQC!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcc1a814b-b3d9-48d0-aff8-a9cb84ef6cde_541x628.webp 848w, https://substackcdn.com/image/fetch/$s_!ypQC!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcc1a814b-b3d9-48d0-aff8-a9cb84ef6cde_541x628.webp 1272w, https://substackcdn.com/image/fetch/$s_!ypQC!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcc1a814b-b3d9-48d0-aff8-a9cb84ef6cde_541x628.webp 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!ypQC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcc1a814b-b3d9-48d0-aff8-a9cb84ef6cde_541x628.webp" width="541" height="628" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/cc1a814b-b3d9-48d0-aff8-a9cb84ef6cde_541x628.webp&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:628,&quot;width&quot;:541,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:9824,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/webp&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!ypQC!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcc1a814b-b3d9-48d0-aff8-a9cb84ef6cde_541x628.webp 424w, https://substackcdn.com/image/fetch/$s_!ypQC!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcc1a814b-b3d9-48d0-aff8-a9cb84ef6cde_541x628.webp 848w, https://substackcdn.com/image/fetch/$s_!ypQC!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcc1a814b-b3d9-48d0-aff8-a9cb84ef6cde_541x628.webp 1272w, https://substackcdn.com/image/fetch/$s_!ypQC!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2Fcc1a814b-b3d9-48d0-aff8-a9cb84ef6cde_541x628.webp 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>So that was a &#8220;small&#8221; (operational) use case. Now let&#8217;s zoom out to strategy<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-17" href="#footnote-17" target="_self">17</a>: let&#8217;s say that you&#8217;re the CEO of Acme Foods, a major food company. In light of increased droughts and crop failures, you&#8217;re trying to invest in your supply chain to minimize the risk of supply shortages. Your innovation teams have aggregated a long list of potential investments in precision farming, genomics, and regenerative agriculture. In the past, assembling an investment portfolio out of that long list would have required a long, expensive and very political negotiation exercise. Now that all your suppliers are connected to the Gaia Network and share limited access with you, your portfolio management system becomes a distributed digital twin of your supply chain. You can run complex distributed queries across all the nodes, simulate the effects of different investment combinations and different sets of assumptions (like climate and pest spread scenarios), factor in things like unintended consequences, and pull out an aggregate like a Pareto frontier for the investment profile you want.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!bMf9!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9cdde31c-2630-499a-9aaa-1e8c981659f7_782x521.webp" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!bMf9!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9cdde31c-2630-499a-9aaa-1e8c981659f7_782x521.webp 424w, https://substackcdn.com/image/fetch/$s_!bMf9!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9cdde31c-2630-499a-9aaa-1e8c981659f7_782x521.webp 848w, https://substackcdn.com/image/fetch/$s_!bMf9!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9cdde31c-2630-499a-9aaa-1e8c981659f7_782x521.webp 1272w, https://substackcdn.com/image/fetch/$s_!bMf9!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9cdde31c-2630-499a-9aaa-1e8c981659f7_782x521.webp 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!bMf9!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9cdde31c-2630-499a-9aaa-1e8c981659f7_782x521.webp" width="782" height="521" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/9cdde31c-2630-499a-9aaa-1e8c981659f7_782x521.webp&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:521,&quot;width&quot;:782,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:14554,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/webp&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!bMf9!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9cdde31c-2630-499a-9aaa-1e8c981659f7_782x521.webp 424w, https://substackcdn.com/image/fetch/$s_!bMf9!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9cdde31c-2630-499a-9aaa-1e8c981659f7_782x521.webp 848w, https://substackcdn.com/image/fetch/$s_!bMf9!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9cdde31c-2630-499a-9aaa-1e8c981659f7_782x521.webp 1272w, https://substackcdn.com/image/fetch/$s_!bMf9!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9cdde31c-2630-499a-9aaa-1e8c981659f7_782x521.webp 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Most of the demand for the intelligence in the Gaia Network will come from these&nbsp;<em>decision engines</em> (DEs), like the farm operations software and the portfolio management system. Combined with the ability of the Protocol to assign credit where it&#8217;s due, it can provide signals and incentives to provide a better&nbsp;<em>supply</em> of intelligence: more and better models in the places where they are most needed by decision-makers. In a future paper, we will further develop our vision of how these signals can be developed into a complete market and contracting mechanism for directing applied research, exploration and analysis: what we call the&nbsp;<em>knowledge economy</em>.</p><p>Even further, if we have &#8220;non-local&#8221; DEs that use Gaia models to design coordinated strategies that internalize the benefits of cooperation between multiple agents, then we can turn those DEs into Gaia models themselves! They become&nbsp;<em>decision models</em> performing &#8220;<a href="https://www.sciencedirect.com/science/article/pii/S1364661312001957">planning as inference</a>&#8221; on behalf of agents (individuals and collectives), helping to solve&nbsp;<em>all kinds of principal-agent problems</em>. In the example above, the food company can use a DE not only to infer the best investments for its own goals but also to design adequate contracts and incentives that will best equalize the goals and constraints of all the players in the supply chain. This&nbsp;<em>delegation economy&nbsp;</em>will also be further explored in a future paper.</p><h2>A distributed oracle for AI safety</h2><p>The above discussion of decision-making is our link to AI safety. Yoshua Bengio&nbsp;<a href="https://slideslive.com/39014230/towards-quantitative-safety-guarantees-and-alignment">has proposed</a> to tackle AI safety by building an &#8220;AI scientist&#8221; &#8211; a comprehensive probabilistic world model that would serve as a universal gatekeeper to evaluate the safety of&nbsp;<em>every</em> high-stakes action from&nbsp;<em>every</em> AI agent, instead of attempting to design safety&nbsp;<em>into</em> agents. This is similar to Davidad&#8217;s&nbsp;<a href="https://www.lesswrong.com/posts/jRf4WENQnhssCb6mJ/davidad-s-bold-plan-for-alignment-an-in-depth-explanation">Open Agency Architecture</a> (OAA) proposal. But of course, developing such a monolithic, centralized and comprehensive gatekeeper from scratch<em>&nbsp;</em>would be an extremely costly and lengthy undertaking. Further, as Bengio&#8217;s proposal makes clear, the AI scientist needs to have &#8220;epistemic humility&#8221;: its evaluations need to incorporate the limitations and uncertainty of its own model so that it doesn&#8217;t confidently allow actions that seem safe at the time but turn out to be unsafe in retrospect.</p><p>We argue that the Gaia Network, including the DEs that work as decision models, qualifies perfectly for the job of a distributed AI scientist. The DEs can query the diverse and constantly evolving knowledge in the network to form an &#8220;effective world model&#8221; with epistemic humility built in. They can provide the demand signals and resources to improve and expand the world model. They can then use this model to simulate counterfactual outcomes of actions that take into account all available local context and dependencies between contexts, and use these simulations to approximately estimate probabilities for outcomes (marginalization). They can factor in the preferences and safety constraints of all agents that use the Network, which they have already shared in order to enable the DEs to help with their own decisions. This gives all the terms in Bengio&#8217;s notional risk evaluation formula (adapted from&nbsp;<a href="https://slideslive.com/39014230/towards-quantitative-safety-guarantees-and-alignment">slide 17 here</a>):</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!9oOX!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2269006c-ebdd-434b-8e77-1706c82b0b17_645x371.webp" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!9oOX!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2269006c-ebdd-434b-8e77-1706c82b0b17_645x371.webp 424w, https://substackcdn.com/image/fetch/$s_!9oOX!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2269006c-ebdd-434b-8e77-1706c82b0b17_645x371.webp 848w, https://substackcdn.com/image/fetch/$s_!9oOX!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2269006c-ebdd-434b-8e77-1706c82b0b17_645x371.webp 1272w, https://substackcdn.com/image/fetch/$s_!9oOX!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2269006c-ebdd-434b-8e77-1706c82b0b17_645x371.webp 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!9oOX!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2269006c-ebdd-434b-8e77-1706c82b0b17_645x371.webp" width="645" height="371" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/2269006c-ebdd-434b-8e77-1706c82b0b17_645x371.webp&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:371,&quot;width&quot;:645,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:7938,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/webp&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!9oOX!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2269006c-ebdd-434b-8e77-1706c82b0b17_645x371.webp 424w, https://substackcdn.com/image/fetch/$s_!9oOX!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2269006c-ebdd-434b-8e77-1706c82b0b17_645x371.webp 848w, https://substackcdn.com/image/fetch/$s_!9oOX!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2269006c-ebdd-434b-8e77-1706c82b0b17_645x371.webp 1272w, https://substackcdn.com/image/fetch/$s_!9oOX!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F2269006c-ebdd-434b-8e77-1706c82b0b17_645x371.webp 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p>Possibly the most important aspect of this design &#8211; which comes particularly to light when comparing it to the OAA design &#8211; is that&nbsp;<em>none of the above components is specific to AI safety</em>; they are just repurposed from existing and day-to-day use cases for which the users/agents already have the incentives to share the required information with the Gaia Network and the DEs. This means that tackling AI safety is no longer &#8220;<a href="https://www.lesswrong.com/posts/jRf4WENQnhssCb6mJ/davidad-s-bold-plan-for-alignment-an-in-depth-explanation#:~:text=one%20of%20the%20most%20ambitious%20scientific%20projects%20in%20human%20history">one of the most ambitious scientific projects in human history</a>&#8221;, but rather a &#8220;fringe benefit&#8221; from our pursuit of knowledge and of better decision-making. And which, in turn, benefits from all improvements to the efficiency and effectiveness of those pursuits that have already been produced by past and ongoing advances in computational statistics and machine learning &#8211; and all that will be generated by the Gaia Network connecting and interoperating the many millions of such models in existence, and increasing the RoI of creating and improving models.</p><p>This outcome is not dependent on AI safety funders; nor the foibles of political will in the scientific and policy communities; nor the desire of billions of humans to independently share their preferences with an elicitor. All that is required &#8211; beyond some cheap work on core infrastructure, modeling and developer experience &#8211; is the same economic behaviors and incentives that exist today: the desire for profit, the pursuit of greater scientific knowledge, and the existence of institutions willing and able to internalize the cost of coordinated action.</p><p>An overview of this architecture, adapted from our&nbsp;<a href="https://www.lesswrong.com/posts/AKBkDNeFLZxaMqjQG/gaia-network-a-practical-incremental-pathway-to-open-agency">last post</a>, is given below.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!EyYv!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F72b841d0-b466-494d-8eaa-8087fd2fb6db_1528x1600.webp" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!EyYv!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F72b841d0-b466-494d-8eaa-8087fd2fb6db_1528x1600.webp 424w, https://substackcdn.com/image/fetch/$s_!EyYv!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F72b841d0-b466-494d-8eaa-8087fd2fb6db_1528x1600.webp 848w, https://substackcdn.com/image/fetch/$s_!EyYv!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F72b841d0-b466-494d-8eaa-8087fd2fb6db_1528x1600.webp 1272w, https://substackcdn.com/image/fetch/$s_!EyYv!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F72b841d0-b466-494d-8eaa-8087fd2fb6db_1528x1600.webp 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!EyYv!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F72b841d0-b466-494d-8eaa-8087fd2fb6db_1528x1600.webp" width="1456" height="1525" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/72b841d0-b466-494d-8eaa-8087fd2fb6db_1528x1600.webp&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1525,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:103722,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/webp&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!EyYv!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F72b841d0-b466-494d-8eaa-8087fd2fb6db_1528x1600.webp 424w, https://substackcdn.com/image/fetch/$s_!EyYv!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F72b841d0-b466-494d-8eaa-8087fd2fb6db_1528x1600.webp 848w, https://substackcdn.com/image/fetch/$s_!EyYv!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F72b841d0-b466-494d-8eaa-8087fd2fb6db_1528x1600.webp 1272w, https://substackcdn.com/image/fetch/$s_!EyYv!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F72b841d0-b466-494d-8eaa-8087fd2fb6db_1528x1600.webp 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><h2>A distributed oracle for the Metacrisis</h2><p>The very same architecture helps us identify shared pathways through the Metacrisis. Below is a nice visual of the high-level causal model we have in mind when thinking about the Gaia Network&#8217;s role. By connecting all the relevant domain models and making apparent not only their interdependencies but also their common causes &#8211; the &#8220;generator functions&#8221; or underlying self-reinforcing dynamics &#8211; Gaia helps us understand likely future outcomes of the current trends and establish strategies with the highest potential for nudging our global course away from the two catastrophic attractors that currently seem most likely (chaos and totalitarianism). Not only that, but as we&#8217;ve seen, Gaia-powered DEs are also used as&nbsp;<em>coordination surfaces:&nbsp;</em>shared tools for establishing and monitoring contracts, treaties and institutions, with unprecedented scale and reliability. While this &#8220;infrastructure for model-augmented wisdom&#8221; doesn&#8217;t immediately or inherently solve conflicts of power and interests, it does provide a consistent, repeatable and scalable&nbsp;<em>institution</em> for achieving and retaining incremental advances towards a positive-sum, cooperative&nbsp;<a href="https://rkauf.medium.com/the-gaia-attractor-41e5af33f3b7">Gaia Attractor</a>.</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!hchm!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9e2d6b42-bdbd-4c14-9882-8aba8478074f_820x1679.webp" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!hchm!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9e2d6b42-bdbd-4c14-9882-8aba8478074f_820x1679.webp 424w, https://substackcdn.com/image/fetch/$s_!hchm!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9e2d6b42-bdbd-4c14-9882-8aba8478074f_820x1679.webp 848w, https://substackcdn.com/image/fetch/$s_!hchm!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9e2d6b42-bdbd-4c14-9882-8aba8478074f_820x1679.webp 1272w, https://substackcdn.com/image/fetch/$s_!hchm!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9e2d6b42-bdbd-4c14-9882-8aba8478074f_820x1679.webp 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!hchm!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9e2d6b42-bdbd-4c14-9882-8aba8478074f_820x1679.webp" width="820" height="1679" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/9e2d6b42-bdbd-4c14-9882-8aba8478074f_820x1679.webp&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1679,&quot;width&quot;:820,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:108964,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/webp&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!hchm!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9e2d6b42-bdbd-4c14-9882-8aba8478074f_820x1679.webp 424w, https://substackcdn.com/image/fetch/$s_!hchm!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9e2d6b42-bdbd-4c14-9882-8aba8478074f_820x1679.webp 848w, https://substackcdn.com/image/fetch/$s_!hchm!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9e2d6b42-bdbd-4c14-9882-8aba8478074f_820x1679.webp 1272w, https://substackcdn.com/image/fetch/$s_!hchm!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F9e2d6b42-bdbd-4c14-9882-8aba8478074f_820x1679.webp 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a><figcaption class="image-caption">Source: Adapted from Potentialism, via&nbsp;<a href="https://www.sloww.co/meta-crisis-101/">Sloww</a></figcaption></figure></div><h2>Conclusion: Back from the future</h2><p>We just claimed that <em>a lot</em> will change in &#8220;a few years from now&#8221;. How realistic is this? Here&#8217;s the&nbsp;<em>really&nbsp;</em>good news: all the capabilities described above can be implemented with today&#8217;s technology.<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-18" href="#footnote-18" target="_self">18</a> Not only that: we&#8217;re already doing it. We have assembled several organizations and individuals into a growing&nbsp;<a href="https://gaiaconsortium.org/">Gaia Consortium</a>, and have of course been leveraging loads of existing components and building some of our own. Examples:</p><ul><li><p><a href="https://oceanprotocol.com/">Ocean Protocol</a> and&nbsp;<a href="https://source.network/defra-db">DefraDB</a>: Decentralized computing and data management.</p></li><li><p>Fangorn (coming soon): a decentralized platform for building and performing (active) inference on Gaia-connected state space models.</p></li><li><p><a href="https://www.sentient-hubs.com/">Sentient Hubs</a>: Federated model-based decision support.</p></li></ul><p>We are simultaneously working on specific applications of the Gaia Network, focusing primarily on bioregional economies and sustainable supply chains. These have been useful for providing concrete use cases (some of which we saw above) and resourcing. But ultimately we intend to evolve this into a fully open and collaborative R&amp;D effort to build the general-purpose capabilities described above.</p><p>If you&#8217;re interested in contributing to this work, here are some possible ways to do it:</p><ul><li><p>Students interested in developing this with us should sign up for the upcoming SPAR program. We&#8217;re advising two projects: one focused on outstanding design, engineering and economics issues around using Gaia-based AI scientists for AI safety; the other is more conceptual and centers on formalizing and computationally testing the use of free energy-based causal systems models for measuring AI safety.</p></li><li><p>If you&#8217;re interested in helping design and build the Gaia Network and the surrounding infrastructure, protocols, decision machinery, etc., we gladly accept contributions of all kinds.</p></li><li><p>If you&#8217;d like to&nbsp;<em>use&nbsp;</em>the Gaia Network (or its precursors) in your own use cases, we can happily support standing up &#8220;testnets&#8221; and help design prototypes and proofs of concepts.</p></li><li><p>If you have resources to help accelerate development, we can gladly accept grant funding or other forms of support.</p></li></ul><p>If you&#8217;re interested in any of the above, please reach out!</p><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-1" href="#footnote-anchor-1" class="footnote-number" contenteditable="false" target="_self">1</a><div class="footnote-content"><p>Below, Gaia Network and its applications are described both in present and future tense in different narration modes. To avoid confusion, note that Gaia Network is <em>not</em> yet implemented and deployed on a large scale.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-2" href="#footnote-anchor-2" class="footnote-number" contenteditable="false" target="_self">2</a><div class="footnote-content"><p>In a simple structure like this, a single backward propagation is enough, but there are cases where we need to iteratively update (message passing). For those cases, think of the net flow that is obtained after propagating up and down enough times.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-3" href="#footnote-anchor-3" class="footnote-number" contenteditable="false" target="_self">3</a><div class="footnote-content"><p>For instance, in variational inference algorithms, the free energy (or stochastic estimates of it) is directly used as a minimization objective. Equivalently, its negative, the Evidence Lower Bound [ELBO], is maximized.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-4" href="#footnote-anchor-4" class="footnote-number" contenteditable="false" target="_self">4</a><div class="footnote-content"><p>There is an additional concept of free energy associated with decision-making, corresponding to the discrepancy between the veridical posterior justified by priors and observations and the one &#8220;desired&#8221; in light of a given reward function/model/distribution.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-5" href="#footnote-anchor-5" class="footnote-number" contenteditable="false" target="_self">5</a><div class="footnote-content"><p>If you already have information that comes from past experiments, or knowledge elicited by independent experts, you <em>can</em> also incorporate it into the priors. The challenge is how to keep track of the grounding behind all of this imported information. This is, in a sense, what the Gaia Network does algorithmically, as we&#8217;ll see.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-6" href="#footnote-anchor-6" class="footnote-number" contenteditable="false" target="_self">6</a><div class="footnote-content"><p>See <a href="https://meta-analysis.com/download/criticismsofmeta-analysis.pdf">Criticisms of Meta-Analysis</a>; <a href="https://www.ncbi.nlm.nih.gov/pmc/articles/PMC122061/">Meta-analysis: Neither quick nor easy</a>;&nbsp; <a href="https://www.sciencedirect.com/science/article/abs/pii/S0020138322004235">Meta-analysis. What have we learned?</a></p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-7" href="#footnote-anchor-7" class="footnote-number" contenteditable="false" target="_self">7</a><div class="footnote-content"><p>Actually, even for the parameters of interest in your study, there is a high value in having access to past studies&#8217; posteriors: after having your posteriors &#8220;in isolation&#8221;, you now want to compare them to previous results in the literature, to check for novelty or consistency.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-8" href="#footnote-anchor-8" class="footnote-number" contenteditable="false" target="_self">8</a><div class="footnote-content"><p>Technically, a pooled distribution is not a weighted average of <em>distributions</em> (that would be a <a href="https://en.wikipedia.org/wiki/Mixture_distribution">mixture distribution</a>); instead, it&#8217;s a distribution whose <em>parameters</em> are a weighted average (or other combination) of the parameters of the original distributions. Just so we&#8217;re clear: here we&#8217;re talking about statistical parameters of the posteriors of scientific parameters; for instance, the mean and variance of the average yield.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-9" href="#footnote-anchor-9" class="footnote-number" contenteditable="false" target="_self">9</a><div class="footnote-content"><p>In practice, different studies often use different model structures and local ontologies. Sometimes these are just syntax differences, such as alternative parameterizations (ex: centered vs uncentered parameters, etc), but often they represent different semantics &#8211; different statistical constructs, reflecting differences in context and/or scientific methodology. To enable aggregations to happen between models with these differences, translations are required. To this end, Gaia contributors often publish <em>lens models</em> that perform data translation. As an added benefit of this approach, in cases when there are different semantics that inevitably lead to a loss in translation (as WVO Quine pointed out and Chris Fields has recently formalized), it&#8217;s useful for there to be a separate lens model that accounts for and &#8220;absorbs&#8221; that loss.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-10" href="#footnote-anchor-10" class="footnote-number" contenteditable="false" target="_self">10</a><div class="footnote-content"><p>This does mean your model is colored by using the informative Gaia posteriors as priors for a parameter of interest. But you can always turn off the annotations for those parameters to isolate the effects of the information contributed by your study (aka the likelihood).</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-11" href="#footnote-anchor-11" class="footnote-number" contenteditable="false" target="_self">11</a><div class="footnote-content"><p>In this example, these are independent scalar parameters, but they could be any multidimensional array with any kind of internal correlation structure.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-12" href="#footnote-anchor-12" class="footnote-number" contenteditable="false" target="_self">12</a><div class="footnote-content"><p>This is unlike a blockchain, which is designed to ensure that all nodes are &#8220;almost always&#8221; in full consensus about the entire contents of the global state (which then requires hacks like &#8220;L2&#8221; chains to improve speed and flexibility).</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-13" href="#footnote-anchor-13" class="footnote-number" contenteditable="false" target="_self">13</a><div class="footnote-content"><p>How? It depends on the parameterization used, but in most cases, partial pooling brings posterior means closer together. You can have parameterizations with multiple modes, like a Gaussian mixture distribution, but this tends to imply that your parameter is actually representing multiple categories instead of a scalar, and should be changed to reflect that.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-14" href="#footnote-anchor-14" class="footnote-number" contenteditable="false" target="_self">14</a><div class="footnote-content"><p>No matter how small, Gaia eventually propagates every nonzero update to every parameter on the network, so we can have eventual consistency. The protocol can choose to batch small updates for efficiency.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-15" href="#footnote-anchor-15" class="footnote-number" contenteditable="false" target="_self">15</a><div class="footnote-content"><p>Of course, no one cares about an abstract quantity like FER; they care about concrete advancements in specific areas of science. But that&#8217;s the same as saying no one cares about money, but about the goods and services they can buy with it.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-16" href="#footnote-anchor-16" class="footnote-number" contenteditable="false" target="_self">16</a><div class="footnote-content"><p>That primarily means we&#8217;re excluding &#8220;teach AI how to play videogames&#8221; or &#8220;decide which next token to generate for a user&#8221; types of scenarios.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-17" href="#footnote-anchor-17" class="footnote-number" contenteditable="false" target="_self">17</a><div class="footnote-content"><p>We could zoom even further out to tackle the domains of strategy consulting, and ask more &#8220;meta&#8221; questions. What are the theories of change, how do they connect to each other, how well developed, and how much intensity is in explore vs exploit mode? We will explore these further in a follow-up article.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-18" href="#footnote-anchor-18" class="footnote-number" contenteditable="false" target="_self">18</a><div class="footnote-content"><p>There are some areas where current solutions aren&#8217;t fully adequate, but these are matters of incremental progress, not qualitative breakthroughs.</p><p></p></div></div>]]></content:encoded></item><item><title><![CDATA[Institutional economics through the lens of scale-free regulative development, morphogenesis, and cognitive science]]></title><description><![CDATA[In this article, I highlight some of the ideas from Musthtaq Khan&#8217;s interview for 80000hours podcast about institutional economics, political economy, his &#8220;political settlement&#8221; framework, and the methodology of economics, and connect these ideas to the concepts in scale-free regulative development]]></description><link>https://engineeringideas.substack.com/p/institutional-economics-through-the</link><guid isPermaLink="false">https://engineeringideas.substack.com/p/institutional-economics-through-the</guid><dc:creator><![CDATA[Roman Leventov]]></dc:creator><pubDate>Tue, 23 Jan 2024 18:18:45 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!EJj2!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F55443e67-0a66-4164-8473-09b13a2e90ca_256x256.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>In this article, I highlight some of the ideas from <a href="https://80000hours.org/podcast/episodes/mushtaq-khan-institutional-economics/">Musthtaq Khan&#8217;s interview for 80000hours podcast about institutional economics</a><a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-1" href="#footnote-1" target="_self">1</a>, political economy, his &#8220;political settlement&#8221; framework, and the methodology of economics, and connect these ideas to the concepts in scale-free regulative development<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-2" href="#footnote-2" target="_self">2</a>, morphogenesis<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-3" href="#footnote-3" target="_self">3</a>, and cognitive science<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-4" href="#footnote-4" target="_self">4</a><a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-5" href="#footnote-5" target="_self">5</a>.</p><h3>The history of the socioeconomy matters</h3><p>Khan points to the fact that socioeconomies are <em>non-ergodic</em> dynamical systems with hysteresis, i.e., <em>memories</em> of their own [1]:</p><blockquote><p>To say that all structures are created by individuals, and therefore if the structure of society in India is different from the one in the United States, then we have to look at the individual incentives that created those structures, I think is a non-starter. It confuses the path dependence of history and the complexity of how structures are built up. Individuals today in India may not have any capacity of changing that structure to look like the one in the U.S. or Norway, not because they have some information deficit or anything like that, but because a structure itself has a reality and a meaning which affects the way individuals behave.</p></blockquote><p>Here&#8217;s the exactly parallel observation that Levin [3] makes about morphogenesis:</p><blockquote><p>Development is thus incredibly reliable, producing bodies to very tight tolerance despite considerable deviations and noise at the level of gene expression and cellular activity (Gonze et al. 2018; Eritano et al. 2020; Simon, Hadjantonakis, and Schroter 2018). This robustness, and its occasional failure in the case of birth defects immediately suggests teleonomic perspectives because only goal-directed agents can make mistakes; biophysics alone cannot make mistakes &#8211; every micro-scale process proceeds according to the laws of physics and chemistry. Developmental defects are mistakes relative to the correct outcome toward which they strive.</p></blockquote><p>This means that from the perspective of scale-free teleonomy, <strong>socioeconomies must be &#8220;goal-directed agents that can make mistakes&#8221;</strong>. The causal (or &#8220;creation&#8221;) link between <em>individual behaviour</em> and <em>institutions</em> (socioeconomic structures) is <em>bidirectional</em> rather than unidirectional from individual behaviour to institutions.</p><p>Khan&#8217;s position is that viewing economy exclusively through the lens of individual choice (behaviour) and emergence of supply, demand, and market prices is overly reductive and misses opportunities for intervention and explanation. This <strong>non-reductionist approach</strong><a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-6" href="#footnote-6" target="_self">6</a> <strong>to economics</strong> is, of course, shared by Levin with his non-reductionist approach to biology and medicine [3]:</p><blockquote><p>These attempts to view morphogenesis a not merely an emergent physical process but a goal-directed control loop have led to many new discoveries and novel capabilities in the prediction and control of anatomical outcomes that had not been discovered from prior bottom-up approaches, and which offer numerous advantages for regenerative medicine.</p></blockquote><h3>Education vs. management know-how and genes vs. cellular control know-how</h3><p>In the passage quoted above, Khan also seems to suggest that just increasing the level of individual education in the society, though it may help, could be insufficient to change the economic structure and build the economy full of high-capability organisations [1]:</p><blockquote><p>Individuals today in India may not have any capacity of changing that structure to look like the one in the U.S. or Norway, not because they have some information deficit or anything like that, but because a structure itself has a reality and a meaning which affects the way individuals behave.</p></blockquote><p>Individual education (economics) seems to correspond to the knowledge encoded in <em>genes</em> (biology) [3]:</p><blockquote><p>Because genomes encode micro-level protein hardware, not directly specifying growth and form, it is essential to understand not only molecular mechanisms necessary for morphogenesis, but also the information-processing dynamics that are sufficient for the swarm intelligence of cell groups to create, repair, and reconstruct large-scale anatomical features.</p></blockquote><p>However, Khan distinguishes between public or university education with the actual know-how of how to organise a factory, a hospital, a logistics company, and so on, which cannot be learned in school but mostly through practice [1]:</p><blockquote><p>[&#8230;] this has nothing much to do with what you learn in business school. It is to do with how you organize a whole team of people to operate seamlessly as an organic whole. And it sounds to us to be rather obvious, but this is an incredibly difficult thing to achieve. Take the example of a hospital in a developing country. Hospitals in developing countries have doctors who are very skilled. In fact, most of them would love to leave and take a job in an advanced country where they would perform perfectly well. They have all the machines that you require for a hospital. They have the drugs, or many or most of them. And yet their capacity to deliver good health services is very poor. The reason is not the quality of the people or the quality of the machines. It&#8217;s how it&#8217;s organized. Are you doing the cleaning properly? Are you managing the flow of tests so that the right tests go at the right time to the right doctor for the right patient? Are you managing your entry so that the beds are kept just about full enough, but not overly full? Are you managing your quality control and your ordering of spare parts? And this is where it fails. This is where universities don&#8217;t work in some countries, hospitals don&#8217;t work in other countries. Not because they don&#8217;t have professors. I&#8217;m from a country where universities don&#8217;t work very well, but there are many people like me who are from that country who are quite good professors. But the problem is not the professor. The problem is not the machine or the desk or the whiteboard. The problem is the organization, and how all of this is put together.</p></blockquote><p>In biology, this organisational and managerial know-how corresponds to the <em>capabilities to perform complex, fine-tuned control</em> that neurons, immune cells, and other types of cells acquire in the organism in the process of development while being surrounded by other cells (which could serve as their affordances) and having certain control goals<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-7" href="#footnote-7" target="_self">7</a><a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-8" href="#footnote-8" target="_self">8</a>. This knowledge is not encoded in the genes!</p><h3>Policies and regulations work only when there are networks of horizontal checks and balances that make following the policy mutually advantageous to the players</h3><p>Khan [1]:</p><blockquote><p>The idea that a policy is a black box that the government just announces and everyone starts following it is a total mistake. A government is just one organization amongst many organizations in society. And there is an interplay going on between governments, political parties, opposition parties, trade unions, churches, mosques, the people, different kinds of agencies and forums&#8230; All of them are trying to influence this policy outcome, but also &#8212; and this is critical &#8212; implementing it on a daily basis. And if the vast majority of your organizations and society are happily violating the rules and not checking each other, then it&#8217;s not going to be an implementable policy.</p></blockquote><p>These horizontal networks (other synonyms and terms related to <em>horizontal networks</em> that Khan uses: <em>institutions</em>, <em>social structures</em>, <em>power structures</em>, <em>social organizations</em>, <em>legal systems</em>, <em>incentives</em>, etc.) determine the <em>ecological niches</em> and <em>affordance landscapes</em> within which the players (economic entities, agents) compete and cooperate with each other.</p><p>In biological morphogenesis, the equivalents of these horizontal networks and institutions are biochemical and <em>bioelectric networks</em> of communication between cells, tissues, and organs. According to Levin, <strong>bioelectric networks are the medium for encoding, communicating, and negotiating the high-level morphological (also metabolic and physiological) goals of the organism that subsystems (organs, tissues, and cells) tap into</strong> [3]:</p><blockquote><p>Memory (implemented by bioelectric networks or other mechanisms) is central to teleonomy as a mechanism for encoding future goal states. More generally, however, bioelectric states are a medium that binds individual cells toward large-scale goals &#8211; it underlies scale-up (Figure 5) and emergence of higher-level teleonomic individuals (Levin 2019), much as it does to create brains with emergent unified mental content out of a collection of individual neuronal cells. This is why disruptions of bioelectric communication, in the absence of genetic alterations or carcinogens, can initiate cancer in vivo - a shrinking of the size of goals from morphogenetic activity of normal maintenance to unicellular goals of maximum proliferation and migration (metastasis) (Levin 2021b); conversely, forcing appropriate bioelectric communication can normalize cells despite strong expression of oncogenes that otherwise induce tumors (Chernet and Levin 2014, 2013). The framework focused on inflating or shrinking the scale of the teleonomic activity leads directly to novel capabilities, in this case in the context of the cancer problem (Levin 2021b; Moore, Walker, and Levin 2017).</p></blockquote><p>Once the high-level goal (setpoint) is achieved, the bioelectric and biochemical networks maintain the organism in homeostasis. Khan describes how the network of incentives helped to establish and then maintain the effectiveness of skill-training programmes in Bangladesh. This could be seen as <strong>maintaining a balance in &#8220;workforce metabolism&#8221; by the socioeconomy</strong>, thanks to the horizontal network of checks and balances.</p><h3>Advanced organisations and institutions need each other</h3><p>Another key point in Khan&#8217;s political settlement theory is that <strong>advanced institutions (such as corporate law) are only demanded by sufficiently advanced (and hence high-capability) organisations</strong>. However, these organisations also don&#8217;t pop out <em>without</em> the institutions: the latter are necessary for the development of advanced organisations. Thus, socioeconomic development is necessary a gradual, spiral-like process [1]:</p><blockquote><p>[&#8230;] powerful organizations which need rules for their own reproduction. They need rules for complex contracting. They need rules to raise finance in complex ways. They need to organize large numbers of people who are not known to them. They&#8217;re nameless, faceless people. So you need to have a contract-based rule of law system.</p><p>And so in advanced countries, generally speaking, most powerful organizations want a rule of law. And the difference in developing countries is that the powerful organizations are networks, which are informal patronage networks, kin networks, clientelist networks, tribal networks, religious networks, or even companies which are not that capable themselves, and their interactions with each other do not require a rule of law. And therefore a lot of their activity of lobbying, pressuring, and so on is informal. So I don&#8217;t think this is very much to do with culture or other kinds of things like that, although they do matter. It&#8217;s largely to do with the very nature of development, that developing countries have a preponderance of organizations that don&#8217;t need a rule of law. And yet, the fact that they don&#8217;t need a rule of law can stop high-capability organizations from developing.</p></blockquote><p>The scale-free regulative development view on this is that <strong>economic entities embody </strong><em><strong>multiscale competence architectures</strong></em><strong> (MCAs) a.k.a. </strong><em><strong>Quantum Reference Frames</strong></em><strong> (QRFs) </strong>[2]. The more complicated and capable in predicting their environments QRFs are, the more compressed messages they can communicate across the organisational boundary, but to do this effectively they need sophisticated <em>languages</em> or protocols, i.e., institutions.</p><p>Also, clearly, advanced organisations need the environment of other organisations that are at least comparably advanced to cooperate and compete with via the institutional mediums.</p><p>The morphological space <strong>(morphospace) of the socioeconomy is thus the space of organisation of economic and social activity, embodied by entities, sub-entities (agents, humans, and AIs), and the patterns of their interaction</strong>: institutions, horizontal networks, corporate, national, and trade boundaries.</p><h3>Subsidies and protectionism help with industrial development when organisations don&#8217;t have the political networks to capture the rent</h3><p>Khan describes how subsides work to develop the Korean industry because after the WWII the high-level networks between organisations and political figures (i.e., QRFs that are high in the hierarchy) have been decimated because they were previously &#8220;implemented with&#8221; Japanese who were all gone [1]:</p><blockquote><p>[&#8230;] the real difference was the nature of Japanese colonialism in breaking up many horizontal political networks in Korea. And that was because Japanese colonialism was a very aggressive and oppressive form of colonialism. It didn&#8217;t rule through intermediate classes in its colonies, it ruled directly, and it ruled through great force and great viciousness, which is why you will not find any Korean today or any Chinese today who has a good word to say about Japanese colonialism, because it was very rough.</p><p>One consequence of that was that those horizontal networks &#8212; which businesses have with politics and other groups and unions and so on &#8212; were actually decimated in South Korea. So, <strong>the business groups that emerged in the post-Japanese period did not have the networks to protect their rents, did not have the connections with politics.</strong> So, now in the 1960s <a href="https://en.wikipedia.org/wiki/Park_Chung-hee">Park Chung-hee</a> comes on and he starts trying things which are, in a sense, quite obvious. We can&#8217;t produce these things, so why don&#8217;t we give some export subsidies? Why don&#8217;t we give some protection? Why don&#8217;t we give them some low-cost loans from the publicly owned banks? Things which every developing country has tried. It&#8217;s not rocket science. It&#8217;s obvious, you can&#8217;t produce these things, your productivity is low, let&#8217;s help our businesses.</p><p>The difference was not that the South Koreans had innovated something called industrial policy. Everybody and their dog was trying it at that time. In fact, the South Koreans learned a lot from Pakistan, which also had a military government at that time and was doing exactly the same things: export subsidies, import protection, low-cost loans to large business houses, et cetera. [&#8230;] Why don&#8217;t we share these rents and prevent anyone from taking it away? <strong>The South Koreans couldn&#8217;t do that, because these companies were not connected to the banks, to the politicians, and so on. And therefore, when the state gave these subsidies and they said to them, &#8220;You have to achieve these export targets,&#8221; there was no way they could protect their rents if they failed to achieve the targets.</strong></p><p>These companies were quite happy to give kickbacks, by the way, to Park Chung-hee, to the top leaders. We know this now because there&#8217;s a lot of evidence about the corruption in the system at that time, just as we know the corruption in the Chinese system in the 1980s, when it was growing rapidly. The difference is this, if you&#8217;re Park Chung-hee and you know this company is not meeting its export target, but is willing to give me a kickback from my subsidy, do I want that, or do I want to give this subsidy to a company which will meet the export target and therefore will make lots of profits and therefore will be able to give me a kickback which is much bigger? Again, it&#8217;s not rocket science. If you&#8217;re Park Chung-hee you will say, &#8220;This is a failed company, it&#8217;s just giving me back some of my own money as a kickback. Why should I take that? I&#8217;ll close it down and I&#8217;ll shift that subsidy, that protection, to some other company.&#8221;</p></blockquote><p>This phenomena looks exactly like <a href="https://en.wikipedia.org/wiki/Metamorphosis">metamorphosis</a>. To build new advanced structures (high-capability organisation), it&#8217;s sometimes not enough just to provide the energy (subsidies): some of the existing advanced structures also need to be destroyed. This is completely obvious when we talk about &#8220;spatial&#8221; (&#8220;substance&#8221;) re-structuring (which we may think what mostly is going on in standard biological metamorphosis). The important insight here is that information exchange networks should be thought of just as physical<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-9" href="#footnote-9" target="_self">9</a> as biological cell, tissue, and organ connections, and changing them requires expending free energy.</p><h3>Methodological pluralism and pragmatism</h3><p>Khan doesn&#8217;t say that his political settlement framework, or institutional economics more generally answer <em>all</em> interesting questions about the economy. Thus, he is against a totalising view that any respectable economic theory should be a &#8220;theory of everything&#8221;. Instead, he endorses picking up pragmatically any economic theory that already exists and seems best equipped to answer this or that question that the economist has, very much in the &#8220;all models are wrong, but some are useful&#8221; style [1]:</p><blockquote><p>I don&#8217;t think it&#8217;s actually even feasible to have a political economy textbook, because it would be too big. There are too many different questions. Political economy is basically about how the world works. You can&#8217;t put that in a textbook. There are going to be different positions. Those different positions are not a problem. They are a good thing. Because nobody knows the truth. Nobody knows the right answer. But we each have our own angle, our own take. We can explain lots of things, but others can explain things in a slightly different way. And so I would say a good policymaker needs to have an awareness of different schools of thought, different methods, and so on. For some problems, the neoclassical approach might be actually quite good. For other approaches, it might be not only useless but dangerous. It might actually make things worse.</p><p>[&#8230;] I think&nbsp;<strong>each framework has some basic questions that they&#8217;re asking, and then they&#8217;re answering them in some ways. If you look at the political settlements framework, it is asking a number of questions about policy implementation, and the interface between organizational power and institutions, and then asking you to locate your policy in a way that will make incremental changes effective.</strong>&nbsp;Then everything else follows from that. You need lots of different building blocks to make sense of it. As you rightly say, you can draw on neoclassical economics, you can draw on other political economy frameworks.</p><p>[&#8230;] In the same way, if you look at Acemoglu, Johnson, and Robinson, their framing question is, &#8220;Are your institutions extractive or inclusive?&#8221; And then everything else is circling around that. Or is it a limited access order or an open access order? What are the different types of limited access orders, and what are the doorstep conditions?</p><p>[&#8230;] In neoclassical economics, the organizing principle is that people negotiate their own agreements at an individual level. The market is nothing but a set of contracts between people which are voluntarily made. You can explain quite a lot in terms of the voluntary contracts that people make, and the reasons why they can&#8217;t make those voluntary contracts. But at a deeper level, you&#8217;re not asking,&nbsp;<strong>&#8220;Why do people behave like that? Which contracts are enforced? Which contracts aren&#8217;t enforced?&#8221; As soon as you start asking that, you can&#8217;t just look at individuals. You&#8217;re looking at power structures. You&#8217;re looking at society.</strong>&nbsp;You&#8217;re looking at history.</p><p>In that sense, neoclassical economics is at the bottom of this food chain in asking about the individual contracting, which is really important and useful, but, actually, most of the interesting questions are about why those contracts aren&#8217;t enforced. That is how Douglass North began the journey of institutional economics in saying property rights and contracts may exist but they&#8217;re often not enforced.</p><p>Enforcement, I think, is the key. Enforcement takes you to all of those political economy questions which different people are cutting in different ways. But if you look at all the different political economy frameworks, just asking the same basic question, &#8220;How is the organization of society and of the collective organization affecting how individuals behave?&#8221; Whereas&nbsp;<strong>the neoclassical is starting from the other end, saying, &#8220;Let&#8217;s take preferences as given. Let&#8217;s take the constraints as given. This is how individuals behave.&#8221; And political economy is saying, &#8220;That&#8217;s trivial. You forgot the most important parts of the story of how we got there. How they finally make the contract is the most trivial part of the story.&#8221;</strong></p><p>I think all of these things are connected. But I think that&nbsp;<strong>the really important questions about how social organization/social power affect how individuals behave, contract, the belief systems they have, how they enforce rules on each other, how they punish each other, these are historically specific questions&nbsp;</strong><em><strong>to which you cannot have a general theory.</strong></em>&nbsp;[&#8230;]</p></blockquote><h2>Open questions for future research</h2><h3>Morphological intelligence of socioeconomies</h3><p><em>Morphological intelligence</em> is the ability of an organism to solve problems in the morphospace, such as metamorphosis and regeneration. This is an important concept in Levin&#8217;s framework. It sounds like it would be good for our socioeconomies to be highly morphologically intelligent and be able to reinvent themselves without revolutions or special circumstances, such as a withdrawal of an oppressive colonial regime, such as Japanese regime in Korea discussed above. Note that morphological intelligence is separate from <em>metacognition</em>, that seems to correspond to governance and political processes in socioeconomies.</p><p>As far as I understand, it&#8217;s not yet clear what permits organisms of some species, such as frogs<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-10" href="#footnote-10" target="_self">10</a> and salamanders<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-11" href="#footnote-11" target="_self">11</a> to be more morphologically intelligent than others, such as humans. However, if it is confirmed to be in some sense strongly correlated with the complexity of the signals that are processed and exchanged by the constituent elements of morphologically intelligent organisms, this could be bad news for the complexity of human intelligence and consciousness. Some food for analogical thought in this direction: colonies of eusocial insects can regenerate large parts of their structure and &#8220;headcount&#8221;, i.e., are morphologically intelligent, although bees are sometimes considered as highly intelligent among insects, unlike ants. Though, of course, insects are vastly dumber than humans.</p><p>Note that this would not contradict the experience of great collectivist, development, organisational projects of the 20th century, such as the <a href="https://en.wikipedia.org/wiki/Industrialization_in_the_Soviet_Union">industrialisation in the Soviet Union</a> which are commonly believed to be bottlenecked (or made very inefficient) by poor education of the people: the ability to <em>organise</em> (development) is not the same as the ability to *re-*organise (morphological intelligence)! Nor would this potential negative finding (of requiring relatively &#8220;dumb&#8221; units for achieving high morphological intelligence on the collective level) repeat the common idea in dystopian sci-fi literature that people need to be &#8220;dumbed down&#8221; to ensure control, stability, and the &#8220;common good&#8221;: actually, a morphologically intelligent socioeconomy would be <em>agile</em> and <em>resilient</em> to external challenges, rather than be extremely static and brittle, as commonly depicted in dystopias. Still, there are definitely dystopian overtones to this idea and I think it deserves serious thought. Cf. the last paragraph <a href="https://www.lesswrong.com/posts/AKBkDNeFLZxaMqjQG/gaia-network-a-practical-incremental-pathway-to-open-agency#Open_research_questions_and_risks">here</a><a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-12" href="#footnote-12" target="_self">12</a> and Beren Millidge&#8217;s &#8220;<a href="https://www.lesswrong.com/posts/d74pb97TAqNKwJkc5/bcis-and-the-ecosystem-of-modular-minds">BCIs and the ecosystem of modular&nbsp;minds</a>&#8221;.</p><p>The morphological intelligence of socioeconomic structures may also depend on the scale: at least some companies, such as Amazon, Microsoft, and Adobe have historically demonstrated impressive agility and capacity to reorganise in response to changing environment, and this depended on their highly intelligent employees! So, low morphological intelligence of states may tell us more about these constructs than about the future of human intelligence and consciousness.</p><h3>Hyper-developmental biology and the distribution of organisational capabilities</h3><p>Hyper-developmental biology has been <a href="https://thoughtforms.life/what-groups-of-embryos-know-toward-a-hyper-developmental-biology/">proposed by Levin</a><a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-13" href="#footnote-13" target="_self">13</a> to describe the collective intelligence of a group of embryos developing together and sharing boundaries. This must be closely related to Khan&#8217;s emphasis on <em>the</em> <em>distribution of organisational capabilities</em> as the key to economic development and prosperity itself [1]:</p><blockquote><p>The aim is to help the development of capabilities and organizations with capabilities that eventually results in higher levels of welfare for people, better lives.</p></blockquote><blockquote><p>[&#8230;] it comes back to what your normative goals of development are. And I&#8217;ve given you my normative goal. My normative goal is, I want to see a broader spread of organizational capabilities. Because I think that underpins almost everything else. Even if you wanted to fight poverty, I would ask how do I get poor people to have the capabilities to produce things for themselves and engage in activities for themselves, rather than just give handouts.</p></blockquote><p>The observation that advanced organisations need (or &#8220;want&#8221;) other advanced organisations to be their suppliers, partners, and consumers that I noted in the section &#8220;Advanced organisations and institutions need each other&#8221; is just the simplest one. But I think something more insightful could be learned from biology on this topic. Or, vice versa, something could be learned from economics and applied to biology? For example, could the surprising result that cross-embryo morphogenetic assistance is more effective when <em>all</em> embryos are exposed to a chemical that disturbs normal embryo development than when only <em>half</em> of the embryos are exposed<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-14" href="#footnote-14" target="_self">14</a> be interpreted in economic terms, such as that &#8220;self-interested&#8221; embryos, like companies, are usually not eager to help their competitors when the latter are suddenly affected by some calamity?</p><p>People have started to discuss the economic analogy in the <a href="https://thoughtforms.life/what-groups-of-embryos-know-toward-a-hyper-developmental-biology/#comment-640">comments</a> to Levin&#8217;s post already!</p><h3>Lessons for the AI transition of the socioeconomy</h3><p>I&#8217;m primarily interested in the regulative development framework that I connected with institutional economics above insofar as what it tells us about the likely trajectory of the AI transition of the socioeconomies, and most importantly, <strong>how to design policies that will achieve the intended developmental goals in the context of AI transition</strong>, which is the main focus of Khan&#8217;s work.</p><ul><li><p>How to prevent pathological growth of the socioeconomy due to the influx of AI agents (a la Mustafa Suleyman&#8217;s ACIs)?</p></li><li><p>What kind of language will help autonomous organisations to <em>persuade</em> <em>each other rationally</em> [4] and negotiate <em>nuanced</em> and <em>ethical</em> collective goals? See also the discussion of this theme in &#8220;<a href="https://engineeringideas.substack.com/p/worrisome-misunderstanding-of-the">Worrisome misunderstanding of the core issues with AI transition</a>&#8221;.</p></li><li><p>How to prevent shrinkage and simplification of human participation in the economy (e.g., due to <a href="https://www.lesswrong.com/posts/oSPhmfnMGgGrpe7ib/properties-of-current-ais-and-some-predictions-of-the#Cognitive_globalisation">cognitive globalisation</a><a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-15" href="#footnote-15" target="_self">15</a>) that will lead to the reduction of people&#8217;s bargaining power and will adversely affect and may even destabilise the political balance and governance institutions?</p></li></ul><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-1" href="#footnote-anchor-1" class="footnote-number" contenteditable="false" target="_self">1</a><div class="footnote-content"><p>Khan, M. &amp; Wiblin, R. (2021). <a href="https://80000hours.org/podcast/episodes/mushtaq-khan-institutional-economics/">Mushtaq Khan on using institutional economics to predict effective government reforms</a></p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-2" href="#footnote-anchor-2" class="footnote-number" contenteditable="false" target="_self">2</a><div class="footnote-content"><p>Fields, C., &amp; Levin, M. (2022). <em>Regulative development as a model for origin of life and artificial life studies</em> [Preprint]. PsyArXiv. <a href="https://doi.org/10.31234/osf.io/rdt7f">https://doi.org/10.31234/osf.io/rdt7f</a></p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-3" href="#footnote-anchor-3" class="footnote-number" contenteditable="false" target="_self">3</a><div class="footnote-content"><p>Levin, M. (2023). <em>Collective Intelligence of Morphogenesis as a Teleonomic Process</em> (pp. 175&#8211;198). <a href="https://doi.org/10.7551/mitpress/14642.003.0013">https://doi.org/10.7551/mitpress/14642.003.0013</a></p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-4" href="#footnote-anchor-4" class="footnote-number" contenteditable="false" target="_self">4</a><div class="footnote-content"><p>Levin, M. (2022). Technological Approach to Mind Everywhere: An Experimentally-Grounded Framework for Understanding Diverse Bodies and Minds. <em>Frontiers in Systems Neuroscience</em>, <em>16</em>, 768201. <a href="https://doi.org/10.3389/fnsys.2022.768201">https://doi.org/10.3389/fnsys.2022.768201</a></p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-5" href="#footnote-anchor-5" class="footnote-number" contenteditable="false" target="_self">5</a><div class="footnote-content"><p>Friston, K. J., Ramstead, M. J. D., Kiefer, A. B., Tschantz, A., Buckley, C. L., Albarracin, M., Pitliya, R. J., Heins, C., Klein, B., Millidge, B., Sakthivadivel, D. A. R., Smithe, T. S. C., Koudahl, M., Tremblay, S. E., Petersen, C., Fung, K., Fox, J. G., Swanson, S., Mapes, D., &amp; Ren&#233;, G. (2022). <em>Designing Ecosystems of Intelligence from First Principles</em> (arXiv:2212.01354). arXiv. <a href="http://arxiv.org/abs/2212.01354">http://arxiv.org/abs/2212.01354</a></p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-6" href="#footnote-anchor-6" class="footnote-number" contenteditable="false" target="_self">6</a><div class="footnote-content"><p>This approach is also called <a href="https://plato.stanford.edu/archives/win2023/entries/holism-social/">methodological holism</a>. However, Khan also recognises individualist explanations of the socioeconomic phenomena: see the &#8220;Methodological pluralism and pragmatism&#8221; section below.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-7" href="#footnote-anchor-7" class="footnote-number" contenteditable="false" target="_self">7</a><div class="footnote-content"><p>Fields, C., Friston, K., Glazebrook, J. F., Levin, M., &amp; Marcian&#242;, A. (2022). The free energy principle induces neuromorphic development. <em>Neuromorphic Computing and Engineering</em>, <em>2</em>(4), 042002. <a href="https://doi.org/10.1088/2634-4386/aca7de">https://doi.org/10.1088/2634-4386/aca7de</a></p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-8" href="#footnote-anchor-8" class="footnote-number" contenteditable="false" target="_self">8</a><div class="footnote-content"><p>Fields, C., Fabrocini, F., Friston, K., Glazebrook, J. F., Hazan, H., Levin, M., &amp; Marcian&#242;, A. (2023). <em>Control flow in active inference systems</em>. OSF Preprints. <a href="https://doi.org/10.31219/osf.io/8e4ra">https://doi.org/10.31219/osf.io/8e4ra</a></p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-9" href="#footnote-anchor-9" class="footnote-number" contenteditable="false" target="_self">9</a><div class="footnote-content"><p>Fields, C., Glazebrook, J. F., &amp; Marciano, A. (2022). The Physical Meaning of the Holographic Principle. <em>Quanta</em>, <em>11</em>(1), 72&#8211;96. <a href="https://doi.org/10.12743/quanta.v11i1.206">https://doi.org/10.12743/quanta.v11i1.206</a></p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-10" href="#footnote-anchor-10" class="footnote-number" contenteditable="false" target="_self">10</a><div class="footnote-content"><p>Vandenberg, L. N., Adams, D. S., &amp; Levin, M. (2012). Normalized shape and location of perturbed craniofacial structures in the Xenopus tadpole reveal an innate ability to achieve correct morphology. <em>Developmental Dynamics: An Official Publication of the American Association of Anatomists</em>, <em>241</em>(5), 863&#8211;878. <a href="https://doi.org/10.1002/dvdy.23770">https://doi.org/10.1002/dvdy.23770</a></p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-11" href="#footnote-anchor-11" class="footnote-number" contenteditable="false" target="_self">11</a><div class="footnote-content"><p>Arenas G&#243;mez, C. M., &amp; Echeverri, K. (2021). Salamanders: The molecular basis of tissue regeneration and its relevance to human disease. <em>Current Topics in Developmental Biology</em>, <em>145</em>, 235&#8211;275. <a href="https://doi.org/10.1016/bs.ctdb.2020.11.009">https://doi.org/10.1016/bs.ctdb.2020.11.009</a></p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-12" href="#footnote-anchor-12" class="footnote-number" contenteditable="false" target="_self">12</a><div class="footnote-content"><p>Kaufmann, R., &amp; Leventov, R. (2023). <em>Gaia Network: A practical, incremental pathway to Open Agency Architecture</em>. <a href="https://www.lesswrong.com/posts/AKBkDNeFLZxaMqjQG/gaia-network-a-practical-incremental-pathway-to-open-agency">https://www.lesswrong.com/posts/AKBkDNeFLZxaMqjQG/gaia-network-a-practical-incremental-pathway-to-open-agency</a></p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-13" href="#footnote-anchor-13" class="footnote-number" contenteditable="false" target="_self">13</a><div class="footnote-content"><p>Levin, M. (2024, January 17). <em>What groups of embryos know: Toward a hyper-developmental biology</em>. Forms of Life, Forms of Mind. <a href="https://thoughtforms.life/what-groups-of-embryos-know-toward-a-hyper-developmental-biology/">https://thoughtforms.life/what-groups-of-embryos-know-toward-a-hyper-developmental-biology/</a></p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-14" href="#footnote-anchor-14" class="footnote-number" contenteditable="false" target="_self">14</a><div class="footnote-content"><p>Tung, A., Sperry, M. M., Clawson, W., Pavuluri, A., Bulatao, S., Yue, M., Flores, R. M., Pai, V. P., McMillen, P., Kuchling, F., &amp; Levin, M. (2024). Embryos assist morphogenesis of others through calcium and ATP signaling mechanisms in collective teratogen resistance. <em>Nature Communications</em>, <em>15</em>(1), Article 1. <a href="https://doi.org/10.1038/s41467-023-44522-2">https://doi.org/10.1038/s41467-023-44522-2</a></p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-15" href="#footnote-anchor-15" class="footnote-number" contenteditable="false" target="_self">15</a><div class="footnote-content"><p>Leventov, R. (2022). <em>Properties of current AIs and some predictions of the evolution of AI from the perspective of scale-free theories of agency and regulative development</em>. <a href="https://www.lesswrong.com/posts/oSPhmfnMGgGrpe7ib/properties-of-current-ais-and-some-predictions-of-the">https://www.lesswrong.com/posts/oSPhmfnMGgGrpe7ib/properties-of-current-ais-and-some-predictions-of-the</a></p><p></p></div></div>]]></content:encoded></item><item><title><![CDATA[Worrisome misunderstanding of the core issues with AI transition]]></title><description><![CDATA[This post is triggered by &#8220;Generative AI dominates Davos discussions as companies focus on accuracy&#8221; (CNBC) and &#8220;AI has a trust problem &#8212; meet the startups trying to fix it&#8221; (Sifted).]]></description><link>https://engineeringideas.substack.com/p/worrisome-misunderstanding-of-the</link><guid isPermaLink="false">https://engineeringideas.substack.com/p/worrisome-misunderstanding-of-the</guid><dc:creator><![CDATA[Roman Leventov]]></dc:creator><pubDate>Fri, 19 Jan 2024 10:05:43 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!EJj2!,w_256,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fbucketeer-e05bbc84-baa3-437e-9518-adb32be77984.s3.amazonaws.com%2Fpublic%2Fimages%2F55443e67-0a66-4164-8473-09b13a2e90ca_256x256.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>This post is triggered by &#8220;<a href="https://www.cnbc.com/2024/01/17/generative-ai-dominates-davos-discussions-as-companies-focus-on-accuracy.html">Generative AI dominates Davos discussions as companies focus on accuracy</a>&#8221; (CNBC) and &#8220;<a href="https://sifted.eu/articles/ai-has-a-trust-problem-meet-the-startups-trying-to-fix-it">AI has a trust problem &#8212; meet the startups trying to fix it</a>&#8221; (Sifted).</p><p>It's just remarkable (and worrying) how business leaders and journalists misunderstand the core issues with AI adoption and transition<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-1" href="#footnote-1" target="_self">1</a>. All they talk about is "accuracy", "correctness", and "<em>proving</em> that AI is <em>actually</em> <em>right</em>"(!). The second piece has a hilarious passage &#8220;Cassar says this aspect of AI systems creates a trust issue because it goes against the <em>human instinct to make &#8216;rule-based&#8217; decisions</em>.&#8221;(!)</p><p>There are many short- and medium-term applications where this "rule-following and accuracy" framing of the issue is correct, but they are all, by necessity, about <strong>automating and greasing bureaucratic procedures</strong> and formal compliance with rule books: filing tax forms, checking compliance with the law, etc. But these applications are not intrinsically productive, and on a longer time scale, they may lead to a <a href="https://en.wikipedia.org/wiki/Jevons_paradox">Jevons effect</a>: the cheaper bureaucratic compliance becomes, the more it is demanded, without actually making coordination, cooperation, and control more reliable and safe.</p><h2>"Factual accuracy" and hallucinations are the lowest-hanging pieces of context alignment</h2><p>Taking the viewpoints of information theory<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-2" href="#footnote-2" target="_self">2</a>, philosophy of language, and institutional economics<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-3" href="#footnote-3" target="_self">3</a>, it's not the sophistication of bureaucracies that reduces the cumulative risk exposure and transaction costs of the interaction between humans, AIs, and organisations. Rather, it's <strong>building </strong><em><strong>shared reference frames</strong></em><strong> (shared </strong><em><strong>language</strong></em><strong>) for these agents to communicate about their preferences, plans, and risks</strong>. The sophistication of bureaucratic procedures sometimes does have this effect (new concepts are invented that increase the expressiveness of communication about preferences, plans, and risks), but this is only an accidental byproduct of this bureaucratisation process. And then, making AIs use language effectively to communicate with humans and each other is not an "accuracy" or "factual correctness" problem, it's the <em>context</em> <em>(meaning, intent, outer) alignment</em> problem.</p><p>Indeed, <strong>this is the core problem that Perplexity, Copilot, Bard, OpenAI, and other universal RAG helpers are facing: alignment with users&#8217; context, on a hierarchy of timescales: pre-training</strong><a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-4" href="#footnote-4" target="_self">4</a><strong>, fine-tuning</strong><a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-5" href="#footnote-5" target="_self">5</a><strong>, RAG dataset curation, and </strong><em><strong>online alignment through a dialogue with the user</strong></em><a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-6" href="#footnote-6" target="_self">6</a>. Preventing outright hallucinations is just the lowest-hanging part of this problem. And <strong>&#8220;aligning LLMs with human values&#8221; is hardly a part of this problem at all</strong>. Perhaps, the fact that this kind of &#8220;value alignment&#8221; is surprisingly ineffective in combatting jailbreaks evidences that jailbreaks expose the deeper problem, that is, <em>misunderstanding of the user&#8217;s context</em> (and therefore user&#8217;s <em>intent</em>, which is <em>in the coupling between the user and their environment/context</em>, from the enactivist perspective).</p><p>Then, as far as scale-free biology and Active Inference agency are concerned<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-7" href="#footnote-7" target="_self">7</a><a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-8" href="#footnote-8" target="_self">8</a><a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-9" href="#footnote-9" target="_self">9</a>, there is no difference between <em>understanding</em> a context and <em>alignment with</em> a context, and hence we have the <strong><a href="https://www.lesswrong.com/posts/D7PumeYTDPfBTp3i7/the-waluigi-effect-mega-post">Waluigi effect</a> that can only be addressed on the meta-cognitive level</strong> (output filters, meta-cognitive dialogue, and other approaches). Therefore, <strong>sharing arbitrary capable &#8220;bare&#8221; LLMs in open-source is inherently risky and there is no way to fix this with pre-training or fine-tuning</strong>. Humans have evolved to have obligatory meta-cognition for a good reason!</p><h2>Real &#8220;safe and reliable reasoning&#8221; is compositional reasoning and provably correct computing</h2><p><strong>It's richer language, better context alignment, and better capacities for (compositional, collective) reasoning, bargaining, planning, and decision-making</strong><a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-10" href="#footnote-10" target="_self">10</a><strong>&nbsp;that make the economy more productive and civilisation (and </strong><em><strong>Gaia</strong></em><strong>) safer at the end of the day, not &#8220;better bureaucracies&#8221;.</strong> To a degree, we can also think about bureaucracies as scaffolding for "better reasoning, bargaining, planning, and decision-making". There is some grain of truth in this view, but again, nobody currently thinks about bureaucracies, rule books, and compliance in this way and this only happens as an accidental side-effect of bureaucratisation.</p><p>In this sense, <strong>making LLMs "accurate" and "correct" followers of some formal rules hardly moves the needle of </strong><em><strong>reasoning correctness (accuracy)</strong></em><strong> forward</strong>. The right agenda for improving the correctness and accuracy of reasoning is scaffolding it in (or delegating it to) more "traditional" computing paradigms: symbolic and statistical, such as algorithms written in probabilistic programming languages (calling to NN modules), or other neurosymbolic frameworks, and <strong>generating mathematical proofs of correctness for the algorithms</strong><a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-11" href="#footnote-11" target="_self">11</a>. The last two miles of safety on this agenda would be</p><ol><li><p>Proving the NN components themselves by treating them as humongous but precise statistical algorithms to rule out some forms of <a href="https://www.lesswrong.com/tag/deceptive-alignment">deceptive alignment</a><a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-12" href="#footnote-12" target="_self">12</a>, and</p></li><li><p>Generating proofs for <em>hardware</em> correctness and tamper-safety&nbsp;that is going to run the above software (see Tegmark and Omohundro, 2023).</p></li></ol><h2>The bottom line: AI safety = context alignment + languages and protocols + provably correct computing + governance mechanisms, incentive design, and immune systems</h2><p><strong>AI safety =</strong><br><strong>Context alignment</strong> throughout pre-training, fine-tuning, and online inference&nbsp;<strong>+</strong><br><strong>Languages and protocols</strong> for context alignment and (collective) reasoning (negotiation, bargaining, coordination, planning, decision-making) about preferences, plans, and risk bounding to make them (alignment and reasoning) effective, precise, and compositional&nbsp;<strong>+</strong><br><strong>Provably correct computing</strong> <strong>+</strong><br>(Not covered in this post) <strong>governance mechanisms, incentive design, and immune systems</strong> to negotiate and encode high-level, collective preferences, goals, and plans and ensure that the collective sticks to the current versions of these.<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-13" href="#footnote-13" target="_self">13</a></p><p>Note that <strong>&#8220;control&#8221;, &#8220;rule following&#8221; (a.k.a. bureaucratisation), &#8220;trust&#8221;, and &#8220;value alignment&#8221; are not parts of the above decomposition of the problem of making beneficial transformative AI</strong> (cf. Davidad&#8217;s <a href="https://www.lesswrong.com/posts/Wi4RAJCbh3qD9fynj/ai-neorealism-a-threat-model-and-success-criterion-for">AI Neorealism</a>). They in some sense emerge or follow from the interaction of the components listed above.</p><p>In general, I&#8217;m a <a href="https://www.lesswrong.com/posts/FnwqLB7A9PenRdg4Z/for-alignment-we-should-simultaneously-use-multiple-theories">methodological pluralist</a> and open to the idea that &#8220;control&#8221; and &#8220;value alignment&#8221; frames capture <em>something</em> about AI safety and alignment that is not captured by the above decomposition. Still, I think it is very small and not commensurate to the attention share that these frames receive from the public, key decision-makers, and even the AGI labs and the AI safety community. <strong>This is ineffective and could also instil dangerous overconfidence and delude decision-makers and the public about the actual progress on AI safety and the risks of the AI transition</strong>.</p><p>Even then, bureaucratisation is probably just net harmful.</p><p>&#8220;Trust&#8221;, while important from the sociotechnical perspective and for optimal adoption of the technology, should not result in oversimplification of algorithms and concepts so that people understand them: this would just increase the &#8220;alignment tax&#8221; and would be ultimately futile, and <em>also</em> unnecessary if we have mathematical proofs for the correctness of protocols and algorithms. So, I think that to address the trust issue, AI developers and the AI community will ultimately need to <strong>educate decision-makers and the public about the difference between &#8220;trust in science&#8221; (context alignment) and &#8220;trust in math&#8221; (algorithms and computing), being vigilant about the former, and not unduly questioning the latter.</strong></p><div><hr></div><p><em>This post has been originally published on <a href="https://www.lesswrong.com/posts/xqQDsDovPaiYGhXnE/worrisome-misunderstanding-of-the-core-issues-with-ai">LessWrong</a>.</em></p><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-1" href="#footnote-anchor-1" class="footnote-number" contenteditable="false" target="_self">1</a><div class="footnote-content"><p>I realise that business leaders may also be not <em>interested</em> in this problem, but then it&#8217;s <em>our</em>, i.e., AI (safety) community&#8217;s and the public problem to influence the businesses to recognise the problem, or else businesses will externalise the risks onto all of us.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-2" href="#footnote-anchor-2" class="footnote-number" contenteditable="false" target="_self">2</a><div class="footnote-content"><p>Fields, C., Fabrocini, F., Friston, K., Glazebrook, J. F., Hazan, H., Levin, M., &amp; Marcian&#242;, A. (2023). <em>Control flow in active inference systems</em>. OSF Preprints. <a href="https://doi.org/10.31219/osf.io/8e4ra">https://doi.org/10.31219/osf.io/8e4ra</a></p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-3" href="#footnote-anchor-3" class="footnote-number" contenteditable="false" target="_self">3</a><div class="footnote-content"><p>Khan, M. &amp; Wiblin, R. (2021). <a href="https://80000hours.org/podcast/episodes/mushtaq-khan-institutional-economics/">Mushtaq Khan on using institutional economics to predict effective government reforms</a></p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-4" href="#footnote-anchor-4" class="footnote-number" contenteditable="false" target="_self">4</a><div class="footnote-content"><p>This is what OpenAI&#8217;s <a href="https://www.lesswrong.com/posts/Hna4aoMwr6Qx9rHBs/linkpost-introducing-superalignment">Superalignment agenda</a> is about.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-5" href="#footnote-anchor-5" class="footnote-number" contenteditable="false" target="_self">5</a><div class="footnote-content"><p>This is what Stuart Armstrong and Rebecca Gorman&#8217;s <a href="https://buildaligned.ai/company">Aligned AI</a> seems to tackle.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-6" href="#footnote-anchor-6" class="footnote-number" contenteditable="false" target="_self">6</a><div class="footnote-content"><p>This online inference is usually called &#8220;in-context learning&#8221; for LLMs, though note that the meaning of the word &#8220;context&#8221; is very different in this phrase from the meaning of &#8220;context&#8221; in quantum free energy principle<sup> </sup>and information theory.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-7" href="#footnote-anchor-7" class="footnote-number" contenteditable="false" target="_self">7</a><div class="footnote-content"><p>Fields, C., Friston, K., Glazebrook, J. F., &amp; Levin, M. (2022). A free energy principle for generic quantum systems. <em>Progress in Biophysics and Molecular Biology</em>, <em>173</em>, 36&#8211;59. <a href="https://doi.org/10.1016/j.pbiomolbio.2022.05.006">https://doi.org/10.1016/j.pbiomolbio.2022.05.006</a></p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-8" href="#footnote-anchor-8" class="footnote-number" contenteditable="false" target="_self">8</a><div class="footnote-content"><p>Pezzulo, G., Parr, T., Cisek, P., Clark, A., &amp; Friston, K. (2023). <em>Generating Meaning: Active Inference and the Scope and Limits of Passive AI</em> [Preprint]. PsyArXiv. <a href="https://doi.org/10.31234/osf.io/8xgzv">https://doi.org/10.31234/osf.io/8xgzv</a></p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-9" href="#footnote-anchor-9" class="footnote-number" contenteditable="false" target="_self">9</a><div class="footnote-content"><p>Fields, C., &amp; Levin, M. (2020). How Do Living Systems Create Meaning? <em>Philosophies</em>, <em>5</em>. <a href="https://doi.org/10.3390/philosophies5040036">https://doi.org/10.3390/philosophies5040036</a></p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-10" href="#footnote-anchor-10" class="footnote-number" contenteditable="false" target="_self">10</a><div class="footnote-content"><p><a href="https://www.lesswrong.com/tag/open-agency-architecture">Open Agency Architecture</a>, <a href="https://www.lesswrong.com/posts/AKBkDNeFLZxaMqjQG/gaia-network-a-practical-incremental-pathway-to-open-agency">Gaia Network</a>, Friston et al.&#8217;s <a href="https://arxiv.org/abs/2212.01354">Ecosystems of Intelligence</a>, <a href="https://www.lesswrong.com/tag/infra-bayesianism">Infra-Bayesianism</a>, and probably Conjecture&#8217;s <a href="https://www.lesswrong.com/posts/ngEvKav9w57XrGQnb/cognitive-emulation-a-naive-ai-safety-proposal">CoEms</a> are the agendas that I&#8217;m aware of that approach the design of effective, precise, and compositional (collective) reasoning languages and protocols.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-11" href="#footnote-anchor-11" class="footnote-number" contenteditable="false" target="_self">11</a><div class="footnote-content"><p>Tegmark, M., &amp; Omohundro, S. (2023). <em>Provably safe systems: The only path to controllable AGI</em> (arXiv:2309.01933). arXiv. <a href="https://doi.org/10.48550/arXiv.2309.01933">https://doi.org/10.48550/arXiv.2309.01933</a></p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-12" href="#footnote-anchor-12" class="footnote-number" contenteditable="false" target="_self">12</a><div class="footnote-content"><p>However, I don&#8217;t know how to deal with evolutionary and dynamic NN architectures, such as <a href="http://liquid.ai/">Liquid.ai</a>.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-13" href="#footnote-anchor-13" class="footnote-number" contenteditable="false" target="_self">13</a><div class="footnote-content"><p>Governance mechanisms should also include secession protocols for hedging against value lock-in and meta-ethical opportunity cost, but this is far outside the scope of this post.</p><p></p></div></div>]]></content:encoded></item><item><title><![CDATA[AGI will be made of heterogeneous components]]></title><description><![CDATA[Transformer and Selective SSM blocks will be among them. AI Safety R&D and AI governance implications]]></description><link>https://engineeringideas.substack.com/p/agi-will-be-made-of-heterogeneous</link><guid isPermaLink="false">https://engineeringideas.substack.com/p/agi-will-be-made-of-heterogeneous</guid><dc:creator><![CDATA[Roman Leventov]]></dc:creator><pubDate>Wed, 27 Dec 2023 17:15:23 GMT</pubDate><enclosure url="https://substackcdn.com/image/fetch/$s_!Xt5F!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1edf3eda-496c-4c2c-b22c-ef70a1c10791_1668x1747.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>This post is prompted by two recent pieces:</p><p>First, in the podcast "<a href="https://www.cognitiverevolution.ai/emergency-pod-mamba-memory-and-the-ssm-moment/">Emergency Pod: Mamba, Memory, and the SSM Moment</a>", Nathan Labenz described how he sees that we are entering the era of heterogeneity in AI architectures because currently we have not just one fundamental block that works very well (the Transformer block), but two kinds of blocks: the Selective SSM (Mamba) block has joined the party. These are natural opposites on the tradeoff scale between episodic cognitive capacity (Transformer's strong side) and long-term memorisation (selective SSM's strong side). So, we will probably quickly see the emergence of complicated hybrids between these two, trying to get the best from both types of blocks<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-1" href="#footnote-1" target="_self">1</a>.</p><p>This reminds me of John Doyle's <a href="https://docs.google.com/presentation/d/1reO-UK_RGrcVs4WY3-pYf9SexMerEvbTeTXckFXhUs8/edit#slide=id.g2478d5c2b63_0_5">architecture theory</a> that predicts that AI architectures will evolve towards modularisation and component heterogeneity, where the properties of different components (i.e., their positions at different tradeoff spectrums) will converge to reflect the statistical properties of heterogeneous objects (a.k.a. natural abstractions, patterns, "pockets of computational reducibility") in the environment.</p><p>Second, in <a href="https://systemsworld-club.translate.goog/t/strategii-praktiki-stili-metody-algoritmy-evolyuczii/8313?_x_tr_sl=auto&amp;_x_tr_tl=en&amp;_x_tr_hl=en-US&amp;_x_tr_pto=wapp&amp;_x_tr_hist=true">this article</a>, Anatoly Levenchuk rehearses the "no free lunch" theorem and enumerates some of the development directions in algorithms and computing that continue in the shadows of the currently dominant LLM paradigm, but still are going to be several orders of magnitude more computationally efficient than DNNs in some important classes of tasks: multi-physics simulations, discrete ("system 2") reasoning (planning, optimisation), theorem verification and SAT-solving, etc. All these diverse components are going to be plugged into some "<a href="https://twitter.com/karpathy%20/status/1707437820045062561">AI operating system</a>", Toolformer-style. Then Anatoly posits an important conjecture (slightly tweaked by me): <strong>as it doesn't make sense to discuss some person's "values" without considering (a) them in the context of their environment (family, community, humanity) and (b) their </strong><em><strong>education</strong></em><strong>, it's pointless to discuss the alignment properties and "values" of some "core" AGI agent architecture without considering the whole context of a quickly evolving "<a href="https://www.lesswrong.com/posts/5hApNw5f7uG8RXxGS/the-open-agency-model">open agency</a>" of various tools and specialised components</strong><a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-2" href="#footnote-2" target="_self">2</a><strong>.</strong></p><p>From these ideas, I derive the following conjectures about an "AGI-complete" architecture<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-3" href="#footnote-3" target="_self">3</a>:</p><p><strong>1. AGI could be achieved by combining </strong><em><strong>just</strong></em><br>&nbsp; &nbsp;<strong>(a) about five core types of DNN blocks</strong> (Transformer and Selective SSM are two of these, and most likely some kind of <a href="https://arxiv.org/abs/2310.01267">Graph Neural Network with or without flexible/dynamic/"liquid" connections</a> is another one, and perhaps a few more)<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-4" href="#footnote-4" target="_self">4</a>;<br>&nbsp; &nbsp;<strong>(b) a few dozen classical algorithms</strong> for <a href="https://www.lesswrong.com/tag/language-model-cognitive-architecture">LMAs</a> aka "<a href="https://arxiv.org/abs/2305.05364">LLM programs</a>" (better called "NN programs" in the more general case), from search and algorithms on graphs to dynamic programming, to orchestrate and direct the inference of the DNNs; and<br>&nbsp; &nbsp;<strong>(c) about a dozen or two key LLM tools required for generality</strong>, such as a multi-physics simulation engine like <a href="https://juliahub.com/products/juliasim/">JuliaSim</a>, a symbolic computation engine like Wolfram Engine, a theorem prover like <a href="https://github.com/leanprover/lean4">Lean</a>, etc.</p><p><strong>2. The AGI architecture described above will not be perfectly optimal, but it will probably be within an order of magnitude from the optimal compute efficiency on the tasks it is supposed to solve</strong><sup>(see footnote 3)</sup>, so, considering the investments in interpretability, monitoring, anomaly detection, red teaming, and other strands of R&amp;D about the incumbent types of DNN blocks and NN program/agent algorithms, as well as economic incentives of modularisation and component re-use (cf. "<a href="https://www.lesswrong.com/posts/d74pb97TAqNKwJkc5/bcis-and-the-ecosystem-of-modular-minds">BCIs and the ecosystem of modular minds</a>"), this will probably be a sufficient motivation to <strong>"lock in" the choices of the core types of DNN blocks</strong> that were used in the initial versions of AGI.</p><p><strong>3. In particular, the Transformer block is very likely here to stay until and beyond the first AGI architecture</strong> because of the enormous investment in it in terms of computing optimisation, specialisation to different tasks, R&amp;D know-how, and interpretability, and also, as I already noted above, because Transformer maximally optimises for episodic cognitive capacity and from the perspective of the architecture theory, it's valuable to have a DNN building block that occupies an extreme position on some tradeoff spectrum. (Here, I pretty much repeat the idea of Nathan Labenz, who said in his podcast that we are entering the "Transformer+" era rather than a "post-Transfromer" era.)</p><h2>Implications for AI Safety R&amp;D</h2><p>The three conjectures that I've posited above sharply contradict another view (which seems to me broadly held by a lot of people in the AI safety community) in which a complete overhaul of the AI architecture landscape is expected when some new shiny block architecture that beats all the incumbents will be invented<a class="footnote-anchor" data-component-name="FootnoteAnchorToDOM" id="footnote-anchor-5" href="#footnote-5" target="_self">5</a>.</p><p>It's hard for me to state the implications of taking one side in this crux in the abstract, but on a more concrete example, I think this position informs my inference that working on <a href="https://www.lesswrong.com/posts/YN7PHizHnxinLsKvy/sociallm-a-language-model-design-for-personalised-apps#Architecture_and_training">an architecture that combines Transformer and Selective SSM blocks and training techniques to engineer an inductive bias for greater "self-other overlap"</a> is an R&amp;D agenda with a relatively high expected impact. Compare with <a href="https://www.lesswrong.com/posts/qAdDzcBuDBLexb4fC/the-neglected-approaches-approach-ae-studio-s-alignment?commentId=ysxE8qui5wczSWYSR#ysxE8qui5wczSWYSR">this inference by Marc Carauleanu</a> (note: I don't state that he necessarily expects a complete AI architecture overhaul at some point, but it seems that somebody who thought that would agree with him that working on combining Transformer and Selective SSM blocks for safety is of low expected impact because the AGI that might make a sharp left turn will contain neither Transformer nor Selective SSM blocks).</p><h3>System-level explanation and control frameworks, mechanism design</h3><p>Both Drexler's Open Agency Model and Conjecture's CoEms are modular and heterogeneous as I predict the AGI architecture will be anyway, but I remarked in the comments to both that component-level alignment and interpretability is not enough to claim that the system as a whole is aligned and interpretable (<a href="https://www.lesswrong.com/posts/5hApNw5f7uG8RXxGS/the-open-agency-model?commentId=bKedALuWyWzMnMkF4">1</a>, <a href="https://www.lesswrong.com/posts/ngEvKav9w57XrGQnb/cognitive-emulation-a-naive-ai-safety-proposal?commentId=sZEfPMCSheNPwpLKD">2</a>).</p><p>My conjectures above call for <strong>more work on scientific frameworks to explain the behaviour of intelligent systems made of heterogeneous components (NNs or otherwise), and engineering frameworks for steering and monitoring such systems.</strong>&nbsp;</p><p>On the scientific side, see <a href="https://www.lesswrong.com/tag/free-energy-principle">Free Energy Principle/Active Inference</a> in all of its guises, <a href="https://www.lesswrong.com/tag/infra-bayesianism">Infra-Bayesianism</a>, Vanchurin&#8217;s <a href="https://arxiv.org/abs/2004.09280">theory of machine learning</a> (2021), <a href="https://scholar.google.com/citations?hl=en&amp;user=D37XAbIAAAAJ&amp;view_op=list_works&amp;sortby=pubdate">James Crutchfield</a>'s "thermodynamic ML" (or, more generally, Bahri et al.&#8217;s review of <a href="https://www.annualreviews.org/doi/abs/10.1146/annurev-conmatphys-031119-050745">statistical mechanics of deep learning</a> (2022)), <a href="https://chrisfieldsresearch.com/">Chris Fields</a>' quantum information theory, <a href="https://www.lesswrong.com/tag/singular-learning-theory">singular learning theory</a>. (If you know more general frameworks like these, please post in the comments!)</p><p>On the engineering (but also research) side, see Doyle's <a href="https://arxiv.org/abs/1904.01634">system-level synthesis</a>, DeepMind's <a href="https://causalincentives.com/">causal incentives working group</a>, the <a href="https://www.lesswrong.com/posts/AKBkDNeFLZxaMqjQG/gaia-network-a-practical-incremental-pathway-to-open-agency">Gaia Network</a> agenda, and <a href="https://arxiv.org/abs/2108.05318">compositional game theory</a>. (If you know more agendas in this vein, please post in the comments!)</p><h2>Implications for AI policy and governance</h2><p>The view that AGI will emerge from a rapidly evolving ecosystem of heterogeneous building blocks and specialised components makes me think that <strong>"intelligence containment", especially through </strong><em><strong>compute</strong></em><strong> governance, will be very short-lived</strong>.</p><p>Then, if we assume that the "<a href="https://en.wikipedia.org/wiki/G_factor_(psychometrics)">G factor</a>" containment is probably futile, AI policy and governance folks should perhaps start paying more attention to the <strong>governance of </strong><em><strong>competence</strong></em><strong> through the control of the access to the </strong><em><strong>training data</strong></em><strong>.</strong> This is what I proposed in "<a href="https://www.lesswrong.com/posts/CqYaazaG6EkovspMT/open-agency-model-can-solve-the-ai-regulation-dilemma">Open Agency model can solve the AI regulation dilemma</a>".</p><p>In the <a href="https://www.lesswrong.com/posts/AKBkDNeFLZxaMqjQG/gaia-network-a-practical-incremental-pathway-to-open-agency">Gaia Network proposal</a>, this governance is supposed to happen at the arrow from "Gaia Network" to "Decision Engines" that is labelled "Data and models (for simulations and training)" (note that "Decision Engines" are exactly the "AGI-complete" parts of this architecture, <em>not</em> the Gaia agents):</p><div class="captioned-image-container"><figure><a class="image-link image2 is-viewable-img" target="_blank" href="https://substackcdn.com/image/fetch/$s_!Xt5F!,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1edf3eda-496c-4c2c-b22c-ef70a1c10791_1668x1747.png" data-component-name="Image2ToDOM"><div class="image2-inset"><picture><source type="image/webp" srcset="https://substackcdn.com/image/fetch/$s_!Xt5F!,w_424,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1edf3eda-496c-4c2c-b22c-ef70a1c10791_1668x1747.png 424w, https://substackcdn.com/image/fetch/$s_!Xt5F!,w_848,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1edf3eda-496c-4c2c-b22c-ef70a1c10791_1668x1747.png 848w, https://substackcdn.com/image/fetch/$s_!Xt5F!,w_1272,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1edf3eda-496c-4c2c-b22c-ef70a1c10791_1668x1747.png 1272w, https://substackcdn.com/image/fetch/$s_!Xt5F!,w_1456,c_limit,f_webp,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1edf3eda-496c-4c2c-b22c-ef70a1c10791_1668x1747.png 1456w" sizes="100vw"><img src="https://substackcdn.com/image/fetch/$s_!Xt5F!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1edf3eda-496c-4c2c-b22c-ef70a1c10791_1668x1747.png" width="1456" height="1525" data-attrs="{&quot;src&quot;:&quot;https://substack-post-media.s3.amazonaws.com/public/images/1edf3eda-496c-4c2c-b22c-ef70a1c10791_1668x1747.png&quot;,&quot;srcNoWatermark&quot;:null,&quot;fullscreen&quot;:null,&quot;imageSize&quot;:null,&quot;height&quot;:1525,&quot;width&quot;:1456,&quot;resizeWidth&quot;:null,&quot;bytes&quot;:145755,&quot;alt&quot;:null,&quot;title&quot;:null,&quot;type&quot;:&quot;image/png&quot;,&quot;href&quot;:null,&quot;belowTheFold&quot;:true,&quot;topImage&quot;:false,&quot;internalRedirect&quot;:null,&quot;isProcessing&quot;:false,&quot;align&quot;:null,&quot;offset&quot;:false}" class="sizing-normal" alt="" srcset="https://substackcdn.com/image/fetch/$s_!Xt5F!,w_424,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1edf3eda-496c-4c2c-b22c-ef70a1c10791_1668x1747.png 424w, https://substackcdn.com/image/fetch/$s_!Xt5F!,w_848,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1edf3eda-496c-4c2c-b22c-ef70a1c10791_1668x1747.png 848w, https://substackcdn.com/image/fetch/$s_!Xt5F!,w_1272,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1edf3eda-496c-4c2c-b22c-ef70a1c10791_1668x1747.png 1272w, https://substackcdn.com/image/fetch/$s_!Xt5F!,w_1456,c_limit,f_auto,q_auto:good,fl_progressive:steep/https%3A%2F%2Fsubstack-post-media.s3.amazonaws.com%2Fpublic%2Fimages%2F1edf3eda-496c-4c2c-b22c-ef70a1c10791_1668x1747.png 1456w" sizes="100vw" loading="lazy"></picture><div class="image-link-expand"><div class="pencraft pc-display-flex pc-gap-8 pc-reset"><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container restack-image"><svg role="img" width="20" height="20" viewBox="0 0 20 20" fill="none" stroke-width="1.5" stroke="var(--color-fg-primary)" stroke-linecap="round" stroke-linejoin="round" xmlns="http://www.w3.org/2000/svg"><g><title></title><path d="M2.53001 7.81595C3.49179 4.73911 6.43281 2.5 9.91173 2.5C13.1684 2.5 15.9537 4.46214 17.0852 7.23684L17.6179 8.67647M17.6179 8.67647L18.5002 4.26471M17.6179 8.67647L13.6473 6.91176M17.4995 12.1841C16.5378 15.2609 13.5967 17.5 10.1178 17.5C6.86118 17.5 4.07589 15.5379 2.94432 12.7632L2.41165 11.3235M2.41165 11.3235L1.5293 15.7353M2.41165 11.3235L6.38224 13.0882"></path></g></svg></button><button tabindex="0" type="button" class="pencraft pc-reset pencraft icon-container view-image"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-maximize2 lucide-maximize-2"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" x2="14" y1="3" y2="10"></line><line x1="3" x2="10" y1="21" y2="14"></line></svg></button></div></div></div></a></figure></div><p></p><p>However, we didn't think about a concrete governance mechanism for this yet, and welcome collaborators to discuss it.</p><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-1" href="#footnote-anchor-1" class="footnote-number" contenteditable="false" target="_self">1</a><div class="footnote-content"><p>I've proposed one way to combine Transformer and Selective SSM in <a href="https://www.lesswrong.com/posts/YN7PHizHnxinLsKvy/sociallm-proposal-for-a-language-model-design-for?commentId=pzLEgKhPCwm6gKDYR">SociaLLM</a>.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-2" href="#footnote-anchor-2" class="footnote-number" contenteditable="false" target="_self">2</a><div class="footnote-content"><p>Anatoly also connects this trend towards AI component and tool diversification with the "<a href="https://quality-diversity.github.io/papers">Quality Diversity</a>" agenda that looks at this component and architecture diversity as intrinsically advantageous even for capabilities.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-3" href="#footnote-anchor-3" class="footnote-number" contenteditable="false" target="_self">3</a><div class="footnote-content"><p>"AGI" is taken here from <a href="https://openai.com/charter">OpenAI's charter</a>: "highly autonomous systems that outperform humans at most economically valuable work". This is an important qualification: if we were to create an AI that should outperform all biological intelligence in all of its tasks in diverse <em>problem spaces</em> (such as protein folding, genetic expression, organismic morphology, immunity, etc.), much more component diversity would be needed that I conjecture below.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-4" href="#footnote-anchor-4" class="footnote-number" contenteditable="false" target="_self">4</a><div class="footnote-content"><p>Here, it's important to distinguish the block architecture from the training objective. Transformers are not obliged to be trained solely as auto-regressive next token predictors; they can also be the working horses of <a href="https://milayb.notion.site/The-GFlowNet-Tutorial-95434ef0e2d94c24aab90e69b30be9b3">GFlowNets</a> that have different training objectives.</p></div></div><div class="footnote" data-component-name="FootnoteToDOM"><a id="footnote-5" href="#footnote-anchor-5" class="footnote-number" contenteditable="false" target="_self">5</a><div class="footnote-content"><p>Additionally, it's sometimes assumed that this invention and the AI landscape overhaul will happen during the recursive self-improvement a.k.a. the autonomous takeoff phase.</p><p></p></div></div>]]></content:encoded></item></channel></rss>