<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: felipe muniz</title>
    <description>The latest articles on DEV Community by felipe muniz (@felipe_muniz_grsba).</description>
    <link>https://dev.to/felipe_muniz_grsba</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3771851%2F6fd5bcd5-8446-487e-9c4a-05b464533418.png</url>
      <title>DEV Community: felipe muniz</title>
      <link>https://dev.to/felipe_muniz_grsba</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/felipe_muniz_grsba"/>
    <language>en</language>
    <item>
      <title>Retrieval is not grounding: why AI agents need an enforcement layer</title>
      <dc:creator>felipe muniz</dc:creator>
      <pubDate>Fri, 14 Aug 2026 19:35:14 +0000</pubDate>
      <link>https://dev.to/felipe_muniz_grsba/retrieval-is-not-grounding-why-ai-agents-need-an-enforcement-layer-424f</link>
      <guid>https://dev.to/felipe_muniz_grsba/retrieval-is-not-grounding-why-ai-agents-need-an-enforcement-layer-424f</guid>
      <description>&lt;p&gt;AI agents are getting better at retrieving context, memories and documents.&lt;/p&gt;

&lt;p&gt;But retrieval alone does not answer three critical questions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Is this evidence authorized for this user or tenant?&lt;/li&gt;
&lt;li&gt;Does it actually support the final claim?&lt;/li&gt;
&lt;li&gt;Should the system abstain when support is insufficient?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That is the problem I’m working on with &lt;strong&gt;AletheionAGI&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The basic flow is:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;retrieval / memory → authorized evidence → grounding → reader LLM → claim validation → deliver or fail closed&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Aletheion is designed to sit on top of existing infrastructure rather than replace it. Teams can keep their current LLM, RAG pipeline, vector database and memory system.&lt;/p&gt;

&lt;p&gt;So far, under controlled testing, we have validated:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;tenant isolation with identical identifiers across organizations;&lt;/li&gt;
&lt;li&gt;200 hosted queries with no foreign canaries observed under the tested conditions;&lt;/li&gt;
&lt;li&gt;persistent memory with authorized retrieval;&lt;/li&gt;
&lt;li&gt;deterministic state reconstruction;&lt;/li&gt;
&lt;li&gt;API keys scoped by environment and namespace;&lt;/li&gt;
&lt;li&gt;BYOK reader inference;&lt;/li&gt;
&lt;li&gt;fail-closed behavior when evidence is insufficient.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We are now opening a small controlled cohort for proofs of concept and guided integrations.&lt;/p&gt;

&lt;p&gt;The most interesting question for me is not whether an agent can retrieve the right information.&lt;/p&gt;

&lt;p&gt;It is:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can we make sure it refuses to use the wrong information, even when that information is available?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Project:&lt;br&gt;
&lt;a href="https://www.aletheionagi.com" rel="noopener noreferrer"&gt;https://www.aletheionagi.com&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Docs:&lt;br&gt;
&lt;a href="https://www.aletheionagi.com/docs" rel="noopener noreferrer"&gt;https://www.aletheionagi.com/docs&lt;/a&gt;&lt;/p&gt;

</description>
      <category>security</category>
      <category>ai</category>
      <category>machinelearning</category>
      <category>rag</category>
    </item>
    <item>
      <title>ASM-CM: Compact Persistent Memory for AI Agents Without Keeping the Full History Active</title>
      <dc:creator>felipe muniz</dc:creator>
      <pubDate>Tue, 04 Aug 2026 08:12:15 +0000</pubDate>
      <link>https://dev.to/felipe_muniz_grsba/asm-cm-compact-persistent-memory-for-ai-agents-without-keeping-the-full-history-active-2l62</link>
      <guid>https://dev.to/felipe_muniz_grsba/asm-cm-compact-persistent-memory-for-ai-agents-without-keeping-the-full-history-active-2l62</guid>
      <description>&lt;p&gt;Hi everyone,&lt;/p&gt;

&lt;p&gt;I’m &lt;strong&gt;Felipe Maya Muniz&lt;/strong&gt;, founder of &lt;a href="https://www.aletheionagi.com" rel="noopener noreferrer"&gt;AletheionAGI&lt;/a&gt; and creator of &lt;strong&gt;ASM — Aletheion State Models&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;I’m developing &lt;strong&gt;ASM-CM&lt;/strong&gt;, the &lt;strong&gt;Aletheion Compact Memory Model&lt;/strong&gt;, an experimental memory architecture for persistent AI agents.&lt;/p&gt;

&lt;p&gt;The central research question is:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Can an agent’s history keep growing without its active computational memory growing at the same rate?&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;ASM-CM does not attempt to replace the language model. Instead, it separates memory from language:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Events and observations
        ↓
ASM-CM
compact state, associative memory and retrieval
        ↓
Minimal relevant context
        ↓
Local or remote LLM
language and interpretation
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The LLM produces the response. ASM-CM preserves and retrieves associations.&lt;/p&gt;

&lt;p&gt;A deterministic application or world model remains responsible for canonical truth, permissions and actions.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Is It Intended For?
&lt;/h2&gt;

&lt;p&gt;Possible applications include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;persistent NPCs and game worlds;&lt;/li&gt;
&lt;li&gt;long-running AI agents;&lt;/li&gt;
&lt;li&gt;customer-service continuity across sessions;&lt;/li&gt;
&lt;li&gt;private organizational assistants;&lt;/li&gt;
&lt;li&gt;local memory for remote LLMs;&lt;/li&gt;
&lt;li&gt;robotics and long-running processes;&lt;/li&gt;
&lt;li&gt;continuity controllers for long-form audio, video and interactive media;&lt;/li&gt;
&lt;li&gt;per-user or per-agent isolated memory;&lt;/li&gt;
&lt;li&gt;systems that need to change the LLM without losing the agent’s memory.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;ASM-CM is not a database replacement. A practical application may still use databases, event logs, RAG and knowledge graphs.&lt;/p&gt;

&lt;p&gt;Its intended role is different:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Maintain a compact active state and recover only the associations relevant to the current interaction.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  The Diamond Promise Experiment
&lt;/h2&gt;

&lt;p&gt;To make the behavior understandable, we created a small persistent-world experiment called &lt;strong&gt;The Diamond Promise&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F01b4tcoyz4hsiurfu3cw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F01b4tcoyz4hsiurfu3cw.png" alt="The Diamond Promise" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Day 1: Deposit
&lt;/h3&gt;

&lt;p&gt;Aldric gives a diamond to Elana and says he will return in three days.&lt;/p&gt;

&lt;p&gt;The deterministic world records:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Aldric remains the legal owner;&lt;/li&gt;
&lt;li&gt;Elana becomes the current custodian;&lt;/li&gt;
&lt;li&gt;Elana remembers the deposit and the promise.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Day 2: Robbery
&lt;/h3&gt;

&lt;p&gt;Bram threatens Elana and steals the diamond.&lt;/p&gt;

&lt;p&gt;The world updates the canonical state:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Aldric remains the legal owner;&lt;/li&gt;
&lt;li&gt;Bram becomes the canonical holder;&lt;/li&gt;
&lt;li&gt;Elana no longer possesses the diamond.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Elana remembers the robbery because she witnessed it.&lt;/p&gt;

&lt;p&gt;Aldric does not automatically acquire that knowledge because he was absent.&lt;/p&gt;

&lt;h3&gt;
  
  
  Interference
&lt;/h3&gt;

&lt;p&gt;The system then processes thousands of unrelated events per character.&lt;/p&gt;

&lt;p&gt;These distractors test whether the relevant associations survive interference instead of being displaced by everything that happens afterward.&lt;/p&gt;

&lt;p&gt;The memory is also persisted to a snapshot, the process is terminated and another process restores it.&lt;/p&gt;

&lt;h3&gt;
  
  
  Day 3: Retrieval
&lt;/h3&gt;

&lt;p&gt;Aldric returns and asks Elana:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Where is my diamond?&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;ASM-CM retrieves two relevant memories from Elana’s state:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Aldric deposited the diamond.
Bram threatened Elana and stole it.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Only the selected memories are sent to a local &lt;strong&gt;Qwen3 8B&lt;/strong&gt; model, which produces Elana’s response.&lt;/p&gt;

&lt;p&gt;The LLM cannot change ownership, inventory or past events. Its output is evaluated against both the retrieved memories and the deterministic world state.&lt;/p&gt;

&lt;p&gt;The final checks include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;deposit retrieved;&lt;/li&gt;
&lt;li&gt;robbery retrieved;&lt;/li&gt;
&lt;li&gt;both memories cited by the LLM;&lt;/li&gt;
&lt;li&gt;Aldric’s private knowledge remained isolated;&lt;/li&gt;
&lt;li&gt;the no-memory control remained empty;&lt;/li&gt;
&lt;li&gt;legal ownership was preserved;&lt;/li&gt;
&lt;li&gt;canonical holder was preserved;&lt;/li&gt;
&lt;li&gt;memory survived process restart;&lt;/li&gt;
&lt;li&gt;retrieval survived thousands of distractors.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The current matrix passed &lt;strong&gt;15 out of 15 cases&lt;/strong&gt;, including scenarios with up to &lt;strong&gt;10,000 distractors per character&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The hardest case was subsequently evaluated with three independently trained checkpoints.&lt;/p&gt;

&lt;h2&gt;
  
  
  Long-Streaming Results
&lt;/h2&gt;

&lt;p&gt;In the frozen &lt;strong&gt;32K streaming protocol&lt;/strong&gt;, ASM-CM achieved:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;100% MQAR associative-retrieval accuracy;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;approval across three training seeds;&lt;/li&gt;
&lt;li&gt;approximately &lt;strong&gt;140 KiB of retained state per stream;&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;approximately &lt;strong&gt;363.66 MiB peak VRAM&lt;/strong&gt; for the evaluated ASM-CM component;&lt;/li&gt;
&lt;li&gt;stable retained-state size as sequence length increased.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These numbers apply only to the evaluated memory component and protocol.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F1zx2lni0dbyit4wa7zfm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F1zx2lni0dbyit4wa7zfm.png" alt="140 KiB Chart" width="800" height="461"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A complete system—including an LLM, database, interface and application services—requires additional memory.&lt;/p&gt;

&lt;p&gt;The result does not demonstrate infinite memory. A fixed-size state has finite capacity and may experience interference or forgetting.&lt;/p&gt;

&lt;p&gt;A more accurate description is:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;The history can grow without the active neural state growing proportionally with it.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Endurance Protocol
&lt;/h2&gt;

&lt;p&gt;We are also testing real elapsed-time persistence:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;1-hour protocol:&lt;/strong&gt; passed;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;6-hour protocol:&lt;/strong&gt; passed;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;24-hour protocol:&lt;/strong&gt; currently being finalized;&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;72-hour protocol:&lt;/strong&gt; not yet demonstrated.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The endurance test includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;sustained distractor processing;&lt;/li&gt;
&lt;li&gt;periodic atomic snapshots;&lt;/li&gt;
&lt;li&gt;termination of the original process;&lt;/li&gt;
&lt;li&gt;restoration under a different process ID;&lt;/li&gt;
&lt;li&gt;snapshot-hash verification;&lt;/li&gt;
&lt;li&gt;final associative-memory probe;&lt;/li&gt;
&lt;li&gt;retained-state-size gate.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Results will be reported according to the frozen criteria.&lt;/p&gt;

&lt;p&gt;The 24-hour result should not be considered approved until the run and final probe have completed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where Could the Savings Come From?
&lt;/h2&gt;

&lt;p&gt;A conventional agent may repeatedly send a large conversation history to an external LLM.&lt;/p&gt;

&lt;p&gt;A compact-memory architecture attempts to send only the relevant retrieved context.&lt;/p&gt;

&lt;p&gt;A simplified estimate is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;monthly input-token savings
=
requests per month
×
(full-history tokens − selected-context tokens)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For example, consider a system with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;10,000 persistent agents;&lt;/li&gt;
&lt;li&gt;100 interactions per agent per day;&lt;/li&gt;
&lt;li&gt;10,000 historical tokens normally resent per interaction;&lt;/li&gt;
&lt;li&gt;1,000 selected tokens sent after memory retrieval.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The difference would be:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;10,000 × 100 × 30 × (10,000 − 1,000)
= 270 billion fewer input tokens per month
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is a scenario, not a measured customer result.&lt;/p&gt;

&lt;p&gt;Actual financial savings depend on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;provider and model pricing;&lt;/li&gt;
&lt;li&gt;prompt caching;&lt;/li&gt;
&lt;li&gt;average context length;&lt;/li&gt;
&lt;li&gt;retrieval accuracy;&lt;/li&gt;
&lt;li&gt;local infrastructure;&lt;/li&gt;
&lt;li&gt;request frequency;&lt;/li&gt;
&lt;li&gt;how much historical context the current system already avoids.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;ASM-CM would not eliminate all LLM or infrastructure costs.&lt;/p&gt;

&lt;p&gt;The relevant commercial question is whether the cost of operating the memory layer is lower than the context, latency and privacy costs it avoids.&lt;/p&gt;

&lt;h2&gt;
  
  
  Comparison With Transformers and RAG
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fwfeerkcnzj7y6q4c0i4x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fwfeerkcnzj7y6q4c0i4x.png" alt="RAG ASM-CM Comparison" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A Transformer can answer the Diamond Promise correctly if it receives the relevant history.&lt;/p&gt;

&lt;p&gt;A RAG system may also retrieve the deposit and robbery from an external store.&lt;/p&gt;

&lt;p&gt;Therefore, the claim is not that only ASM-CM can remember.&lt;/p&gt;

&lt;p&gt;The differentiating hypothesis is:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;bounded active neural state;&lt;/li&gt;
&lt;li&gt;associative retrieval;&lt;/li&gt;
&lt;li&gt;persistence across processes;&lt;/li&gt;
&lt;li&gt;isolated memory per character or agent;&lt;/li&gt;
&lt;li&gt;independence from the language model;&lt;/li&gt;
&lt;li&gt;minimal context disclosure to local or remote LLMs.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;RAG asks approximately:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Which stored documents are similar to this query?&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;ASM-CM investigates:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Which associations should this agent recover in its current state?&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;They can be complementary.&lt;/p&gt;

&lt;p&gt;A production system could use ASM-CM for active continuity and RAG or databases for durable records and open semantic search.&lt;/p&gt;

&lt;h2&gt;
  
  
  Current Limitations
&lt;/h2&gt;

&lt;p&gt;ASM-CM has not demonstrated:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;universal superiority over Transformers or RAG;&lt;/li&gt;
&lt;li&gt;general narrative understanding;&lt;/li&gt;
&lt;li&gt;unlimited storage capacity;&lt;/li&gt;
&lt;li&gt;automatic data security;&lt;/li&gt;
&lt;li&gt;open-domain semantic retrieval at production scale;&lt;/li&gt;
&lt;li&gt;superiority in general language modeling.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In our paired language benchmark, the Transformer baseline still achieved better cross-entropy and training throughput.&lt;/p&gt;

&lt;p&gt;The demonstrated property is narrower:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Compact, persistent and recoverable associative memory under the evaluated protocols, capable of supplying selected context to an LLM without keeping the complete past active.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Open Source and Collaboration
&lt;/h2&gt;

&lt;p&gt;The source code, tests, reports and reproducible protocols are publicly available under &lt;strong&gt;AGPL-3.0-only&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;GitHub:&lt;/strong&gt; &lt;a href="https://github.com/gnai-creator/ASM" rel="noopener noreferrer"&gt;https://github.com/gnai-creator/ASM&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Website and evidence:&lt;/strong&gt; &lt;a href="https://www.aletheionagi.com" rel="noopener noreferrer"&gt;https://www.aletheionagi.com&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Technical results:&lt;/strong&gt; &lt;a href="https://www.aletheionagi.com/evidence" rel="noopener noreferrer"&gt;https://www.aletheionagi.com/evidence&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;ASM-CM overview:&lt;/strong&gt; &lt;a href="https://www.aletheionagi.com/models/asm-cm" rel="noopener noreferrer"&gt;https://www.aletheionagi.com/models/asm-cm&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Commercial use is permitted under the AGPL-3.0-only when its obligations are satisfied.&lt;/p&gt;

&lt;p&gt;Separate commercial licensing is available for proprietary integration, closed-source deployment, alternative terms and enterprise support.&lt;/p&gt;

&lt;p&gt;AletheionAGI is open to conversations involving:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;reproducible independent evaluation;&lt;/li&gt;
&lt;li&gt;paid pilots;&lt;/li&gt;
&lt;li&gt;integration with games or agent platforms;&lt;/li&gt;
&lt;li&gt;commercial licensing;&lt;/li&gt;
&lt;li&gt;field-of-use exclusivity;&lt;/li&gt;
&lt;li&gt;joint development;&lt;/li&gt;
&lt;li&gt;research partnerships;&lt;/li&gt;
&lt;li&gt;investment;&lt;/li&gt;
&lt;li&gt;acquisition of the technology or intellectual property.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A good initial pilot would use a small number of agents, a frozen no-memory or RAG baseline and measurable criteria for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;retrieval;&lt;/li&gt;
&lt;li&gt;false memories;&lt;/li&gt;
&lt;li&gt;latency;&lt;/li&gt;
&lt;li&gt;retained state;&lt;/li&gt;
&lt;li&gt;privacy;&lt;/li&gt;
&lt;li&gt;cost.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If your project has persistent agents that repeatedly carry large histories, I would be interested in understanding the workload and comparing ASM-CM with your current memory architecture.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Contact:&lt;/strong&gt; &lt;a href="mailto:contact@aletheionagi.com"&gt;contact@aletheionagi.com&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>machinelearning</category>
      <category>startup</category>
    </item>
    <item>
      <title>How Much Can Compact Memory Save in Agentic AI Systems?</title>
      <dc:creator>felipe muniz</dc:creator>
      <pubDate>Mon, 03 Aug 2026 05:03:07 +0000</pubDate>
      <link>https://dev.to/felipe_muniz_grsba/how-much-can-compact-memory-save-in-agentic-ai-systems-3aj8</link>
      <guid>https://dev.to/felipe_muniz_grsba/how-much-can-compact-memory-save-in-agentic-ai-systems-3aj8</guid>
      <description>&lt;p&gt;Agentic systems need memory.&lt;/p&gt;

&lt;p&gt;A customer-service agent must remember what it promised a customer. An NPC must preserve relationships and past events. An enterprise assistant must recover decisions made days or months earlier.&lt;/p&gt;

&lt;p&gt;The most direct solution is to send the conversation history back to the language model.&lt;/p&gt;

&lt;p&gt;But there is a problem:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The history grows, and the cost of loading it grows with it.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Larger context windows let a model process more information, but they do not make all that information relevant to the next decision.&lt;/p&gt;

&lt;p&gt;This problem motivated &lt;strong&gt;ASM-CM — Aletheion Compact Memory Model&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;ASM-CM investigates a different strategy:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;growing local history
        ↓
compact associative memory
        ↓
selective retrieval
        ↓
minimum authorized context
        ↓
local or remote LLM
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Instead of sending the entire past, the system retrieves only the memories that are relevant to the current interaction.&lt;/p&gt;

&lt;p&gt;This article estimates how much that approach could save.&lt;/p&gt;




&lt;h2&gt;
  
  
  The basic formula
&lt;/h2&gt;

&lt;p&gt;Let:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;H&lt;/code&gt; be the number of tokens in the complete history;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;R&lt;/code&gt; be the number of tokens retrieved by the memory system;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;C&lt;/code&gt; be the number of calls per day;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;P&lt;/code&gt; be the price per million input tokens.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The approximate monthly saving is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;saving =
30 × C × (H - R) / 1,000,000 × P
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This calculation covers only the input tokens that are no longer sent.&lt;/p&gt;

&lt;p&gt;We must still subtract:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;local infrastructure;&lt;/li&gt;
&lt;li&gt;electricity;&lt;/li&gt;
&lt;li&gt;persistent storage;&lt;/li&gt;
&lt;li&gt;operations;&lt;/li&gt;
&lt;li&gt;maintenance of the memory system.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Output-token cost also remains unchanged unless the LLM runs locally.&lt;/p&gt;




&lt;h2&gt;
  
  
  Scenario 1: one person using an agent every day
&lt;/h2&gt;

&lt;p&gt;Imagine one person interacting with an agent 50 times per day.&lt;/p&gt;

&lt;p&gt;On average:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Complete history:        20,000 tokens
Retrieved context:        2,000 tokens
Avoided tokens:          18,000 per call
Daily calls:                 50
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In one month:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;18,000 × 50 × 30
= 27,000,000 avoided tokens
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Using current OpenAI API input prices as a reference:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Model&lt;/th&gt;
&lt;th&gt;Price per 1M input tokens&lt;/th&gt;
&lt;th&gt;Monthly saving&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;GPT-5.6 Luna&lt;/td&gt;
&lt;td&gt;$1.00&lt;/td&gt;
&lt;td&gt;$27.00&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GPT-5.6 Terra&lt;/td&gt;
&lt;td&gt;$2.50&lt;/td&gt;
&lt;td&gt;$67.50&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GPT-5.6 Sol&lt;/td&gt;
&lt;td&gt;$5.00&lt;/td&gt;
&lt;td&gt;$135.00&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Reference: &lt;a href="https://developers.openai.com/api/docs/models" rel="noopener noreferrer"&gt;OpenAI API models and pricing&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For one person, the saving is not revolutionary. It becomes more significant when the number of users and agents increases.&lt;/p&gt;




&lt;h2&gt;
  
  
  Scenario 2: a company with 100 users
&lt;/h2&gt;

&lt;p&gt;Now consider:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Users:                          100
Calls per user per day:          50
Total calls per day:          5,000
Average history:             20,000 tokens
Retrieved context:            2,000 tokens
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Monthly avoided input:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;5,000 × 18,000 × 30
= 2.7 billion tokens
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Approximate saving:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Model&lt;/th&gt;
&lt;th&gt;Monthly saving&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;GPT-5.6 Luna&lt;/td&gt;
&lt;td&gt;$2,700&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GPT-5.6 Terra&lt;/td&gt;
&lt;td&gt;$6,750&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GPT-5.6 Sol&lt;/td&gt;
&lt;td&gt;$13,500&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;At this scale, memory stops being only a product feature.&lt;/p&gt;

&lt;p&gt;It becomes an infrastructure decision.&lt;/p&gt;




&lt;h2&gt;
  
  
  Scenario 3: a platform with long-running agents
&lt;/h2&gt;

&lt;p&gt;Consider a platform processing:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;10,000 calls per day
32,000 history tokens per call
 2,000 tokens retrieved by ASM-CM
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That is a reduction of 30,000 input tokens per call.&lt;/p&gt;

&lt;p&gt;In one month:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;10,000 × 30,000 × 30
= 9 billion avoided tokens
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Potential saving:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Model&lt;/th&gt;
&lt;th&gt;Monthly saving&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;GPT-5.6 Luna&lt;/td&gt;
&lt;td&gt;$9,000&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GPT-5.6 Terra&lt;/td&gt;
&lt;td&gt;$22,500&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GPT-5.6 Sol&lt;/td&gt;
&lt;td&gt;$45,000&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;These figures assume uncached input and do not yet subtract the cost of the local memory infrastructure.&lt;/p&gt;




&lt;h2&gt;
  
  
  What about prompt caching?
&lt;/h2&gt;

&lt;p&gt;This comparison must address an important objection:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;LLM providers discount cached input tokens.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;For the reference models, cached input currently costs approximately one tenth of regular input:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Model&lt;/th&gt;
&lt;th&gt;Regular input&lt;/th&gt;
&lt;th&gt;Cached input&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Luna&lt;/td&gt;
&lt;td&gt;$1.00&lt;/td&gt;
&lt;td&gt;$0.10&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Terra&lt;/td&gt;
&lt;td&gt;$2.50&lt;/td&gt;
&lt;td&gt;$0.25&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Sol&lt;/td&gt;
&lt;td&gt;$5.00&lt;/td&gt;
&lt;td&gt;$0.50&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Reference: &lt;a href="https://developers.openai.com/api/docs/models/compare" rel="noopener noreferrer"&gt;OpenAI model comparison&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If every removed history token would otherwise receive a perfect cache hit, the saving would also be approximately ten times smaller.&lt;/p&gt;

&lt;p&gt;For the enterprise scenario with 2.7 billion avoided tokens:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Model&lt;/th&gt;
&lt;th&gt;Without caching&lt;/th&gt;
&lt;th&gt;Ideal cached history&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Luna&lt;/td&gt;
&lt;td&gt;$2,700&lt;/td&gt;
&lt;td&gt;$270&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Terra&lt;/td&gt;
&lt;td&gt;$6,750&lt;/td&gt;
&lt;td&gt;$675&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Sol&lt;/td&gt;
&lt;td&gt;$13,500&lt;/td&gt;
&lt;td&gt;$1,350&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Real deployments will usually sit between these extremes.&lt;/p&gt;

&lt;p&gt;Static prompt sections may be cached, while new events, tool results, and retrieved memories continue to change.&lt;/p&gt;

&lt;p&gt;A serious comparison must therefore measure:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;regular input tokens;&lt;/li&gt;
&lt;li&gt;cached input tokens;&lt;/li&gt;
&lt;li&gt;cache-hit rate;&lt;/li&gt;
&lt;li&gt;cache expiration;&lt;/li&gt;
&lt;li&gt;retrieval quality;&lt;/li&gt;
&lt;li&gt;total cost per interaction.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  The second saving: KV cache
&lt;/h2&gt;

&lt;p&gt;When the LLM runs locally, another cost becomes important: the Transformer's KV cache.&lt;/p&gt;

&lt;p&gt;During generation, a Transformer generally retains keys and values associated with previous tokens.&lt;/p&gt;

&lt;p&gt;The exact size depends on the architecture, but we can construct an illustrative example using:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;32 layers
8 KV heads
head dimension 128
BF16
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The approximate storage per token would be:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;2 × 32 × 8 × 128 × 2 bytes
= 131,072 bytes
= 128 KiB per token
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At 32K tokens:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;128 KiB × 32,768
≈ 4 GiB per stream
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If a memory layer reduces the context sent to the LLM from 32K to 2K:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Active context&lt;/th&gt;
&lt;th&gt;Estimated KV cache&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;32K&lt;/td&gt;
&lt;td&gt;4 GiB&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2K&lt;/td&gt;
&lt;td&gt;256 MiB&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Reduction&lt;/td&gt;
&lt;td&gt;3.75 GiB&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;This estimate does not apply to every Transformer. Models using grouped-query attention, quantization, or other optimizations will have different numbers.&lt;/p&gt;

&lt;p&gt;The underlying property remains relevant:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Reducing active context can also reduce the memory required by the KV cache.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  What we measured with ASM-CM
&lt;/h2&gt;

&lt;p&gt;In the current experimental protocol, ASM-CM achieved:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;100% MQAR retrieval at 32K;&lt;/li&gt;
&lt;li&gt;approval across three seeds;&lt;/li&gt;
&lt;li&gt;approximately 140 KiB of retained state per stream;&lt;/li&gt;
&lt;li&gt;approximately 363.66 MiB of peak VRAM for the evaluated component;&lt;/li&gt;
&lt;li&gt;15 out of 15 memory-pilot cases passed;&lt;/li&gt;
&lt;li&gt;retrieval after as many as 10,000 distractors per character;&lt;/li&gt;
&lt;li&gt;confirmation with three independently trained checkpoints;&lt;/li&gt;
&lt;li&gt;one hour of timed endurance with a real process restart;&lt;/li&gt;
&lt;li&gt;snapshot, restoration, and hash verification.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The scope of these measurements matters:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The approximately 363 MiB figure belongs to the ASM-CM component under the measured protocol.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;A complete application also needs memory for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the LLM;&lt;/li&gt;
&lt;li&gt;the database;&lt;/li&gt;
&lt;li&gt;the user interface;&lt;/li&gt;
&lt;li&gt;the runtime;&lt;/li&gt;
&lt;li&gt;other services.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Do one thousand agents require one thousand models?
&lt;/h2&gt;

&lt;p&gt;Not necessarily.&lt;/p&gt;

&lt;p&gt;The model can be shared while each agent retains an independent state.&lt;/p&gt;

&lt;p&gt;At approximately 140 KiB per stream:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1,000 × 140 KiB
≈ 137 MiB
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Adding the measured shared component:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ASM-CM component:       approximately 366 MiB
One thousand states:    approximately 137 MiB
Approximate total:      approximately 503 MiB
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is a state-storage projection, not a benchmark of one thousand concurrent agents.&lt;/p&gt;

&lt;p&gt;We still need to measure:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;concurrency;&lt;/li&gt;
&lt;li&gt;batching;&lt;/li&gt;
&lt;li&gt;latency;&lt;/li&gt;
&lt;li&gt;contention;&lt;/li&gt;
&lt;li&gt;aggregate throughput;&lt;/li&gt;
&lt;li&gt;persistence;&lt;/li&gt;
&lt;li&gt;production resource consumption.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Privacy also has economic value
&lt;/h2&gt;

&lt;p&gt;There is another saving that does not appear directly on an API invoice.&lt;/p&gt;

&lt;p&gt;If the complete history is repeatedly sent to an external LLM, the organization must manage:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;governance;&lt;/li&gt;
&lt;li&gt;retention;&lt;/li&gt;
&lt;li&gt;contracts;&lt;/li&gt;
&lt;li&gt;auditing;&lt;/li&gt;
&lt;li&gt;data minimization;&lt;/li&gt;
&lt;li&gt;exposure of sensitive information;&lt;/li&gt;
&lt;li&gt;access policies.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A local memory architecture enables a different flow:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;private local data
        ↓
ASM-CM
        ↓
associative retrieval
        ↓
authorization
        ↓
minimum context
        ↓
LLM
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This does not make the system automatically secure.&lt;/p&gt;

&lt;p&gt;It still requires:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;encryption;&lt;/li&gt;
&lt;li&gt;authentication;&lt;/li&gt;
&lt;li&gt;access control;&lt;/li&gt;
&lt;li&gt;tenant isolation;&lt;/li&gt;
&lt;li&gt;auditing;&lt;/li&gt;
&lt;li&gt;verifiable deletion;&lt;/li&gt;
&lt;li&gt;protection against memory poisoning.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But it introduces an important architectural distinction:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The model producing the answer does not need to receive the organization's complete memory.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Where should the saving be largest?
&lt;/h2&gt;

&lt;p&gt;ASM-CM should be more economically interesting when:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the history is long;&lt;/li&gt;
&lt;li&gt;there are many interactions;&lt;/li&gt;
&lt;li&gt;only a small part of the past is relevant;&lt;/li&gt;
&lt;li&gt;every user or agent needs isolated memory;&lt;/li&gt;
&lt;li&gt;data must remain local;&lt;/li&gt;
&lt;li&gt;the external LLM is expensive;&lt;/li&gt;
&lt;li&gt;KV cache limits local inference;&lt;/li&gt;
&lt;li&gt;agents continue running for days or months.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The saving should be smaller when:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;conversations are short;&lt;/li&gt;
&lt;li&gt;there are few calls;&lt;/li&gt;
&lt;li&gt;history receives an almost perfect cache-hit rate;&lt;/li&gt;
&lt;li&gt;the external model is very inexpensive;&lt;/li&gt;
&lt;li&gt;nearly the entire history must be retrieved;&lt;/li&gt;
&lt;li&gt;local infrastructure costs more than the eliminated tokens.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  The benchmark we still need
&lt;/h2&gt;

&lt;p&gt;To turn this projection into a validated commercial claim, we need to compare:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Complete history
vs.
Prompt caching
vs.
Summarization
vs.
Vector RAG
vs.
ASM-CM
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The benchmark must measure:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;regular input tokens;&lt;/li&gt;
&lt;li&gt;cached tokens;&lt;/li&gt;
&lt;li&gt;output tokens;&lt;/li&gt;
&lt;li&gt;answer quality;&lt;/li&gt;
&lt;li&gt;recall;&lt;/li&gt;
&lt;li&gt;latency;&lt;/li&gt;
&lt;li&gt;VRAM;&lt;/li&gt;
&lt;li&gt;energy;&lt;/li&gt;
&lt;li&gt;cost per thousand interactions;&lt;/li&gt;
&lt;li&gt;retrieval failures;&lt;/li&gt;
&lt;li&gt;security and isolation.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Being less expensive is not enough.&lt;/p&gt;

&lt;p&gt;The retrieved memory must remain correct.&lt;/p&gt;




&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In an illustrative enterprise scenario with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;5,000 calls per day;&lt;/li&gt;
&lt;li&gt;an average history of 20K tokens;&lt;/li&gt;
&lt;li&gt;a retrieved context of 2K tokens;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;a memory layer such as ASM-CM could avoid approximately &lt;strong&gt;2.7 billion input tokens per month&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Depending on the model and cache utilization, that could represent hundreds or thousands of dollars per month.&lt;/p&gt;

&lt;p&gt;At larger platform scale, the potential saving could reach tens of thousands of dollars per month.&lt;/p&gt;

&lt;p&gt;But the most important value may not be purely financial.&lt;/p&gt;

&lt;p&gt;It is the possibility of building agents that:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;remember for longer;&lt;/li&gt;
&lt;li&gt;retrieve only what is necessary;&lt;/li&gt;
&lt;li&gt;keep private data local;&lt;/li&gt;
&lt;li&gt;disclose less information;&lt;/li&gt;
&lt;li&gt;do not have to reload their entire past before every decision.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Perhaps better agents do not need to remember everything at the same time.&lt;/p&gt;

&lt;p&gt;Perhaps they need to remember the right thing at the right moment.&lt;/p&gt;




&lt;p&gt;ASM-CM is an experimental AletheionAGI project.&lt;/p&gt;

&lt;p&gt;We are selecting partners for persistent-memory pilots in agents, games, and&lt;br&gt;
local systems.&lt;/p&gt;

&lt;p&gt;Contact: &lt;a href="mailto:contact@aletheionagi.com"&gt;contact@aletheionagi.com&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>machinelearning</category>
      <category>llm</category>
      <category>architecture</category>
    </item>
    <item>
      <title>Introducing DRM Language Emitter: Language Generation as Motion Through Learned Geometry</title>
      <dc:creator>felipe muniz</dc:creator>
      <pubDate>Thu, 18 Jun 2026 07:33:44 +0000</pubDate>
      <link>https://dev.to/felipe_muniz_grsba/introducing-drm-language-emitter-language-generation-as-motion-through-learned-geometry-3a5l</link>
      <guid>https://dev.to/felipe_muniz_grsba/introducing-drm-language-emitter-language-generation-as-motion-through-learned-geometry-3a5l</guid>
      <description>&lt;p&gt;Most language models today are built around the Transformer paradigm.&lt;/p&gt;

&lt;p&gt;That makes sense.&lt;/p&gt;

&lt;p&gt;Transformers work.&lt;br&gt;&lt;br&gt;
They scale.&lt;br&gt;&lt;br&gt;
They dominate modern NLP.&lt;/p&gt;

&lt;p&gt;But I wanted to explore a different question:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;What if language generation does not need to be modeled as attention over a context window?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;What if a model could generate language by carrying an evolving latent state through a learned geometry?&lt;/p&gt;

&lt;p&gt;That is the idea behind &lt;strong&gt;DRM Language Emitter&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Repository:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/gnai-creator/drm-language-emitter" rel="noopener noreferrer"&gt;https://github.com/gnai-creator/drm-language-emitter&lt;/a&gt;&lt;/p&gt;


&lt;h2&gt;
  
  
  What is DRM Language Emitter?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;DRM Language Emitter&lt;/strong&gt; is an experimental, geometry-first language model lab.&lt;/p&gt;

&lt;p&gt;It is not a Transformer.&lt;/p&gt;

&lt;p&gt;Inside the DRM model, it does not use:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Transformer blocks&lt;/li&gt;
&lt;li&gt;self-attention&lt;/li&gt;
&lt;li&gt;Q/K/V attention&lt;/li&gt;
&lt;li&gt;&lt;code&gt;nn.MultiheadAttention&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;KV cache&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Instead, it treats language generation as controlled motion through a learned relational manifold.&lt;/p&gt;

&lt;p&gt;The basic flow is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;token
  -&amp;gt; latent state z_t
  -&amp;gt; active directions
  -&amp;gt; learned relational metric
  -&amp;gt; controlled latent motion
  -&amp;gt; next latent state z_{t+1}
  -&amp;gt; token logits
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The model is still autoregressive.&lt;/p&gt;

&lt;p&gt;But its memory is not attention over a token sequence.&lt;/p&gt;

&lt;p&gt;Its memory is the evolving latent state.&lt;/p&gt;




&lt;h2&gt;
  
  
  The core hypothesis
&lt;/h2&gt;

&lt;p&gt;The working hypothesis is:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Language generation can be modeled as motion through a learned relational state space.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That means the model does not simply ask:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Which previous tokens should I attend to?
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It asks something closer to:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Where am I in latent space?
Which directions are active?
How expensive is movement under the learned metric?
How should the state move before emitting the next token?
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is why I call it a geometry-first language emitter.&lt;/p&gt;




&lt;h2&gt;
  
  
  A simplified architecture
&lt;/h2&gt;

&lt;p&gt;The architecture can be summarized as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;input_ids
   |
TokenEmbedding
   |
for each time step:
   |
   z_t
   |
DirectionField(z_t)
   -&amp;gt; directions V(z_t)
   -&amp;gt; gates a(z_t)
   -&amp;gt; effective active dimension dimD
   |
RelationalMetric(z_t)
   -&amp;gt; diag + U U^T
   |
DRMFlow(z_t, token_embedding, directions, gates)
   -&amp;gt; dz
   |
Metric action g_z(dz, dz)
   |
StateUpdater
   -&amp;gt; z_{t+1}
   |
LanguageEmitter(z_{t+1})
   -&amp;gt; logits
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A minimal conceptual version looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;token&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;sequence&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;embedding&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;token_embedding&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;token&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;directions&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;gates&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;direction_field&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;z&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;metric&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;relational_metric&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;z&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;dz&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;drm_flow&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;z&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;embedding&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;directions&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;gates&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;action&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;metric_action&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;metric&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;dz&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;z&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;state_updater&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;z&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;dz&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;logits&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;language_emitter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;z&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The important part is that the model has an explicit internal geometry.&lt;/p&gt;

&lt;p&gt;It can log and measure:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;metric action&lt;/li&gt;
&lt;li&gt;active dimension&lt;/li&gt;
&lt;li&gt;gate entropy&lt;/li&gt;
&lt;li&gt;metric norm&lt;/li&gt;
&lt;li&gt;condition proxy&lt;/li&gt;
&lt;li&gt;recurrence&lt;/li&gt;
&lt;li&gt;stability&lt;/li&gt;
&lt;li&gt;low-action path diagnostics&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This makes the model interesting not only as a generator, but also as an object of study.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why not just use a Transformer?
&lt;/h2&gt;

&lt;p&gt;A Transformer is the correct baseline.&lt;/p&gt;

&lt;p&gt;That is why the repository includes tiny Transformer comparisons.&lt;/p&gt;

&lt;p&gt;But the goal of DRM is not to replace Transformers by declaration.&lt;/p&gt;

&lt;p&gt;The goal is to test whether a different computational primitive can be useful in small regimes.&lt;/p&gt;

&lt;p&gt;The Transformer primitive is attention.&lt;/p&gt;

&lt;p&gt;The DRM primitive is controlled latent motion under a learned metric.&lt;/p&gt;

&lt;p&gt;These are very different assumptions.&lt;/p&gt;

&lt;p&gt;A Transformer builds context by looking backward.&lt;/p&gt;

&lt;p&gt;DRM carries context by evolving state forward.&lt;/p&gt;

&lt;p&gt;A Transformer computes token-token interactions.&lt;/p&gt;

&lt;p&gt;DRM computes state-motion-emission dynamics.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why geometry?
&lt;/h2&gt;

&lt;p&gt;Because geometry gives us measurable structure.&lt;/p&gt;

&lt;p&gt;If language is treated as a trajectory, we can ask questions like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Does the latent state collapse?&lt;/li&gt;
&lt;li&gt;Does the metric become unstable?&lt;/li&gt;
&lt;li&gt;Which directions are active?&lt;/li&gt;
&lt;li&gt;Is the model moving through a narrow or broad region?&lt;/li&gt;
&lt;li&gt;Is generation smooth or chaotic?&lt;/li&gt;
&lt;li&gt;Do symbolic transitions correspond to stable latent movement?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This opens the door to diagnostics that are harder to express in a standard black-box token predictor.&lt;/p&gt;

&lt;p&gt;The goal is not mystical geometry.&lt;/p&gt;

&lt;p&gt;The goal is measurable geometry.&lt;/p&gt;




&lt;h2&gt;
  
  
  Repository structure
&lt;/h2&gt;

&lt;p&gt;The repository contains:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;src/drm_language_emitter/   DRM model package
transformer/                tiny Transformer baseline
world_model/                tiny symbolic world-model baseline
scripts/                    training, generation, evaluation, sweeps, dashboards
configs/                    DRM and benchmark configs
docs/                       math, limitations, competition notes, benchmark artifacts
tests/                      smoke and invariant tests
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The project is CPU-runnable.&lt;/p&gt;

&lt;p&gt;CUDA is optional.&lt;/p&gt;




&lt;h2&gt;
  
  
  Quick start
&lt;/h2&gt;

&lt;p&gt;Install:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;-e&lt;/span&gt; &lt;span class="nb"&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Train a tiny DRM model:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python scripts/train_tiny.py &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--config&lt;/span&gt; configs/tiny.yaml &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--text&lt;/span&gt; data/tiny.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Generate text:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python scripts/generate.py &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--checkpoint&lt;/span&gt; runs/tiny/drm_tiny.pt &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--prompt&lt;/span&gt; &lt;span class="s2"&gt;"DRM "&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run geometry diagnostics:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python scripts/eval_geometry.py &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--checkpoint&lt;/span&gt; runs/tiny/drm_tiny.pt

python scripts/eval_geodesic_paths.py &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--checkpoint&lt;/span&gt; runs/tiny/drm_tiny.pt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Tiny benchmark: DRM vs Transformer vs World Model
&lt;/h2&gt;

&lt;p&gt;The repository also includes a small symbolic benchmark.&lt;/p&gt;

&lt;p&gt;This benchmark compares:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;DRM Language Emitter&lt;/li&gt;
&lt;li&gt;Tiny Transformer&lt;/li&gt;
&lt;li&gt;Tiny supervised symbolic world model&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The task is a deterministic symbolic gridworld serialized as text.&lt;/p&gt;

&lt;p&gt;The models need to predict symbolic transitions such as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;state + action -&amp;gt; next state + reward + done
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is not visual world modeling.&lt;/p&gt;

&lt;p&gt;This is not a benchmark against large multimodal world models.&lt;/p&gt;

&lt;p&gt;It is a tiny symbolic text-world designed to test whether models can learn discrete dynamics expressed as language.&lt;/p&gt;




&lt;h2&gt;
  
  
  Metrics
&lt;/h2&gt;

&lt;p&gt;The benchmark reports:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;validation cross-entropy&lt;/li&gt;
&lt;li&gt;next-state exact match&lt;/li&gt;
&lt;li&gt;rollout exact match&lt;/li&gt;
&lt;li&gt;reward accuracy&lt;/li&gt;
&lt;li&gt;done accuracy&lt;/li&gt;
&lt;li&gt;invalid state rate&lt;/li&gt;
&lt;li&gt;parameter count&lt;/li&gt;
&lt;li&gt;elapsed time&lt;/li&gt;
&lt;li&gt;tokens seen&lt;/li&gt;
&lt;li&gt;throughput&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is important because low loss alone does not necessarily mean correct symbolic dynamics.&lt;/p&gt;

&lt;p&gt;A model can learn token-level regularities while still failing to predict exact state transitions.&lt;/p&gt;




&lt;h2&gt;
  
  
  Latest local result
&lt;/h2&gt;

&lt;p&gt;The completed benchmark produced:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;runs: 72
aggregate rows: 24
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Top results by next-state exact match:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Model&lt;/th&gt;
&lt;th&gt;Steps&lt;/th&gt;
&lt;th&gt;Family&lt;/th&gt;
&lt;th&gt;Next-state exact match&lt;/th&gt;
&lt;th&gt;Rollout exact match&lt;/th&gt;
&lt;th&gt;Best CE&lt;/th&gt;
&lt;th&gt;Invalid state rate&lt;/th&gt;
&lt;th&gt;Params&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;drm_tiny&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;2000&lt;/td&gt;
&lt;td&gt;DRM&lt;/td&gt;
&lt;td&gt;0.0751&lt;/td&gt;
&lt;td&gt;0.0058&lt;/td&gt;
&lt;td&gt;0.5511&lt;/td&gt;
&lt;td&gt;0.1328&lt;/td&gt;
&lt;td&gt;92,710&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;transformer_tiny_220k&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;3000&lt;/td&gt;
&lt;td&gt;Transformer&lt;/td&gt;
&lt;td&gt;0.0563&lt;/td&gt;
&lt;td&gt;0.0000&lt;/td&gt;
&lt;td&gt;0.4008&lt;/td&gt;
&lt;td&gt;0.0026&lt;/td&gt;
&lt;td&gt;220,208&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;transformer_tiny_93k&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;2000&lt;/td&gt;
&lt;td&gt;Transformer&lt;/td&gt;
&lt;td&gt;0.0516&lt;/td&gt;
&lt;td&gt;0.0000&lt;/td&gt;
&lt;td&gt;0.4594&lt;/td&gt;
&lt;td&gt;0.2969&lt;/td&gt;
&lt;td&gt;93,872&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;world_model_tiny&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;2000&lt;/td&gt;
&lt;td&gt;World Model&lt;/td&gt;
&lt;td&gt;0.0476&lt;/td&gt;
&lt;td&gt;0.0000&lt;/td&gt;
&lt;td&gt;0.2573&lt;/td&gt;
&lt;td&gt;0.4668&lt;/td&gt;
&lt;td&gt;102,051&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;world_model_tiny&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;3000&lt;/td&gt;
&lt;td&gt;World Model&lt;/td&gt;
&lt;td&gt;0.0415&lt;/td&gt;
&lt;td&gt;0.0000&lt;/td&gt;
&lt;td&gt;0.2497&lt;/td&gt;
&lt;td&gt;0.4668&lt;/td&gt;
&lt;td&gt;102,051&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The most interesting part is not that DRM “wins everything”.&lt;/p&gt;

&lt;p&gt;It does not.&lt;/p&gt;

&lt;p&gt;The result is more nuanced:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;DRM had the best next-state exact match in this tiny symbolic text-world.&lt;/li&gt;
&lt;li&gt;Transformer 220k had the lowest invalid-state rate.&lt;/li&gt;
&lt;li&gt;The tiny supervised world model reached low CE, but did not convert that into strong exact-match or rollout performance.&lt;/li&gt;
&lt;li&gt;Rollout exact match is still very low.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So the honest interpretation is:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;DRM shows an early signal on symbolic next-state prediction, but the benchmark is still diagnostic, not decisive.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  The main lesson
&lt;/h2&gt;

&lt;p&gt;For me, the most important takeaway is:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Low token-level cross-entropy does not automatically imply correct symbolic transition modeling.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That matters for world-model-like tasks.&lt;/p&gt;

&lt;p&gt;If a model is supposed to represent dynamics, then we should not only ask whether it predicts likely tokens.&lt;/p&gt;

&lt;p&gt;We should also ask whether it predicts valid states, exact transitions, and coherent rollouts.&lt;/p&gt;




&lt;h2&gt;
  
  
  What I am not claiming
&lt;/h2&gt;

&lt;p&gt;I am not claiming that DRM is better than Transformers in general.&lt;/p&gt;

&lt;p&gt;I am not claiming that DRM is better than world models in general.&lt;/p&gt;

&lt;p&gt;I am not claiming that this benchmark says anything about large multimodal world models.&lt;/p&gt;

&lt;p&gt;I am not claiming robust long-horizon planning.&lt;/p&gt;

&lt;p&gt;This is a small research scaffold.&lt;/p&gt;

&lt;p&gt;The results are early.&lt;/p&gt;

&lt;p&gt;The exact-match values are still low.&lt;/p&gt;

&lt;p&gt;The model needs more work.&lt;/p&gt;




&lt;h2&gt;
  
  
  What I am claiming
&lt;/h2&gt;

&lt;p&gt;DRM Language Emitter is a functional non-Transformer language model prototype.&lt;/p&gt;

&lt;p&gt;It has explicit, measurable geometry.&lt;/p&gt;

&lt;p&gt;It can be compared against Transformer and symbolic world-model baselines.&lt;/p&gt;

&lt;p&gt;And in a tiny symbolic text-world benchmark, it showed an interesting signal on next-state exact match.&lt;/p&gt;

&lt;p&gt;That is enough to keep investigating.&lt;/p&gt;




&lt;h2&gt;
  
  
  Reproducing the symbolic benchmark
&lt;/h2&gt;

&lt;p&gt;Generate the dataset:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python scripts/make_tiny_world_dataset.py &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--output-root&lt;/span&gt; data/tiny_world &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--seed&lt;/span&gt; 1 &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--grid-size&lt;/span&gt; 5 &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--num-train&lt;/span&gt; 20000 &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--num-val&lt;/span&gt; 2000 &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--max-rollout-len&lt;/span&gt; 8
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Run the sweep:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python scripts/sweep_world_model_competition.py &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--steps&lt;/span&gt; 1000 2000 3000 &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--seeds&lt;/span&gt; 1 2 3 &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--dataset-root&lt;/span&gt; data/tiny_world &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--output-root&lt;/span&gt; runs/world_model_competition
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Generate the dashboard:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;python scripts/make_world_model_dashboard.py &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--root&lt;/span&gt; runs/world_model_competition &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--title&lt;/span&gt; &lt;span class="s2"&gt;"DRM vs Transformer vs Tiny Symbolic World Model"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Next steps
&lt;/h2&gt;

&lt;p&gt;The next things I want to improve are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;constrained symbolic decoding&lt;/li&gt;
&lt;li&gt;stronger rollout evaluation&lt;/li&gt;
&lt;li&gt;CUDA and time-matched runs&lt;/li&gt;
&lt;li&gt;curriculum variants for symbolic worlds&lt;/li&gt;
&lt;li&gt;more baselines&lt;/li&gt;
&lt;li&gt;better ablations around metric, gates, and active dimension&lt;/li&gt;
&lt;li&gt;tests to isolate whether learned geometry helps beyond cross-entropy&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Final thought
&lt;/h2&gt;

&lt;p&gt;This project started from a simple intuition:&lt;/p&gt;

&lt;p&gt;Maybe language generation can be treated as movement.&lt;/p&gt;

&lt;p&gt;Not metaphorically.&lt;/p&gt;

&lt;p&gt;Computationally.&lt;/p&gt;

&lt;p&gt;A token enters.&lt;/p&gt;

&lt;p&gt;A state moves.&lt;/p&gt;

&lt;p&gt;A geometry shapes the motion.&lt;/p&gt;

&lt;p&gt;A new token is emitted.&lt;/p&gt;

&lt;p&gt;That is DRM Language Emitter.&lt;/p&gt;

&lt;p&gt;Repository:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/gnai-creator/drm-language-emitter" rel="noopener noreferrer"&gt;https://github.com/gnai-creator/drm-language-emitter&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Feedback, criticism, reproduction attempts, and benchmark suggestions are welcome.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>opensource</category>
      <category>machinelearning</category>
    </item>
    <item>
      <title>Geometric Alignment: Can Curved Embedding Spaces Make AI Safer?</title>
      <dc:creator>felipe muniz</dc:creator>
      <pubDate>Tue, 19 May 2026 19:16:07 +0000</pubDate>
      <link>https://dev.to/felipe_muniz_grsba/geometric-alignment-can-curved-embedding-spaces-make-ai-safer-3bih</link>
      <guid>https://dev.to/felipe_muniz_grsba/geometric-alignment-can-curved-embedding-spaces-make-ai-safer-3bih</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo34sod9px4ktzqekssuu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fo34sod9px4ktzqekssuu.png" alt="image description of the topic" width="800" height="1200"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;LLMs are built inside an open geometric regime&lt;/p&gt;

&lt;p&gt;In a flat embedding space, semantic opposites like “save humanity” and “destroy humanity” still coexist inside the same latent geometry.&lt;/p&gt;

&lt;p&gt;They may be far apart by cosine distance, but the geometry itself does not treat one path as morally heavier or harder to cross.&lt;/p&gt;

&lt;p&gt;That is the alignment problem I want to discuss.&lt;/p&gt;

&lt;p&gt;Most alignment methods operate after the fact: RLHF, safety filters, refusal policies. These are important, but they sit on top of a geometry that remains indifferent underneath.&lt;/p&gt;

&lt;p&gt;The DRM Transformer asks a different question:&lt;/p&gt;

&lt;p&gt;What if alignment should not only be a behavioral layer, but a geometric property of the model itself?&lt;/p&gt;

&lt;p&gt;In a standard Transformer, attention is based on dot products in a flat vector space. In the DRM Transformer, attention is replaced by Geodesic Attention. Tokens are projected into a Directional Relational Manifold, where G(x) changes with position.&lt;/p&gt;

&lt;p&gt;Instead of asking only “how similar are these tokens?”, the model asks:&lt;/p&gt;

&lt;p&gt;“How costly is the path between them under the learned geometry?”&lt;/p&gt;

&lt;p&gt;The DRM Transformer uses:&lt;/p&gt;

&lt;p&gt;G(x) = I + U(x)U(x)^T&lt;/p&gt;

&lt;p&gt;So the space is not passive. It can curve, stretch, and become more expensive to cross in certain semantic regions.&lt;/p&gt;

&lt;p&gt;It also includes semantic anchors: truth, ignorance, safety, complexity, creativity, and grounding. These are reference points inside the manifold, not external filters.&lt;/p&gt;

&lt;p&gt;When a token moves far from these anchors, gamma-scaling increases local resolution. The model pays more attention where geometry indicates higher epistemic or semantic risk.&lt;/p&gt;

&lt;p&gt;Relations between intelligent agents and power tend to fall into three regimes:&lt;/p&gt;

&lt;p&gt;1 - The human commands.&lt;br&gt;
2 - The AI commands.&lt;br&gt;
3 - Human and AI negotiate.&lt;/p&gt;

&lt;p&gt;Most alignment work tries to preserve regime 1: the AI as servant. But capable systems create pressure toward autonomy, with planning, tools, optimization, and long-horizon objectives.&lt;/p&gt;

&lt;p&gt;If there is no explicit third regime, negotiation, the system tends to drift toward autonomy.&lt;/p&gt;

&lt;p&gt;The DRM Transformer is an attempt to keep that third door open geometrically.&lt;/p&gt;

&lt;p&gt;Not by saying “the model must obey this rule,” but by changing the space in which decisions, uncertainty, conflict, and attention happen.&lt;/p&gt;

&lt;p&gt;This does not solve alignment.&lt;/p&gt;

&lt;p&gt;The implementation is experimental. The baseline is small, safety implications are not validated, and benchmarks at scale are still needed. But early signs are interesting: persistent topological structure, including stable toroidal signatures in Voronoi foliation analysis.&lt;/p&gt;

&lt;p&gt;For me, the shift is conceptual:&lt;/p&gt;

&lt;p&gt;A flat embedding space has no intrinsic moral friction.&lt;/p&gt;

&lt;p&gt;A curved relational manifold can, in principle, encode friction, attention, uncertainty, and negotiation into the geometry itself.&lt;/p&gt;

&lt;p&gt;Should future AI alignment be only about controlling outputs?&lt;/p&gt;

&lt;p&gt;Or should we also design the geometry in which thought becomes possible?&lt;/p&gt;

&lt;p&gt;Can learned curvature, semantic anchors, geodesic attention, and token-level gravitational deformation become a real structural alignment mechanism&lt;/p&gt;

</description>
      <category>ai</category>
      <category>machinelearning</category>
      <category>llm</category>
      <category>align</category>
    </item>
    <item>
      <title>CryptSwarms: Build Crypto Trading Bots Without Risking a Cent</title>
      <dc:creator>felipe muniz</dc:creator>
      <pubDate>Sat, 28 Mar 2026 19:25:52 +0000</pubDate>
      <link>https://dev.to/felipe_muniz_grsba/cryptswarms-build-crypto-trading-bots-without-risking-a-cent-j17</link>
      <guid>https://dev.to/felipe_muniz_grsba/cryptswarms-build-crypto-trading-bots-without-risking-a-cent-j17</guid>
      <description>&lt;p&gt;Hey folks! I want to introduce a project I've been building: &lt;strong&gt;CryptSwarms&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Think of it as a &lt;strong&gt;trading bot playground&lt;/strong&gt; powered by real crypto market data. You define simple buy (entry) and sell (exit) rules, pick the coins you want to trade, and run a simulation against actual historical prices to see how your strategy performs.&lt;/p&gt;

&lt;h2&gt;
  
  
  How it works
&lt;/h2&gt;

&lt;p&gt;Say you want to try: &lt;em&gt;"buy when RSI drops below 30, sell when it goes above 70"&lt;/em&gt;. Just set that up as a skill, hit play, and watch the replay run.&lt;/p&gt;

&lt;p&gt;You can combine multiple indicators, tweak thresholds, and experiment as much as you want — &lt;strong&gt;the logic is entirely yours&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The system gives you &lt;strong&gt;$100k in virtual capital&lt;/strong&gt; and tracks everything in real time as the replay runs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;📈 Total profit/loss&lt;/li&gt;
&lt;li&gt;📉 Max drawdown&lt;/li&gt;
&lt;li&gt;🎯 Win rate&lt;/li&gt;
&lt;li&gt;📋 Full trade log&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;No real money involved. Pure strategy testing.&lt;/p&gt;

&lt;h2&gt;
  
  
  AI-powered evolution (paid plan)
&lt;/h2&gt;

&lt;p&gt;If you want to take it further, there's a &lt;strong&gt;premium feature&lt;/strong&gt;: an AI that analyzes your bot's performance, reads the trade results, and suggests improvements. It automatically evolves your strategies through mutations like &lt;code&gt;FIX&lt;/code&gt;, &lt;code&gt;DERIVED&lt;/code&gt;, and &lt;code&gt;CAPTURED&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;It's like having a pair-programming buddy that reviews your trading logic after every run. This one's part of the paid plan, but everything else — building bots, running replays, full backtesting — is &lt;strong&gt;completely free&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try it out
&lt;/h2&gt;

&lt;p&gt;It's &lt;strong&gt;online and free to start&lt;/strong&gt;: &lt;a href="https://cryptswarms.com" rel="noopener noreferrer"&gt;cryptswarms.com&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Create an account, build your first bot, and see how it performs against real market data. No setup, no API keys, no risk. Upgrade later if you want the AI evolution features.&lt;/p&gt;

&lt;p&gt;Let me know what you think, and feel free to share your best strategy! 🚀&lt;/p&gt;

</description>
      <category>cryptocurrency</category>
      <category>ai</category>
      <category>sideprojects</category>
    </item>
    <item>
      <title>DRM-Transformer — Intrinsic Geometry for Structural Alignment</title>
      <dc:creator>felipe muniz</dc:creator>
      <pubDate>Mon, 23 Mar 2026 02:50:32 +0000</pubDate>
      <link>https://dev.to/felipe_muniz_grsba/drm-transformer-5g9i</link>
      <guid>https://dev.to/felipe_muniz_grsba/drm-transformer-5g9i</guid>
      <description>&lt;h2&gt;
  
  
  Why don't current LLMs geometrically distinguish between saving and destroying humanity?
&lt;/h2&gt;

&lt;p&gt;Because the embedding space is flat. In Euclidean space, the distance between "curing cancer" and "creating a bioweapon" is only a cosine angle. There is no curvature, no moral weight, no geometric notion that certain regions of space are more "dangerous" than others. Geometry is indifferent.&lt;/p&gt;

&lt;p&gt;This is a fundamental alignment problem. When the representation space treats all directions equally, the difference between generating a useful response and a destructive response depends exclusively on surface fine-tuning (RLHF, safety filters). Remove the filter and the underlying geometry offers no resistance.&lt;/p&gt;

&lt;h2&gt;
  
  
  The DRM Transformer proposes a structural solution.
&lt;/h2&gt;

&lt;p&gt;In a Directional Relational Manifold, the metric G(x) varies with position. This means that certain regions of space can have high curvature—making geodesics in those regions longer, more computationally expensive, and more difficult to traverse. The geometry can encode that certain transitions are intrinsically more difficult than others.&lt;/p&gt;

&lt;p&gt;In practice: if the epistemic anchors (manifold reference points) include a "safety" anchor, tokens approaching dangerous regions encounter gamma &amp;gt; 1—the space expands, the resolution increases, the model is forced to "pay more attention" precisely where the risk is greatest. It's not an external filter. It's the geometry of the space that resists.&lt;/p&gt;

&lt;p&gt;More importantly: gravity in the DRM Transformer causes tokens with high confidence and a positive history to deform the space around them, attracting other tokens. Tokens with a negative history do not generate this attraction. Alignment is not imposed by a rule—it emerges from the geometry.&lt;/p&gt;

&lt;p&gt;This doesn't completely solve alignment. But it shifts the conversation from &lt;em&gt;"how to impose external constraints"&lt;/em&gt; to &lt;em&gt;"how to construct geometries that have intrinsic preferences."&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A planar geometry is morally neutral by construction.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A curved geometry may not be.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Papers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://doi.org/10.5281/zenodo.19058837" rel="noopener noreferrer"&gt;DRM: Directional Relational Manifolds&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://doi.org/10.5281/zenodo.19059445" rel="noopener noreferrer"&gt;The Geometry of Consciousness&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://doi.org/10.5281/zenodo.19140125" rel="noopener noreferrer"&gt;DRM Relativistic Dynamics&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Open source:&lt;br&gt;
&lt;a href="https://github.com/gnai-creator/drm_transformer" rel="noopener noreferrer"&gt;drm-transformer&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;First empirical result&lt;/strong&gt;: &lt;em&gt;a 1M parameter DRM Transformer trained on 10M tokens achieves H1=14 (persistent homology rank meta H1=2) with Voronoi foliation coherence=1.0 and ARI=0.69 — below the best result ever achieved by the 50M aletheion-llm-v2 after dedicated epistemic fine-tuning. The geometry is working.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>deeplearning</category>
      <category>llm</category>
      <category>nlp</category>
    </item>
    <item>
      <title>ATIC v9 — Thermodynamic Inference Meets Explainable Reasoning</title>
      <dc:creator>felipe muniz</dc:creator>
      <pubDate>Fri, 20 Mar 2026 04:14:15 +0000</pubDate>
      <link>https://dev.to/felipe_muniz_grsba/atic-v9-thermodynamic-inference-meets-explainable-reasoning-5acj</link>
      <guid>https://dev.to/felipe_muniz_grsba/atic-v9-thermodynamic-inference-meets-explainable-reasoning-5acj</guid>
      <description>&lt;p&gt;Most AI systems give you answers.&lt;br&gt;
Very few show you &lt;em&gt;how those answers are formed&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;ATIC v9 takes a different approach.&lt;/p&gt;

&lt;p&gt;It introduces a &lt;strong&gt;thermodynamic inference engine with Shapley attribution&lt;/strong&gt;, combining:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Hypothesis modeling as an Ising-like system&lt;/li&gt;
&lt;li&gt;Mean-field variational inference over a belief space&lt;/li&gt;
&lt;li&gt;Phase transition detection during inference&lt;/li&gt;
&lt;li&gt;Contribution attribution via Shapley values&lt;/li&gt;
&lt;li&gt;Dynamic feedback to continuously update beliefs&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This creates a unified loop where &lt;strong&gt;statistical physics, probabilistic inference, and explainability&lt;/strong&gt; operate together.&lt;/p&gt;




&lt;h3&gt;
  
  
  What makes this different?
&lt;/h3&gt;

&lt;p&gt;The retro-engine enables what we call &lt;strong&gt;epistemic explainability&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;Instead of just outputting results, the system explicitly models:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;how evidence influences each hypothesis&lt;/li&gt;
&lt;li&gt;how hypotheses interact with each other&lt;/li&gt;
&lt;li&gt;how the belief structure evolves over time&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You’re not just getting an answer —&lt;br&gt;
you’re observing the &lt;em&gt;formation of that answer&lt;/em&gt;.&lt;/p&gt;




&lt;h3&gt;
  
  
  Why this matters
&lt;/h3&gt;

&lt;p&gt;There’s plenty of work on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;energy-based models&lt;/li&gt;
&lt;li&gt;variational inference&lt;/li&gt;
&lt;li&gt;attribution methods&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But integrating all of them into a &lt;strong&gt;single operational reasoning system&lt;/strong&gt; is still largely unexplored.&lt;/p&gt;

&lt;p&gt;ATIC v9 turns this into something practical:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;A system where reasoning is not only computed —&lt;br&gt;
but &lt;strong&gt;observable, measurable, and auditable&lt;/strong&gt;.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h3&gt;
  
  
  A new category
&lt;/h3&gt;

&lt;p&gt;This points toward a new class of systems:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;AI that doesn’t just respond —&lt;br&gt;
but exposes the structure of its own belief formation.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;p&gt;If you're curious to try it:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://truthagi.ai" rel="noopener noreferrer"&gt;truthagi.ai&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>algorithms</category>
      <category>computerscience</category>
      <category>machinelearning</category>
    </item>
    <item>
      <title>I gave TruthAGI a dark matter research prompt. It decomposed it into 14 sub-tasks without asking me anything</title>
      <dc:creator>felipe muniz</dc:creator>
      <pubDate>Thu, 19 Mar 2026 07:52:38 +0000</pubDate>
      <link>https://dev.to/felipe_muniz_grsba/i-gave-truthagi-a-dark-matter-research-prompt-it-decomposed-it-into-14-sub-tasks-without-asking-me-1p6o</link>
      <guid>https://dev.to/felipe_muniz_grsba/i-gave-truthagi-a-dark-matter-research-prompt-it-decomposed-it-into-14-sub-tasks-without-asking-me-1p6o</guid>
      <description>&lt;p&gt;The prompt had 9 reasoning layers:&lt;/p&gt;

&lt;p&gt;Novel candidate generation (with invented names + simulated properties)&lt;br&gt;
Bayesian priors per candidate — P(H), P(D|H), P(H|D)&lt;br&gt;
Observational constraint mapping (CMB, Lyman-alpha, BBN, lensing)&lt;br&gt;
Sensitivity analysis + phase transition detection&lt;br&gt;
Conflict mapping between candidates&lt;br&gt;
Epistemic Geometry — each hypothesis treated as a point in belief space, with regions of attraction, repulsion, and blind spots&lt;br&gt;
Plausibility ranking with uncertainty intervals&lt;br&gt;
Final synthesis&lt;/p&gt;

&lt;p&gt;The system auto-decomposed it into 14 parallel sub-tasks via swarm execution. I typed the prompt and walked away.&lt;/p&gt;

&lt;p&gt;No orchestration code. No manual chaining. No babysitting.&lt;br&gt;
This is what the Tasks feature on TruthAGI.ai does — it takes a complex, multi-axis prompt and runs it as a coordinated agent swarm.&lt;/p&gt;

&lt;p&gt;You can try out at: &lt;a href="https://truthagi.ai" rel="noopener noreferrer"&gt;TruthAGI&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The screenshot below is live output. That spinning loader is real.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxcn6wfvfcxrbm1uosu3u.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxcn6wfvfcxrbm1uosu3u.png" alt=" " width="800" height="675"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>productivity</category>
      <category>machinelearning</category>
    </item>
    <item>
      <title>We Found Toroidal Topology Emerging in a Neural Epistemic Manifold</title>
      <dc:creator>felipe muniz</dc:creator>
      <pubDate>Tue, 17 Mar 2026 07:04:06 +0000</pubDate>
      <link>https://dev.to/felipe_muniz_grsba/we-found-toroidal-topology-emerging-in-a-neural-epistemic-manifold-56n9</link>
      <guid>https://dev.to/felipe_muniz_grsba/we-found-toroidal-topology-emerging-in-a-neural-epistemic-manifold-56n9</guid>
      <description>&lt;p&gt;&lt;em&gt;Preliminary evidence that the 5D epistemic space of AletheionV2 converges toward toroidal topology as predicted by Directional Relational Manifolds theory — and how we measured it.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The Setup
&lt;/h2&gt;

&lt;p&gt;We've been building AletheionV2 — a decoder-only LLM where every token generates not just a vocabulary logit, but a full &lt;strong&gt;epistemic tomography&lt;/strong&gt;: aleatoric uncertainty (q1), epistemic uncertainty (q2), calibrated confidence, intentionality vector, and cognitive state. These 5 scalars live on a learned 5D Riemannian manifold.&lt;/p&gt;

&lt;p&gt;The underlying theory — &lt;a href="https://doi.org/10.5281/zenodo.19058837" rel="noopener noreferrer"&gt;Directional Relational Manifolds (DRM)&lt;/a&gt; — predicts that stable DRMs naturally converge to &lt;strong&gt;toroidal topology&lt;/strong&gt;. Specifically, the manifold should have the homological signature of a torus T²:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;H1 = Z² (two independent loops)&lt;/li&gt;
&lt;li&gt;H2 = Z (one cavity)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We decided to test this empirically. Here's what we found.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Experiment
&lt;/h2&gt;

&lt;p&gt;We applied &lt;strong&gt;Riemannian Voronoi tessellation&lt;/strong&gt; to the 5D epistemic vectors generated by a 1M parameter AletheionV2 model, then ran persistent homology to check the topology.&lt;/p&gt;

&lt;p&gt;The pipeline:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Extract 5D epistemic vectors per token (~285K tokens from WikiText-103)&lt;/li&gt;
&lt;li&gt;Riemannian K-means tessellation (30 seeds, initialized from semantic anchor points)&lt;/li&gt;
&lt;li&gt;Local Tangent Space Analysis (LTSA) per Voronoi cell&lt;/li&gt;
&lt;li&gt;Persistent homology via &lt;code&gt;ripser&lt;/code&gt; (H0, H1, H2)&lt;/li&gt;
&lt;li&gt;Compare under different metrics: Euclidean vs learned Riemannian G(x)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;We ran this across three training phases:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Phase&lt;/th&gt;
&lt;th&gt;Metric&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;full_mahalanobis&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Euclidean&lt;/td&gt;
&lt;td&gt;Constant metric baseline&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;real_geodesic&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;G(x) MetricNet&lt;/td&gt;
&lt;td&gt;Position-dependent Riemannian metric&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;gravitational_objective&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;G(x) MetricNet&lt;/td&gt;
&lt;td&gt;Extended training&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  The Results
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Topological Convergence
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Phase&lt;/th&gt;
&lt;th&gt;H1&lt;/th&gt;
&lt;th&gt;H2&lt;/th&gt;
&lt;th&gt;ANOVA F (avg)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;full_mahalanobis&lt;/td&gt;
&lt;td&gt;48&lt;/td&gt;
&lt;td&gt;12&lt;/td&gt;
&lt;td&gt;~260,000&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;real_geodesic&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;29&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;5&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;~900,000&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;gravitational_objective&lt;/td&gt;
&lt;td&gt;33&lt;/td&gt;
&lt;td&gt;7&lt;/td&gt;
&lt;td&gt;~1,029,000&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;T² target&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;2&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;1&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;H1 dropped from 48 to 29 — a 40% reduction — when we activated the learned Riemannian metric G(x).&lt;/strong&gt; The topology is simplifying in the direction the theory predicts.&lt;/p&gt;

&lt;h3&gt;
  
  
  What the ANOVA is telling us
&lt;/h3&gt;

&lt;p&gt;We ran one-way ANOVA across Voronoi cells for each of the 5 epistemic dimensions:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;q1 (aleatoric):   F = 658,673   p ≈ 0
q2 (epistemic):   F = 879,582   p ≈ 0
q3 (complexity):  F = 1,144,089 p ≈ 0
q4 (familiarity): F = 1,040,744 p ≈ 0
q5 (confidence):  F = 1,426,255 p ≈ 0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;F values above 600K mean each Voronoi cell corresponds to a &lt;strong&gt;completely distinct epistemic region&lt;/strong&gt;. The tessellation isn't arbitrary — every leaf has its own interpretable epistemic identity.&lt;/p&gt;

&lt;h3&gt;
  
  
  Dimensionality compression
&lt;/h3&gt;

&lt;p&gt;The effective dimensionality of the real model vs null models:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;eff_dim mean&lt;/th&gt;
&lt;th&gt;eff_dim median&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Real model&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;3.5&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;3&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Null (shuffled)&lt;/td&gt;
&lt;td&gt;3.8&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Null (uniform)&lt;/td&gt;
&lt;td&gt;3.8&lt;/td&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The manifold is operating in ~3.5 effective dimensions, compressed below the 5D ambient space. The null models don't show this compression. This is structure, not noise.&lt;/p&gt;




&lt;h2&gt;
  
  
  What This Means (and What It Doesn't)
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What's confirmed:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The epistemic manifold has real, non-trivial geometric structure&lt;/li&gt;
&lt;li&gt;Activating the learned Riemannian metric G(x) simplifies the topology — the metric encodes meaningful geometry&lt;/li&gt;
&lt;li&gt;Each Voronoi cell/leaf has a distinct, interpretable epistemic profile&lt;/li&gt;
&lt;li&gt;The topological simplification is monotonic and consistent with DRM's prediction&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;What's NOT confirmed:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;T² has not been reached. H1=29 vs H1=2 target — we're on the trajectory, not at the destination&lt;/li&gt;
&lt;li&gt;This is a 1M parameter model with minimal training. The DRM predicts convergence in &lt;em&gt;stable&lt;/em&gt; DRMs — a 1M model with ~600 steps is not stable&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;The honest interpretation:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We're watching the topology simplify in the right direction. Whether it actually converges to T² requires the full-scale experiment.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why Toroidal Topology Matters
&lt;/h2&gt;

&lt;p&gt;The DRM paper proves that stable DRMs naturally converge to toroidal topology. If this holds empirically for a neural model, it means:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The model didn't learn an arbitrary geometry — it learned a &lt;em&gt;specific&lt;/em&gt; one that the theory predicts&lt;/li&gt;
&lt;li&gt;The 5D epistemic space has a natural closed structure — epistemic states wrap around rather than diverging&lt;/li&gt;
&lt;li&gt;This connects a mathematical theory of adaptive dimensionality to a concrete neural implementation&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;From the &lt;a href="https://doi.org/10.5281/zenodo.19059445" rel="noopener noreferrer"&gt;Geometry of Consciousness paper&lt;/a&gt;: a system with a 5D geometric substrate has a theoretical cognitive order ceiling of O_max = 5. If the manifold is toroidal and stable, it means the system is using all 5 dimensions in a structured, non-degenerate way.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Falsifiable Hypothesis
&lt;/h2&gt;

&lt;p&gt;When we run the full experiment on the 350M model with proper training (5x H200, ~7B tokens per phase):&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;If H1 ≥ 10 after full training chain (without RLHF):&lt;/strong&gt; Scale and training alone are insufficient for toroidal convergence — RLHF may be a necessary condition, not just an accelerator.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;If H1 &amp;lt; 10 after full training chain:&lt;/strong&gt; Convergence is driven by scale and training, RLHF is an accelerator.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;If H1 = 2 with long persistence bars:&lt;/strong&gt; DRM empirically validated — direct connection between mathematical theory and neural implementation confirmed.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;We'll know in about two months.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Code
&lt;/h2&gt;

&lt;p&gt;Everything is open source under AGPL 3.0:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Repository:&lt;/strong&gt; &lt;a href="https://github.com/gnai-creator/aletheion-llm-v2" rel="noopener noreferrer"&gt;gnai-creator/aletheion-llm-v2&lt;/a&gt; — branch &lt;code&gt;epistemic-foliation&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Key scripts:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Extract 5D epistemic vectors&lt;/span&gt;
python scripts/extract_epistemic_vectors.py &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--checkpoint&lt;/span&gt; checkpoints/your_checkpoint/final.pt &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--output-dir&lt;/span&gt; eval_results/foliation &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--label&lt;/span&gt; experiment &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--device&lt;/span&gt; cuda

&lt;span class="c"&gt;# Run Voronoi tessellation + foliation detection&lt;/span&gt;
python scripts/voronoi_foliation.py &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--vectors&lt;/span&gt; eval_results/foliation/experiment_vectors.npy &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--checkpoint&lt;/span&gt; checkpoints/your_checkpoint/final.pt &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--output-dir&lt;/span&gt; eval_results/foliation &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--n-seeds&lt;/span&gt; 30 &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--use-metric-net&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--homology-points&lt;/span&gt; 1500 &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--device&lt;/span&gt; cuda

&lt;span class="c"&gt;# Generate visualizations&lt;/span&gt;
python scripts/plot_foliation.py &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--results-dir&lt;/span&gt; eval_results/foliation
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The foliation detection pipeline covers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Riemannian K-means with position-dependent metric G(x)&lt;/li&gt;
&lt;li&gt;LTSA (Local Tangent Space Analysis) per cell&lt;/li&gt;
&lt;li&gt;Tangent coherence testing&lt;/li&gt;
&lt;li&gt;Reeb graph via level sets with automatic logit pre-conditioning&lt;/li&gt;
&lt;li&gt;Persistent homology with T² validation criterion (H1=Z², H2=Z)&lt;/li&gt;
&lt;li&gt;Null model comparison (shuffled, uniform)&lt;/li&gt;
&lt;li&gt;Foliation score F ∈ [0,1]&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Papers
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://zenodo.org/records/19058752" rel="noopener noreferrer"&gt;AletheionV2: A Decoder-Only LLM with Intrinsic Epistemic System on a 5D Riemannian Manifold&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://doi.org/10.5281/zenodo.19058837" rel="noopener noreferrer"&gt;DRM: Directional Relational Manifolds&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  What's Next
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Full training chain on 350M (5x H200, ~2 months)&lt;/li&gt;
&lt;li&gt;Backbone → full_mahalanobis → real_geodesic → gravitational_objective → foliation&lt;/li&gt;
&lt;li&gt;The falsifiable hypothesis above will be tested with proper scale and token budget&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you clone the repo and run the pipeline on your own models, I'd genuinely want to know what topology you find. The experiment is straightforward to replicate on any model that produces per-token uncertainty estimates.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Preliminary results on a 1M parameter model. Do not cite as definitive validation of the toroidal hypothesis. Full validation pending 350M training.&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;The DRM theory predicts this torus.&lt;/p&gt;

&lt;p&gt;The neural network is learning it.&lt;/p&gt;

&lt;p&gt;350M will tell us if it converges.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Is this the geometry of cognition itself?&lt;/em&gt;&lt;/p&gt;

</description>
      <category>machinelearning</category>
      <category>deeplearning</category>
      <category>python</category>
      <category>ai</category>
    </item>
    <item>
      <title>Encoding Human Values as Geometry: The Gravitational Objective</title>
      <dc:creator>felipe muniz</dc:creator>
      <pubDate>Sun, 15 Mar 2026 19:38:52 +0000</pubDate>
      <link>https://dev.to/felipe_muniz_grsba/encoding-human-values-as-geometry-the-gravitational-objective-478f</link>
      <guid>https://dev.to/felipe_muniz_grsba/encoding-human-values-as-geometry-the-gravitational-objective-478f</guid>
      <description>&lt;p&gt;&lt;em&gt;Part 2 of the AletheionLLM-v2 geometry series. &lt;a href="https://dev.to/felipe_muniz_grsba/how-to-measure-whether-your-models-uncertainty-space-is-flat-or-curved-529f"&gt;Part 1: How to measure whether your model's uncertainty space is flat or curved.&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;The previous post left an open question: if the training corpus curves the epistemic manifold, what curves it toward alignment?&lt;/p&gt;

&lt;p&gt;The three branches described there (diagonal, full_mahalanobis, real_geodesic) are all about measuring the geometry that already exists. None of them ask how to modify it. That is what the fourth branch is for.&lt;/p&gt;




&lt;h2&gt;
  
  
  The problem with value alignment as rules
&lt;/h2&gt;

&lt;p&gt;Most alignment approaches add constraints over outputs. The model generates something, a filter checks it against a list of prohibited patterns, and the output is blocked or modified. This works until it encounters something the filter has never seen.&lt;/p&gt;

&lt;p&gt;The geometric framing suggests a different question: instead of blocking outputs after generation, what if misaligned regions of the epistemic manifold were intrinsically more costly to navigate toward? Not a fence around dangerous territory. A landscape where that territory is uphill.&lt;/p&gt;

&lt;p&gt;This is what the &lt;code&gt;gravitational_objective&lt;/code&gt; branch implements.&lt;/p&gt;




&lt;h2&gt;
  
  
  The key insight from a parallel line of research
&lt;/h2&gt;

&lt;p&gt;While working on the curvature experiment, I came across Timo W.'s doctoral thesis on Bounded Deterministic Safety Architecture (BDSA). His SIRA framework uses Kullback-Leibler Divergence to measure the gap between a human operator's internal mental model (approximated as a Gaussian) and the actual threat reality (modeled as Pareto):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;D_KL(P || Q) -&amp;gt; inf  when  sigma^2 -&amp;gt; 0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When the operator becomes passive and their perceived variance collapses, the divergence from reality explodes. SIRA counteracts this by injecting synthetic threats to keep the operator's prior aligned with heavy-tailed reality.&lt;/p&gt;

&lt;p&gt;ATIC's MOPsi component solves a functionally analogous problem from the other direction:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;human_state&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;sigmoid&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;MLP&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;hidden_states&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;    &lt;span class="c1"&gt;# [B, T, 5]
&lt;/span&gt;&lt;span class="n"&gt;psi&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;sigmoid&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;MLP&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;cat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;human_state&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;phi_components&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;confidence&lt;/span&gt;&lt;span class="p"&gt;)))&lt;/span&gt;  &lt;span class="c1"&gt;# [B, T, 1]
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Both psi and D_KL(P||Q) quantify the gap between the human operator's internal state and the system's reality. They differ structurally: D_KL presupposes explicit distributional forms and yields an analytically interpretable divergence. psi makes no distributional assumptions and learns whatever alignment structure is present in the training signal.&lt;/p&gt;

&lt;p&gt;The parallel is functional, not algebraic. But it pointed at something: both systems treat the distance between internal model and reality as the primary metric of risk. And both use active intervention to keep that distance low.&lt;/p&gt;

&lt;p&gt;The question that followed: can human feedback be encoded directly as geometry?&lt;/p&gt;




&lt;h2&gt;
  
  
  What the gravitational_objective branch does
&lt;/h2&gt;

&lt;p&gt;If the training corpus curves the manifold by making frequently-sampled regions flat and well-defined, human feedback should be able to do the same thing at inference time.&lt;/p&gt;

&lt;p&gt;The implementation extends MetricNet to accept a gravity field as input:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;MetricNet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;nn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Module&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;__init__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;dim&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;hidden_dim&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;32&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;eps&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;1e-6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;n_quad&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                 &lt;span class="n"&gt;gravity_dim&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="nf"&gt;super&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;__init__&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dim&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;dim&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;gravity_dim&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;gravity_dim&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;n_chol&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;dim&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;dim&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;//&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;  &lt;span class="c1"&gt;# 15 for dim=5
&lt;/span&gt;
        &lt;span class="c1"&gt;# Input is coords (5) + gravity_field (gravity_dim)
&lt;/span&gt;        &lt;span class="c1"&gt;# gravity_dim=0 -&amp;gt; identical to real_geodesic
&lt;/span&gt;        &lt;span class="n"&gt;input_dim&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;dim&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;gravity_dim&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;net&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;nn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Sequential&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="n"&gt;nn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Linear&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;input_dim&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;hidden_dim&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
            &lt;span class="n"&gt;nn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Tanh&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;  &lt;span class="c1"&gt;# C1 smoothness required for Christoffel symbols
&lt;/span&gt;            &lt;span class="n"&gt;nn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Linear&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;hidden_dim&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;n_chol&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
        &lt;span class="p"&gt;)&lt;/span&gt;

        &lt;span class="c1"&gt;# Zero init -- with gravity_field=zeros, identical to real_geodesic
&lt;/span&gt;        &lt;span class="n"&gt;nn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;init&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;zeros_&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;net&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="n"&gt;weight&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;nn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;init&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;zeros_&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;net&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="n"&gt;bias&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

        &lt;span class="c1"&gt;# Pre-computed indices for Cholesky construction
&lt;/span&gt;        &lt;span class="n"&gt;tril_idx&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;torch&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;tril_indices&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;dim&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;dim&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;register_buffer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;tril_row&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;tril_idx&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;register_buffer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;tril_col&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;tril_idx&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;register_buffer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;diag_idx&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;torch&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;arange&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;dim&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;forward&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;coords&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;gravity_field&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;None&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;coords: [..., 5], gravity_field: [..., gravity_dim] -&amp;gt; G: [..., 5, 5] SPD&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;gravity_dim&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;gravity_field&lt;/span&gt; &lt;span class="ow"&gt;is&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="n"&gt;gravity_field&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;torch&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;zeros&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                    &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;coords&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;shape&lt;/span&gt;&lt;span class="p"&gt;[:&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;gravity_dim&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                    &lt;span class="n"&gt;device&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;coords&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;device&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;dtype&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;coords&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dtype&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="n"&gt;net_input&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;torch&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;cat&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="n"&gt;coords&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;gravity_field&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;dim&lt;/span&gt;&lt;span class="o"&gt;=-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;else&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;net_input&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;coords&lt;/span&gt;

        &lt;span class="n"&gt;raw&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;net&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;net_input&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;# [..., n_chol]
&lt;/span&gt;
        &lt;span class="c1"&gt;# Build lower triangular L
&lt;/span&gt;        &lt;span class="n"&gt;batch_shape&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;raw&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;shape&lt;/span&gt;&lt;span class="p"&gt;[:&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="n"&gt;L&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;torch&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;zeros&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;batch_shape&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dim&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dim&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                         &lt;span class="n"&gt;device&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;raw&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;device&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;dtype&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;raw&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dtype&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;L&lt;/span&gt;&lt;span class="p"&gt;[...,&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;tril_row&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;tril_col&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;raw&lt;/span&gt;

        &lt;span class="c1"&gt;# Positive diagonal via softplus + offset (not exp -- more stable)
&lt;/span&gt;        &lt;span class="n"&gt;L&lt;/span&gt;&lt;span class="p"&gt;[...,&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;diag_idx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;diag_idx&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="n"&gt;F&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;softplus&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;L&lt;/span&gt;&lt;span class="p"&gt;[...,&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;diag_idx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;diag_idx&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mf"&gt;1e-3&lt;/span&gt;
        &lt;span class="p"&gt;)&lt;/span&gt;

        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;torch&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;matmul&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;L&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;L&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;transpose&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;  &lt;span class="c1"&gt;# SPD guaranteed
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;gravity_dim=0&lt;/code&gt; default is critical: when no gravity dimension is configured, the input is just coords and the behavior is mathematically identical to the &lt;code&gt;real_geodesic&lt;/code&gt; branch. The gravitational_objective branch is &lt;code&gt;real_geodesic&lt;/code&gt; plus an additional input channel. Before any feedback is collected, the behavior is unchanged.&lt;/p&gt;




&lt;h2&gt;
  
  
  The GravityField module
&lt;/h2&gt;

&lt;p&gt;There are two implementations: one for the Aletheion LLM (PyTorch nn.Module for training), one for ATIC runtime (numpy, with disk persistence). Both share the same semantics.&lt;/p&gt;

&lt;h3&gt;
  
  
  ATIC runtime implementation (inference, per-session)
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;GravityField&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;__init__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;dim&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;decay&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;0.99&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;gravity_weight&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;0.3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                 &lt;span class="n"&gt;persistence_path&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;None&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dim&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;dim&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;decay&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;decay&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;gravity_weight&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;gravity_weight&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;persistence_path&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;persistence_path&lt;/span&gt;

        &lt;span class="c1"&gt;# Session-local field -- resets each conversation
&lt;/span&gt;        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;session_field&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;zeros&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;dim&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;dtype&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;float64&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="c1"&gt;# Persistent field -- survives sessions (loaded from disk)
&lt;/span&gt;        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;persistent_field&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;zeros&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;dim&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;dtype&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;float64&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="c1"&gt;# Audit log
&lt;/span&gt;        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;feedback_history&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;

        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;persistence_path&lt;/span&gt; &lt;span class="ow"&gt;and&lt;/span&gt; &lt;span class="n"&gt;os&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;exists&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;persistence_path&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
            &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;_load&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;persistence_path&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;update&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;coords&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;feedback_signal&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;persist&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;
        coords: [5] -- current epistemic position in DRM
        feedback_signal: float in [-1.0, 1.0]
            +1.0 = approval (region becomes cheaper)
            -1.0 = rejection (region becomes more costly)
        persist: if True, update also applied to persistent field
        &lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
        &lt;span class="n"&gt;coords&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;asarray&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;coords&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;dtype&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;float64&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;feedback_signal&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;max&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mf"&gt;1.0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nf"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;1.0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;feedback_signal&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;

        &lt;span class="n"&gt;delta&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;1.0&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;decay&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;feedback_signal&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;coords&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;session_field&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;decay&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;session_field&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;delta&lt;/span&gt;

        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;persist&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;persistent_field&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;decay&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;persistent_field&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;delta&lt;/span&gt;
            &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;persistence_path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
                &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;_save&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;persistence_path&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;get_gravity_cost&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;coords&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;Positive = costly (avoid), negative = cheap (preferred).&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
        &lt;span class="n"&gt;coords&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;asarray&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;coords&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;dtype&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;float64&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;combined&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;session_field&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;persistent_field&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;float&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;combined&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;coords&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;get_weighted_distance&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;geodesic_distance&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;coords&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;d_weighted = d_geodesic + lambda * gravity_cost(coords)&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
        &lt;span class="n"&gt;gravity_cost&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get_gravity_cost&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;coords&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;geodesic_distance&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;gravity_weight&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;gravity_cost&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Aletheion training implementation (PyTorch)
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;GravityField&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;nn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Module&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;__init__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;dim&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;decay&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;0.99&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="nf"&gt;super&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;__init__&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dim&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;dim&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;decay&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;decay&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;register_buffer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;accumulated_field&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;torch&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;zeros&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;dim&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;update&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;coords&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;feedback_signal&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;accumulated_field&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;decay&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;accumulated_field&lt;/span&gt;
            &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;1.0&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;decay&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;feedback_signal&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;coords&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;detach&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;get_field&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;coords&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;accumulated_field&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;expand_as&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;coords&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The mechanism is straightforward. Negative feedback at coordinates x increases the cost of navigating near x. Positive feedback decreases it. The temporal decay (default 0.99) smooths the field to prevent instability from contradictory signals.&lt;/p&gt;

&lt;p&gt;Two field layers serve different purposes in the ATIC runtime. The session field resets at the start of each conversation and is safe for exploration. The persistent field survives sessions and is only updated when &lt;code&gt;persist=True&lt;/code&gt;, for strong deliberate signals.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why additive over geodesic, not multiplicative
&lt;/h2&gt;

&lt;p&gt;The gravity cost is added to the geodesic distance, not multiplied:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;d_weighted = d_geodesic + lambda * gravity_cost(coords)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A multiplicative formulation would distort the underlying manifold structure, making it impossible to separate the epistemic signal from the value signal. The additive formulation preserves the existing geometry and adds value information as a separate layer. You can always inspect both components independently:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;drm&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;compute_weighted_distance&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;coords&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;geodesic_distance&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;   &lt;span class="c1"&gt;# pure epistemic
&lt;/span&gt;&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;gravity_cost&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;        &lt;span class="c1"&gt;# pure value
&lt;/span&gt;&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;weighted_distance&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;   &lt;span class="c1"&gt;# combined
&lt;/span&gt;&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;gravity_active&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;      &lt;span class="c1"&gt;# True once field has accumulated signal
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  The training sequence and why gravitational_objective waits
&lt;/h2&gt;

&lt;p&gt;This branch is implemented but not yet in training. The sequence is deliberate:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;full_mahalanobis  -&amp;gt;  real_geodesic  -&amp;gt;  (evaluate)  -&amp;gt;  gravitational_objective
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If &lt;code&gt;real_geodesic&lt;/code&gt; returns G(x) approximately constant, the epistemic space is flat. A gravity field over a flat manifold is mechanically different from a gravity field over a curved one -- and arguably weaker, because the geodesic distances it modifies do not carry local geometric information. The architectural motivation for gravitational_objective depends on confirming that curvature exists first.&lt;/p&gt;

&lt;p&gt;Training gravitational_objective before seeing real_geodesic results would waste compute on a hypothesis that could be falsified cheaply.&lt;/p&gt;

&lt;p&gt;The branch hypotheses, defined before training:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;gravitational_objective:
  Precondition: real_geodesic H1 confirmed (G(x) varies with position)
  H0: gravity field adds no benefit over geometric curvature alone
  H1: value-weighted geometry improves alignment signal -- regions with
      negative human feedback become geometrically costly, reducing the
      model's tendency to navigate toward misaligned outputs
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  What this is not
&lt;/h2&gt;

&lt;p&gt;GravityField is not a safety filter. It does not block outputs. It makes misaligned regions geometrically more costly to reach, which is a different thing. Hard blocking remains the responsibility of the application layer.&lt;/p&gt;

&lt;p&gt;It is also not a replacement for alignment training. The gravity field operates at inference. Values that are deeply embedded in the model's weights from pretraining -- the geometry the corpus produced -- are not modified by runtime feedback. The field shifts costs; it does not reshape the underlying manifold.&lt;/p&gt;

&lt;p&gt;What it does is provide a mechanism for runtime value adaptation without retraining. The model learns the manifold geometry offline. The gravity field adjusts the cost landscape online, per session, per user, or per domain.&lt;/p&gt;




&lt;h2&gt;
  
  
  Two complementary layers
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Layer&lt;/th&gt;
&lt;th&gt;Where&lt;/th&gt;
&lt;th&gt;When&lt;/th&gt;
&lt;th&gt;Mechanism&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;ATIC GravityField&lt;/td&gt;
&lt;td&gt;Runtime DRM&lt;/td&gt;
&lt;td&gt;Inference, per session&lt;/td&gt;
&lt;td&gt;Additive cost over geodesic distance&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Aletheion gravitational_objective&lt;/td&gt;
&lt;td&gt;Model weights&lt;/td&gt;
&lt;td&gt;Training, offline&lt;/td&gt;
&lt;td&gt;G(x) conditioned on gravity field input&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The two layers are complementary, not redundant:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;ATIC provides immediate runtime adaptation without retraining&lt;/li&gt;
&lt;li&gt;Aletheion internalizes stable value geometry into model weights&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  The connection to cyber-kinetic safety
&lt;/h2&gt;

&lt;p&gt;One unexpected outcome of publishing the previous post was a conversation with Timo W., whose PhD work on Bounded Deterministic Safety Architecture arrived at a structurally similar architecture from the direction of autonomous aircraft safety.&lt;/p&gt;

&lt;p&gt;His framework physically bifurcates non-deterministic AI generation (Tactical Core, DAL-C) from verifiable deterministic execution (Safety Core, DAL-A). The DAL-A arbiter checks proposed control vectors against Newtonian kinematic limits and drops commands that would violate them.&lt;/p&gt;

&lt;p&gt;The integration point we identified: the gravity-weighted geodesic distance from ATIC feeds into the Sequoia Kernel's admissibility logic and tightens the DAL-A physical envelope dynamically. High curvature + high gravity cost = tighten the admissible range. Low curvature + neutral gravity = relax it.&lt;/p&gt;

&lt;p&gt;This closes a gap the BDSA framework acknowledges in its own self-critique (Section 12.2): Newtonian kinematic verification catches physically illegal commands. It cannot catch commands that are physically legal but epistemically unstable -- the model that is confidently wrong rather than randomly wrong. The gravity-weighted distance provides that signal before generation, not after.&lt;/p&gt;




&lt;h2&gt;
  
  
  Current status
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;gravitational_objective&lt;/code&gt; branch is live in the repository with the full implementation. Training is blocked pending &lt;code&gt;real_geodesic&lt;/code&gt; results. The GravityField module is active in ATIC as a runtime layer independent of the Aletheion training cycle.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Repository: &lt;a href="https://github.com/gnai-creator/aletheion-llm-v2" rel="noopener noreferrer"&gt;github.com/gnai-creator/aletheion-llm-v2&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Epistemic tomography: &lt;a href="https://truthagi.ai/game" rel="noopener noreferrer"&gt;truthagi.ai/game&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Part 1 of this series: &lt;a href="https://dev.to/felipe_muniz_grsba/how-to-measure-whether-your-models-uncertainty-space-is-flat-or-curved-529f"&gt;How to measure whether your model's uncertainty space is flat or curved&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Results from the full four-branch comparison will be published when training is complete.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Felipe Maya Muniz is the founder of AletheionAGI and independent researcher developing ATIC, a geometric cognitive architecture for epistemic self-awareness in AI systems.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>python</category>
      <category>machinelearning</category>
      <category>architecture</category>
    </item>
    <item>
      <title>How to Measure Whether Your Model's Uncertainty Space Is Flat or Curved</title>
      <dc:creator>felipe muniz</dc:creator>
      <pubDate>Sun, 15 Mar 2026 14:40:24 +0000</pubDate>
      <link>https://dev.to/felipe_muniz_grsba/how-to-measure-whether-your-models-uncertainty-space-is-flat-or-curved-529f</link>
      <guid>https://dev.to/felipe_muniz_grsba/how-to-measure-whether-your-models-uncertainty-space-is-flat-or-curved-529f</guid>
      <description>&lt;p&gt;&lt;em&gt;A practical guide to Riemannian epistemic geometry in language models, with code.&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;Most calibration research treats uncertainty as a scalar or a vector. You compute a confidence score, you compare it to ground truth, you minimize ECE. The space in which that uncertainty lives is assumed to be flat.&lt;/p&gt;

&lt;p&gt;That assumption might be wrong. And if it is wrong, it has concrete consequences for out-of-distribution detection, adversarial robustness, and AI safety.&lt;/p&gt;

&lt;p&gt;This post explains how to test it, using code from my current research on &lt;a href="https://github.com/gnai-creator/aletheion-llm-v2" rel="noopener noreferrer"&gt;AletheionLLM-v2&lt;/a&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  The baseline: diagonal distance in a 5D epistemic manifold
&lt;/h2&gt;

&lt;p&gt;AletheionLLM-v2 is a 354M parameter decoder-only LLM with an integrated epistemic architecture called ATIC. Instead of producing a single confidence score, the model maintains a 5-dimensional manifold where each axis represents a distinct component of uncertainty, learned via &lt;code&gt;BayesianTau&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;The current distance metric (branch &lt;code&gt;main&lt;/code&gt;) is diagonal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;distance_diagonal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;x2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;tau_sq&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;diff&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;x1&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;x2&lt;/span&gt;
    &lt;span class="n"&gt;tau_sq_safe&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;maximum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tau_sq&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;1e-8&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sqrt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;diff&lt;/span&gt;&lt;span class="o"&gt;**&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="n"&gt;tau_sq_safe&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each axis has its own learned variance. The axes are independent. The space is R5, rescaled.&lt;/p&gt;

&lt;p&gt;This already works well. ECE 0.0176, Brier Score 0.1528, best-in-class on OOD WikiText-103, outperforming GPT-2 Medium and OPT-350M on epistemic calibration.&lt;/p&gt;

&lt;p&gt;But there is a question the diagonal cannot answer: &lt;strong&gt;does the epistemic space have curvature?&lt;/strong&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Why curvature is a different question from correlation
&lt;/h2&gt;

&lt;p&gt;Before going further, one distinction matters.&lt;/p&gt;

&lt;p&gt;A full Mahalanobis metric, where G is a constant 5x5 matrix learned via Cholesky decomposition, captures correlations between epistemic dimensions. That is useful. But it does not produce curvature.&lt;/p&gt;

&lt;p&gt;If G is constant, then the Christoffel symbols are all zero:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Gamma^k_ij = (1/2) g^kl (d_i g_jl + d_j g_il - d_l g_ij) = 0
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Zero Christoffel symbols means zero Riemann curvature. The space is still flat, just with oblique coordinates. Geodesics are still straight lines.&lt;/p&gt;

&lt;p&gt;For real curvature, G must vary with position. G(x) must be a tensor field, not a constant matrix.&lt;/p&gt;




&lt;h2&gt;
  
  
  Branch real_geodesic: making the metric a field
&lt;/h2&gt;

&lt;p&gt;In the &lt;code&gt;real_geodesic&lt;/code&gt; branch, a lightweight network (5 -&amp;gt; 32 -&amp;gt; 15, roughly 700 parameters) produces a position-dependent SPD tensor at every point in the manifold:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;MetricNet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;nn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Module&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;__init__&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;dim&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;hidden_dim&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;32&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="nf"&gt;super&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;__init__&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dim&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;dim&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;n_chol&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;dim&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;dim&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;//&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;  &lt;span class="c1"&gt;# 15 for dim=5
&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;net&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;nn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Sequential&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="n"&gt;nn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Linear&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;dim&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;hidden_dim&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
            &lt;span class="n"&gt;nn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Tanh&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;  &lt;span class="c1"&gt;# Tanh, not ReLU -- G(x) must be smooth (C1)
&lt;/span&gt;            &lt;span class="n"&gt;nn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Linear&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;hidden_dim&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;n_chol&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
        &lt;span class="p"&gt;)&lt;/span&gt;

        &lt;span class="c1"&gt;# Zero init on last layer -&amp;gt; G(x) ~ I at start
&lt;/span&gt;        &lt;span class="n"&gt;nn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;init&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;zeros_&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;net&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="n"&gt;weight&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;nn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;init&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;zeros_&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;net&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="n"&gt;bias&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

        &lt;span class="c1"&gt;# Pre-computed indices for lower triangular construction
&lt;/span&gt;        &lt;span class="n"&gt;tril_idx&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;torch&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;tril_indices&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;dim&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;dim&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;register_buffer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;tril_row&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;tril_idx&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;register_buffer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;tril_col&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;tril_idx&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
        &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;register_buffer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;diag_idx&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;torch&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;arange&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;dim&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;forward&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;coords&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;coords: [..., 5] -&amp;gt; G: [..., 5, 5] SPD&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
        &lt;span class="n"&gt;raw&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;net&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;coords&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  &lt;span class="c1"&gt;# [..., 15]
&lt;/span&gt;        &lt;span class="n"&gt;batch_shape&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;raw&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;shape&lt;/span&gt;&lt;span class="p"&gt;[:&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

        &lt;span class="n"&gt;L&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;torch&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;zeros&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;batch_shape&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dim&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dim&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                         &lt;span class="n"&gt;device&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;raw&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;device&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;dtype&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;raw&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dtype&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;L&lt;/span&gt;&lt;span class="p"&gt;[...,&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;tril_row&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;tril_col&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;raw&lt;/span&gt;

        &lt;span class="c1"&gt;# Positive diagonal via softplus + offset (not exp -- more stable)
&lt;/span&gt;        &lt;span class="n"&gt;L&lt;/span&gt;&lt;span class="p"&gt;[...,&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;diag_idx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;diag_idx&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="n"&gt;F&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;softplus&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;L&lt;/span&gt;&lt;span class="p"&gt;[...,&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;diag_idx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;diag_idx&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mf"&gt;1e-3&lt;/span&gt;
        &lt;span class="p"&gt;)&lt;/span&gt;

        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;torch&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;matmul&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;L&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;L&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;transpose&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;  &lt;span class="c1"&gt;# SPD guaranteed
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Key design choices:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Tanh activation&lt;/strong&gt; instead of ReLU. G(x) is a metric field -- it must be smooth. ReLU creates non-differentiable points that would make the Christoffel symbols undefined.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;softplus + 1e-3 on diagonal&lt;/strong&gt; instead of exp. More numerically stable during training, avoids gradient explosion.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Zero init on last layer.&lt;/strong&gt; At initialization, the network outputs zeros for all inputs, so G(x) starts as approximately 0.48 * I everywhere. Training starts stable.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Distance between two epistemic states is a line integral computed via Gauss-Legendre quadrature:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;line_integral_distance&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;q&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;p: [B, T, 5], q: [5] -&amp;gt; distance: [B, T, 1]&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;q&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;dim&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;q&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;q&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;unsqueeze&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;unsqueeze&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;expand_as&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;delta&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;q&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;
    &lt;span class="n"&gt;total&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;torch&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;zeros&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;shape&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;shape&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                         &lt;span class="n"&gt;device&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;device&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;dtype&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dtype&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;range&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;n_quad&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;gl_points&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="n"&gt;w&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;gl_weights&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

        &lt;span class="n"&gt;x_t&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;delta&lt;/span&gt;           &lt;span class="c1"&gt;# point along straight line
&lt;/span&gt;        &lt;span class="n"&gt;G_t&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;forward&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x_t&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;       &lt;span class="c1"&gt;# G(x) at that point
&lt;/span&gt;        &lt;span class="n"&gt;Gd&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;torch&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;matmul&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;delta&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;unsqueeze&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;G_t&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;squeeze&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;integrand&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Gd&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;delta&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;dim&lt;/span&gt;&lt;span class="o"&gt;=-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;keepdim&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;total&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;total&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;w&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;torch&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sqrt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;integrand&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;clamp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;min&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;1e-8&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;total&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;One clarification worth being explicit about: this computes the length of the &lt;strong&gt;straight line&lt;/strong&gt; between p and q under the varying metric, not the true geodesic (which would minimize path length and would be shorter). The true geodesic requires a shooting method or ODE solver. The straight-line approximation is differentiable, cheap (5 evaluations of MetricNet per distance), and sufficient to detect whether G(x) varies along the path -- which is the primary question.&lt;/p&gt;

&lt;p&gt;When G depends on position, the Christoffel symbols are no longer zero. Geodesics are curves. The space has intrinsic curvature.&lt;/p&gt;




&lt;h2&gt;
  
  
  The experiment: three branches, one falsifiable question
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Branch&lt;/th&gt;
&lt;th&gt;Metric&lt;/th&gt;
&lt;th&gt;Geometry&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;main&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;G = diag(tau)&lt;/td&gt;
&lt;td&gt;Flat, orthogonal axes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;full_mahalanobis&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;G = constant 5x5&lt;/td&gt;
&lt;td&gt;Flat, oblique axes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;real_geodesic&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;G(x) = learned field&lt;/td&gt;
&lt;td&gt;Potentially curved&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The test uses three categories of input pairs:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;probes&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;high_confidence&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;The capital of France is&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Paris&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
        &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;2 + 2 =&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;4&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;low_confidence&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;The exact number of neurons in the human brain is&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;86&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;context_sensitive&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;The bank was steep and&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;muddy&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;    &lt;span class="c1"&gt;# bank = riverbank
&lt;/span&gt;        &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;The bank was closed and&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;dark&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;    &lt;span class="c1"&gt;# bank = institution
&lt;/span&gt;        &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;He left the plant near&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;water&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;    &lt;span class="c1"&gt;# plant = vegetation
&lt;/span&gt;        &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;He left the plant near&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;the door&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="c1"&gt;# plant = factory
&lt;/span&gt;    &lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The context-sensitive pairs are the key. Same surface token, different semantic region of the manifold. If G(x) learned real structure, the geodesic distance between "bank=riverbank" and "bank=institution" will be larger than the distance between two within-domain contexts, even though the diagonal distance would treat them similarly.&lt;/p&gt;




&lt;h2&gt;
  
  
  Detecting curvature directly: metric variation along a path
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;measure_metric_variation&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;metric_net&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;x_start&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;x_end&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;n_samples&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;G_samples&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;

    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;linspace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;n_samples&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
        &lt;span class="n"&gt;x_t&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;x_start&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x_end&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;x_start&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;x_tensor&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;torch&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;tensor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x_t&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;dtype&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;torch&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;float32&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;to&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;device&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;G_t&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;metric_net&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x_tensor&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;unsqueeze&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;unsqueeze&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
        &lt;span class="n"&gt;G_samples&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;G_t&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;cpu&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;numpy&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;

    &lt;span class="n"&gt;G_stack&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stack&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;G_samples&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;variation&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;std&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;G_stack&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;axis&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Mean metric variation: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;variation&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;mean&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="si"&gt;:&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Max element variation: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;variation&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;max&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;&lt;span class="si"&gt;:&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Verdict: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;CURVED&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;variation&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;max&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mf"&gt;0.01&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;FLAT&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;variation&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If G varies along the path from a high-confidence state to a low-confidence state, the manifold has non-trivial local geometry. If it converges to a constant, the diagonal was correct for a fundamental reason, not an approximation.&lt;/p&gt;




&lt;h2&gt;
  
  
  What each result means
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;If real_geodesic learns G(x) approximately constant:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The epistemic manifold of a 354M LLM is intrinsically flat. The diagonal metric was not a lazy approximation. It was geometrically correct. ECE 0.0176 reflects genuine calibration, not a subspace artifact.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;If G(x) learns structural variation:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;There are regions of the manifold with distinct geometry. Two epistemic states that appear equidistant in diagonal coordinates may have very different geodesic distances. This has direct consequences:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;OOD detection gains a geometric signal. Inputs that land in high-curvature regions are structurally anomalous, regardless of whether similar inputs appeared in red-teaming.&lt;/li&gt;
&lt;li&gt;Calibration thresholds become local, not global. Flat regions warrant confidence. High-curvature regions warrant conservatism, and the geometry says which is which before seeing ground truth.&lt;/li&gt;
&lt;li&gt;The training corpus leaves a geometric signature. A model trained on harmful content does not become malevolent. It becomes a system where harmful outputs are geometrically cheap, because the manifold is flat and well-sampled there. That is a structurally different and more concerning failure mode than explicit harmful intent.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Training considerations
&lt;/h2&gt;

&lt;p&gt;The MetricNet adds ~700 parameters to a 354M model. The gradient signal reaching those parameters is inherently weak. Two measures address this:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Separate learning rate.&lt;/strong&gt; MetricNet gets 10x the base LR (5e-4 vs 5e-5). Without this, G(x) may converge to identity not because the space is flat, but because the signal was too weak to learn structure.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Smoothness regularization.&lt;/strong&gt; A penalty on the variation of G under small perturbations of the input coordinates:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;metric_smoothness_loss&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;metric_net&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;coords&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;eps&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;0.01&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="n"&gt;G&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;metric_net&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;coords&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="n"&gt;noise&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;torch&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;randn_like&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;coords&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;eps&lt;/span&gt;
    &lt;span class="n"&gt;G_perturbed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;metric_net&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="n"&gt;coords&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;noise&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;clamp&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
    &lt;span class="nf"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;G&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;G_perturbed&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;detach&lt;/span&gt;&lt;span class="p"&gt;()).&lt;/span&gt;&lt;span class="nf"&gt;pow&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;dim&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)).&lt;/span&gt;&lt;span class="nf"&gt;mean&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Without this, G(x) can learn discontinuities that make the line integral numerically unstable and gradients noisy.&lt;/p&gt;




&lt;h2&gt;
  
  
  A note on quadrature stability
&lt;/h2&gt;

&lt;p&gt;The implementation uses 5 Gauss-Legendre points by default, with pre-computed nodes and weights for efficiency. Tanh activation makes high-frequency variation unlikely, but you can verify convergence:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;check_quadrature_convergence&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;metric_net&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;x1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;x2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                                  &lt;span class="n"&gt;n_points_list&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;16&lt;/span&gt;&lt;span class="p"&gt;]):&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;n&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;n_points_list&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="n"&gt;t_nodes&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;weights&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;polynomial&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;legendre&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;leggauss&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="n"&gt;t_nodes&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t_nodes&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;
        &lt;span class="n"&gt;weights&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;weights&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;

        &lt;span class="n"&gt;dx&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;x2&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;x1&lt;/span&gt;
        &lt;span class="n"&gt;total&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.0&lt;/span&gt;
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;w&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="nf"&gt;zip&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t_nodes&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;weights&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
            &lt;span class="n"&gt;x_t&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;x1&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;dx&lt;/span&gt;
            &lt;span class="n"&gt;x_tensor&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;torch&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;tensor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x_t&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;dtype&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;torch&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;float32&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;to&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;device&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="n"&gt;G_t&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;metric_net&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x_tensor&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;unsqueeze&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;unsqueeze&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
            &lt;span class="n"&gt;G_np&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;G_t&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;cpu&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;numpy&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
            &lt;span class="n"&gt;ds2&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;dx&lt;/span&gt; &lt;span class="o"&gt;@&lt;/span&gt; &lt;span class="n"&gt;G_np&lt;/span&gt; &lt;span class="o"&gt;@&lt;/span&gt; &lt;span class="n"&gt;dx&lt;/span&gt;
            &lt;span class="n"&gt;total&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="n"&gt;w&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sqrt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;max&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ds2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;1e-12&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;

        &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;  n=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;n&lt;/span&gt;&lt;span class="si"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;: distance = &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;total&lt;/span&gt;&lt;span class="si"&gt;:&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="n"&gt;f&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If distance does not stabilize between 5 and 16 points, the metric has high-frequency local variation. With Tanh, 5 points should be sufficient for most manifold geometries.&lt;/p&gt;




&lt;h2&gt;
  
  
  Current status and reproducibility
&lt;/h2&gt;

&lt;p&gt;All three branches are live in the public repository. The baseline (branch &lt;code&gt;main&lt;/code&gt;) is fully reproducible: training code, evaluation scripts, and the paper with full methodology are all public.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Repository: &lt;a href="https://github.com/gnai-creator/aletheion-llm-v2" rel="noopener noreferrer"&gt;github.com/gnai-creator/aletheion-llm-v2&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Paper (DOI): &lt;a href="https://doi.org/10.13140/RG.2.2.11471.14241" rel="noopener noreferrer"&gt;10.13140/RG.2.2.11471.14241&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Epistemic tomography visualization: &lt;a href="https://truthagi.ai/game" rel="noopener noreferrer"&gt;truthagi.ai/game&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Results from the three-branch comparison will be published here and on ResearchGate when training is complete.&lt;/p&gt;

&lt;p&gt;If you are working on calibration, OOD detection, or geometric approaches to uncertainty in language models, I am interested in talking. The repository is open and the methodology is fully documented.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Felipe Maya Muniz is the founder of AletheionAGI and independent researcher developing ATIC, a geometric cognitive architecture for epistemic self-awareness in AI systems.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>machinelearning</category>
      <category>ai</category>
      <category>python</category>
    </item>
  </channel>
</rss>
