gchauhan commited on
Commit
bb41312
·
verified ·
1 Parent(s): 551ebbd

Add session 40a26b08-f6bd-4a79-b1af-9f3f58f90589

Browse files
sessions/2026-05-10/40a26b08-f6bd-4a79-b1af-9f3f58f90589.jsonl CHANGED
@@ -21,3 +21,4 @@
21
  {"type": "user", "message": {"role": "user", "content": [{"type": "tool_result", "tool_use_id": "BpQb5segui0MaPriXgVma7L2g0Ml0wW8", "content": "# 3 Building a Recursive Multi-Agent System\nhttps://arxiv.org/abs/2604.25917\n\nFigure 2: Overall Architecture of RecursiveMAS . Each agent first leverages the inner RecursiveLink to perform latent thoughts generation, and then transfers the generated information to the next agent through the outer RecursiveLink. After the last agent finishes generation, its latent thoughts are fed back to the first agent, thereby forming a recursive loop within the multi-agent system.\n\nWe introduce RecursiveMAS , an end-to-end recursive framework that links heterogeneous LLM agents together to scale the entire system through efficient and seamless latent collaboration. In the following, we will first elaborate the detailed architectural design of RecursiveMAS , and then present the corresponding recursive learning algorithm. We also interleave theoretical analyses throughout the method pipeline to support underlying design principles.\n\n3.1 A Lightweight RecursiveLink Figure 3: Illustration on the inner and outer RecursiveLink Design. A language model\u2019s last-layer hidden states provide a natural representation of its generated semantics.\nThe RecursiveLink \u211b \\mathcal{R} is designed to preserve and transmit this information from one embedding space to another.\nIn RecursiveMAS , the transition arises in two cases:\n(i) Dense-to-Shallow Transition , where the previous step\u2019s last-layer embeddings are fed back as the next-step input embeddings during latent thoughts generation;\nand (ii) Cross-Model Transition , where one model\u2019s newly generated latent representations are passed as conditioning inputs to another model.\nAs illustrated in Figure 3 , we bridge these two transitions through the inner and outer links. Inner Link. Each LLM agent A i \u2208 \ud835\udc9c A_{i}\\in\\mathcal{A} is paired with an inner RecursiveLink \u211b in \\mathcal{R}_{\\text{in}} during auto-regressive generation. Given any new last-layer embedding vector h h , \u211b in \\mathcal{R}_{\\text{in}} transforms it as: \u211b in \u200b ( h ) = h + W 2 \u200b \u03c3 \u200b ( W 1 \u200b h ) , \\mathcal{R}_{\\text{in}}(h)=h+W_{2}\\,\\sigma(W_{1}h), (3) where W 1 W_{1} and W 2 W_{2} are two standard linear layers, \u03c3 \u200b ( \u22c5 ) \\sigma(\\cdot) is the GELU activation, and the residual connection preserves the original latent semantics. The transformed embedding is then used as input to the next forward pass of agent A i A_{i} . Outer Link. An outer RecursiveLink \u211b out \\mathcal{R}_{\\mathrm{out}} connects heterogeneous agents with different hidden dimensions. To support this, an additional linear layer W 3 W_{3} is introduced in the residual branch to map the source embedding from agent A i A_{i} into the target embedding space of agent A j A_{j} , i.e., \u211b out \u200b ( h ) = W 3 \u200b h + W 2 \u200b \u03c3 \u200b ( W 1 \u200b h ) . \\mathcal{R}_{\\mathrm{out}}(h)=W_{3}h+W_{2}\\,\\sigma(W_{1}h). (4) Why Residual Connection? The residual branch largely preserves the original semantics of the input, allowing the RecursiveLink network to focus on aligning distributional differences rather than learning the full projection from scratch. This leads to more stable and efficient training. We also explore other alternatives and empirically validate our proposed design in Section 5 .\n\n3.2 Chain All Agents Together as a Loop In recursive language models (RLMs), Transformer layers are connected through hidden states, and the residual stream loops across these layers to increase reasoning depth.\nUnder this view, we cast each agent in RecursiveMAS as an RLM layer, with information flowing and recurring within and across agents as the hidden stream of the system. As shown in Figure 2 , each agent contributes by reasoning and interacting with others in the latent space, together forming a recursive loop. Latent Thoughts Generation inside Agents. We start by describing how each agent unfolds reasoning through the auto-regressive generation of latent thoughts.\nSpecifically, given input contexts\u2019 embeddings E A 1 = [ e 1 , e 2 , \u2026 , e t ] E_{A_{1}}=[e_{1},e_{2},\\dots,e_{t}] for the question and the agent-specific instructions, the first agent A 1 A_{1} passes E A 1 E_{A_{1}} through the Transformer and computes the last-layer hidden representation h t h_{t} at step t t .\nThen, we insert h t h_{t} into the inner link \u211b in \\mathcal{R}_{\\mathrm{in}} to map the distribution back into the input embedding space for the next step, yielding e t + 1 = \u211b in \u200b ( h t ) e_{t+1}=\\mathcal{R}_{\\mathrm{in}}(h_{t}) . Agent A 1 A_{1} repeats this process auto-regressively for m m forward steps, generating a new continuous sequence of latent thoughts H A 1 = [ h t , h t + 1 , \u2026 , h t + m ] H_{A_{1}}=[h_{t},h_{t+1},\\dots,h_{t+m}] . Interaction across Heterogeneous Agents. Once agent A 1 A_{1} completes latent reasoning, its latent thoughts H A 1 H_{A_{1}} are sent to the next agent A 2 A_{2} for cross-agent interaction. To achieve seamless information transmission across different types of agents, we first pass H A 1 H_{A_{1}} through the outer link \u211b out \\mathcal{R}_{\\text{out}} to transform it into input embeddings aligned with agent A 2 A_{2} . Next, agent A 2 A_{2} starts latent thoughts generation conditioned on both its own input contexts and transferred information from A 1 A_{1} (i.e., E A 2 \u2295 \u211b out \u200b ( H A 1 ) E_{A_{2}}\\oplus\\mathcal{R}_{\\text{out}}(H_{A_{1}}) ). We continue this interaction process across all consecutive agents in RecursiveMAS . In particular, after the last agent A N A_{N} completes latent thoughts generation, its latent outputs (representing the system\u2019s latent answer to the input question) are passed back to the first agent A 1 A_{1} through the inner-outer RecursiveLink, thereby closing the recursive loop. This recurrent connection allows each new recursion round to condition on information produced in previous rounds, so that each agent can iteratively reflect on earlier system outputs and refine their current generation.\nThroughout intermediate recursion rounds, all agents collaborate entirely in the latent space. Only after the final recursion round, the agent A N A_{N} decodes the textual output as the system\u2019s final answer to the question. End-to-End Complexity Analyses. To characterize the architectural efficiency of the full RecursiveMAS pipeline, we next analyze its end-to-end runtime complexity with RecursiveLink integrated throughout the system. The following proposition compares RecursiveMAS with a text-based recursive MAS, in which agents follow the same multi-round recursive collaboration structure but communicate through an explicit text medium rather than RecursiveLink-enabled latent interaction. Proposition 3.1 ( RecursiveMAS Runtime Complexity ) . Without RecursiveLink, a text-based Recursive MAS with the same collaboration structure requires runtime complexity of \u0398 \u200b ( N \u200b ( m \u200b | V | \u200b d h + ( t + m ) \u200b d h 2 + ( t + m ) 2 \u200b d h ) ) \\Theta(N(m|V|d_{h}+(t+m)d_{h}^{2}+(t+m)^{2}d_{h})) ; In contrast, with RecursiveLink-enabled collaboration, RecursiveMAS achieves an end-to-end runtime complexity of \u0398 \u200b ( N \u200b ( m \u200b d h 2 + ( t + m ) \u200b d h 2 + ( t + m ) 2 \u200b d h ) ) \\Theta(N(md_{h}^{2}+(t+m)d_{h}^{2}+(t+m)^{2}d_{h})) . Remark 3.2 . Since d h \u226a | V | d_{h}\\ll|V| in practice, RecursiveMAS replaces the expensive per-step vocabulary-space decoding cost m \u200b | V | \u200b d h m|V|d_{h} with a much more efficient latent-space transformation m \u200b d h 2 md_{h}^{2} . Proposition 3.1 shows the end-to-end runtime advantage of RecursiveMAS . The full proof is provided in Appendix A.1 . We also empirically analyze the efficiency advantage of our method in Section 5 ."}]}, "uuid": "0b5c3e93-6aba-fbba-7177-2bf9e964f629", "parentUuid": "78dc146e-1834-d856-e177-b3153a28339d", "sessionId": "40a26b08-f6bd-4a79-b1af-9f3f58f90589", "timestamp": "2026-05-10T19:36:30.015486"}
22
  {"type": "assistant", "message": {"role": "assistant", "model": "llamacpp/default", "content": [{"type": "text", "text": "Good catch \u2014 the paper does have **one inner RecursiveLink per agent**, so in a system with 4 agents, you get 4 inner adapters. Let me walk through exactly what they do and why you need multiple.\n\n## The Setup: One Inner Link Per Agent\n\nImagine a sequential 4-agent system for a math problem:\n\n| Agent | Role | Backbone Model | Hidden Dim | Inner Link |\n|---|---|---|---|---|\n| A\u2081 | Planner | Qwen-2.5-7B | 4096 | `R_in\u2081` |\n| A\u2082 | Mathematician | Llama-3-8B | 4096 | `R_in\u2082` |\n| A\u2083 | Code Interpreter | Mistral-7B | 4096 | `R_in\u2083` |\n| A\u2084 | Verifier | Gemma-2-9B | 4096 | `R_in\u2084` |\n\nEach agent has its **own** inner RecursiveLink. They're not shared.\n\n## Concrete Example: A Math Question\n\n**Question:** *\"Find all n > 1 such that 2\u00b2\u2074 is a perfect nth power.\"*\n\n### Step 1 \u2014 A\u2081 generates latent thoughts (planning)\n\n```\nA\u2081 receives: [question tokens] + [instruction: \"You are a planner. Break this down.\"]\nA\u2081 runs forward pass \u2192 gets last-layer hidden states h_t\nh_t is passed through R_in\u2081 \u2192 becomes e_{t+1} (input for next step)\nA\u2081 repeats for m steps, generating: H_A\u2081 = [h_{t}, h_{t+1}, ..., h_{t+m}]\n```\n\nR_in\u2081 has learned: *\"I need to produce latent thoughts that look like valid embeddings in my own model's space.\"*\n\n### Step 2 \u2014 Transfer to A\u2082 (outer link)\n\n```\nH_A\u2081 \u2192 R_out(A\u2081\u2192B\u2082) \u2192 transformed embeddings in A\u2082's embedding space\nA\u2082 receives: [own question embeddings] \u2295 [transformed H_A\u2081]\n```\n\n### Step 3 \u2014 A\u2082 generates latent thoughts (mathematical reasoning)\n\n```\nA\u2082 runs forward pass \u2192 gets last-layer hidden states h'_t\nh'_t is passed through R_in\u2082 \u2192 becomes e'_{t+1} (A\u2082's own input for next step)\nA\u2082 repeats for m steps, generating: H_A\u2082\n```\n\n**Notice:** R_in\u2081 and R_in\u2082 do **different things** because:\n- A\u2081 is a planner \u2192 its inner thoughts are *structural* (\"break into cases,\" \"use prime factorization\")\n- A\u2082 is a mathematician \u2192 its inner thoughts are *computational* (\"2\u00b2\u2074 = (2\u1d4f)\u207f where k\u00b7n = 24\")\n\n### Step 4\u20135 \u2014 A\u2083 and A\u2084 follow the same pattern\n\nEach agent generates its own latent thoughts with its own inner link, then passes to the next agent via an outer link.\n\n### Step 6 \u2014 Loop back\n\n```\nA\u2084's output \u2192 back to A\u2081 (through outer + inner link) \u2192 A\u2081 reflects and refines\n```\n\n## Why Can't You Share One Inner Link Across All Agents?\n\nBecause each agent's backbone has a **different parameter distribution**, even if they share the same hidden dimension:\n\n1. **Different input embedding spaces**: Even if `d_h = 4096`, the embedding matrix `Emb_\u03b8` is model-specific. A\u2081's `Emb_Qwen` maps token IDs to a very different space than A\u2082's `Emb_Llama`.\n\n2. **Different last-layer output distributions**: After a forward pass through Qwen vs. Llama, the last-layer hidden states `h_t` land in different parts of the latent space, even for the same input. R_in\u2081 must learn to map Qwen's output distribution back into Qwen's input distribution, while R_in\u2082 must learn the analogous mapping for Llama.\n\n3. **Different reasoning styles**: A\u2081 (planner) thinks in \"structure.\" A\u2082 (mathematician) thinks in \"computation.\" The inner link is trained to produce thoughts that match the ground-truth embedding of the expected answer \u2014 and each agent's contribution to that answer is semantically different.\n\n## Training Analogy to LoRA\n\n| | LoRA | Inner RecursiveLink |\n|---|---|---|\n| **What it adapts** | One model \u2192 one adapter | One model \u2192 one adapter |\n| **How many adapters** | One adapter per task/model | One adapter per agent/model |\n| **Training** | `L = CE(y, model_with_LORA(x))` | `L = 1 - cos(R_in(H), Emb(y))` |\n| **Key difference** | Fine-tunes for a *task* | Fine-tunes for *latent autoregression* (replacing text decode/re-encode) |\n\nIn RecursiveMAS you get **N inner adapters** (one per agent) + **N outer adapters** (one per inter-agent connection). For a 4-agent system, that's 8 adapters total \u2014 tiny compared to fine-tuning the 4 backbone models.\n\nThe critical insight: each inner adapter lets its agent **\"think\" in latent space** (autoregressively generate continuous tokens to itself), and each outer adapter lets agents **\"speak\" to each other** despite having different model internals. Neither is reusable across agents because the underlying distributions differ."}]}, "uuid": "5f8bd889-b1d2-fc85-4015-f28e70ba9adc", "parentUuid": "0b5c3e93-6aba-fbba-7177-2bf9e964f629", "sessionId": "40a26b08-f6bd-4a79-b1af-9f3f58f90589", "timestamp": "2026-05-10T19:36:30.015486"}
23
  {"type": "user", "message": {"role": "user", "content": "so the inner loop is analogous to model's internal thinking"}, "uuid": "1d7c2fee-67a3-96dd-2182-792192f78bdb", "parentUuid": "5f8bd889-b1d2-fc85-4015-f28e70ba9adc", "sessionId": "40a26b08-f6bd-4a79-b1af-9f3f58f90589", "timestamp": "2026-05-10T19:36:30.015486"}
 
 
21
  {"type": "user", "message": {"role": "user", "content": [{"type": "tool_result", "tool_use_id": "BpQb5segui0MaPriXgVma7L2g0Ml0wW8", "content": "# 3 Building a Recursive Multi-Agent System\nhttps://arxiv.org/abs/2604.25917\n\nFigure 2: Overall Architecture of RecursiveMAS . Each agent first leverages the inner RecursiveLink to perform latent thoughts generation, and then transfers the generated information to the next agent through the outer RecursiveLink. After the last agent finishes generation, its latent thoughts are fed back to the first agent, thereby forming a recursive loop within the multi-agent system.\n\nWe introduce RecursiveMAS , an end-to-end recursive framework that links heterogeneous LLM agents together to scale the entire system through efficient and seamless latent collaboration. In the following, we will first elaborate the detailed architectural design of RecursiveMAS , and then present the corresponding recursive learning algorithm. We also interleave theoretical analyses throughout the method pipeline to support underlying design principles.\n\n3.1 A Lightweight RecursiveLink Figure 3: Illustration on the inner and outer RecursiveLink Design. A language model\u2019s last-layer hidden states provide a natural representation of its generated semantics.\nThe RecursiveLink \u211b \\mathcal{R} is designed to preserve and transmit this information from one embedding space to another.\nIn RecursiveMAS , the transition arises in two cases:\n(i) Dense-to-Shallow Transition , where the previous step\u2019s last-layer embeddings are fed back as the next-step input embeddings during latent thoughts generation;\nand (ii) Cross-Model Transition , where one model\u2019s newly generated latent representations are passed as conditioning inputs to another model.\nAs illustrated in Figure 3 , we bridge these two transitions through the inner and outer links. Inner Link. Each LLM agent A i \u2208 \ud835\udc9c A_{i}\\in\\mathcal{A} is paired with an inner RecursiveLink \u211b in \\mathcal{R}_{\\text{in}} during auto-regressive generation. Given any new last-layer embedding vector h h , \u211b in \\mathcal{R}_{\\text{in}} transforms it as: \u211b in \u200b ( h ) = h + W 2 \u200b \u03c3 \u200b ( W 1 \u200b h ) , \\mathcal{R}_{\\text{in}}(h)=h+W_{2}\\,\\sigma(W_{1}h), (3) where W 1 W_{1} and W 2 W_{2} are two standard linear layers, \u03c3 \u200b ( \u22c5 ) \\sigma(\\cdot) is the GELU activation, and the residual connection preserves the original latent semantics. The transformed embedding is then used as input to the next forward pass of agent A i A_{i} . Outer Link. An outer RecursiveLink \u211b out \\mathcal{R}_{\\mathrm{out}} connects heterogeneous agents with different hidden dimensions. To support this, an additional linear layer W 3 W_{3} is introduced in the residual branch to map the source embedding from agent A i A_{i} into the target embedding space of agent A j A_{j} , i.e., \u211b out \u200b ( h ) = W 3 \u200b h + W 2 \u200b \u03c3 \u200b ( W 1 \u200b h ) . \\mathcal{R}_{\\mathrm{out}}(h)=W_{3}h+W_{2}\\,\\sigma(W_{1}h). (4) Why Residual Connection? The residual branch largely preserves the original semantics of the input, allowing the RecursiveLink network to focus on aligning distributional differences rather than learning the full projection from scratch. This leads to more stable and efficient training. We also explore other alternatives and empirically validate our proposed design in Section 5 .\n\n3.2 Chain All Agents Together as a Loop In recursive language models (RLMs), Transformer layers are connected through hidden states, and the residual stream loops across these layers to increase reasoning depth.\nUnder this view, we cast each agent in RecursiveMAS as an RLM layer, with information flowing and recurring within and across agents as the hidden stream of the system. As shown in Figure 2 , each agent contributes by reasoning and interacting with others in the latent space, together forming a recursive loop. Latent Thoughts Generation inside Agents. We start by describing how each agent unfolds reasoning through the auto-regressive generation of latent thoughts.\nSpecifically, given input contexts\u2019 embeddings E A 1 = [ e 1 , e 2 , \u2026 , e t ] E_{A_{1}}=[e_{1},e_{2},\\dots,e_{t}] for the question and the agent-specific instructions, the first agent A 1 A_{1} passes E A 1 E_{A_{1}} through the Transformer and computes the last-layer hidden representation h t h_{t} at step t t .\nThen, we insert h t h_{t} into the inner link \u211b in \\mathcal{R}_{\\mathrm{in}} to map the distribution back into the input embedding space for the next step, yielding e t + 1 = \u211b in \u200b ( h t ) e_{t+1}=\\mathcal{R}_{\\mathrm{in}}(h_{t}) . Agent A 1 A_{1} repeats this process auto-regressively for m m forward steps, generating a new continuous sequence of latent thoughts H A 1 = [ h t , h t + 1 , \u2026 , h t + m ] H_{A_{1}}=[h_{t},h_{t+1},\\dots,h_{t+m}] . Interaction across Heterogeneous Agents. Once agent A 1 A_{1} completes latent reasoning, its latent thoughts H A 1 H_{A_{1}} are sent to the next agent A 2 A_{2} for cross-agent interaction. To achieve seamless information transmission across different types of agents, we first pass H A 1 H_{A_{1}} through the outer link \u211b out \\mathcal{R}_{\\text{out}} to transform it into input embeddings aligned with agent A 2 A_{2} . Next, agent A 2 A_{2} starts latent thoughts generation conditioned on both its own input contexts and transferred information from A 1 A_{1} (i.e., E A 2 \u2295 \u211b out \u200b ( H A 1 ) E_{A_{2}}\\oplus\\mathcal{R}_{\\text{out}}(H_{A_{1}}) ). We continue this interaction process across all consecutive agents in RecursiveMAS . In particular, after the last agent A N A_{N} completes latent thoughts generation, its latent outputs (representing the system\u2019s latent answer to the input question) are passed back to the first agent A 1 A_{1} through the inner-outer RecursiveLink, thereby closing the recursive loop. This recurrent connection allows each new recursion round to condition on information produced in previous rounds, so that each agent can iteratively reflect on earlier system outputs and refine their current generation.\nThroughout intermediate recursion rounds, all agents collaborate entirely in the latent space. Only after the final recursion round, the agent A N A_{N} decodes the textual output as the system\u2019s final answer to the question. End-to-End Complexity Analyses. To characterize the architectural efficiency of the full RecursiveMAS pipeline, we next analyze its end-to-end runtime complexity with RecursiveLink integrated throughout the system. The following proposition compares RecursiveMAS with a text-based recursive MAS, in which agents follow the same multi-round recursive collaboration structure but communicate through an explicit text medium rather than RecursiveLink-enabled latent interaction. Proposition 3.1 ( RecursiveMAS Runtime Complexity ) . Without RecursiveLink, a text-based Recursive MAS with the same collaboration structure requires runtime complexity of \u0398 \u200b ( N \u200b ( m \u200b | V | \u200b d h + ( t + m ) \u200b d h 2 + ( t + m ) 2 \u200b d h ) ) \\Theta(N(m|V|d_{h}+(t+m)d_{h}^{2}+(t+m)^{2}d_{h})) ; In contrast, with RecursiveLink-enabled collaboration, RecursiveMAS achieves an end-to-end runtime complexity of \u0398 \u200b ( N \u200b ( m \u200b d h 2 + ( t + m ) \u200b d h 2 + ( t + m ) 2 \u200b d h ) ) \\Theta(N(md_{h}^{2}+(t+m)d_{h}^{2}+(t+m)^{2}d_{h})) . Remark 3.2 . Since d h \u226a | V | d_{h}\\ll|V| in practice, RecursiveMAS replaces the expensive per-step vocabulary-space decoding cost m \u200b | V | \u200b d h m|V|d_{h} with a much more efficient latent-space transformation m \u200b d h 2 md_{h}^{2} . Proposition 3.1 shows the end-to-end runtime advantage of RecursiveMAS . The full proof is provided in Appendix A.1 . We also empirically analyze the efficiency advantage of our method in Section 5 ."}]}, "uuid": "0b5c3e93-6aba-fbba-7177-2bf9e964f629", "parentUuid": "78dc146e-1834-d856-e177-b3153a28339d", "sessionId": "40a26b08-f6bd-4a79-b1af-9f3f58f90589", "timestamp": "2026-05-10T19:36:30.015486"}
22
  {"type": "assistant", "message": {"role": "assistant", "model": "llamacpp/default", "content": [{"type": "text", "text": "Good catch \u2014 the paper does have **one inner RecursiveLink per agent**, so in a system with 4 agents, you get 4 inner adapters. Let me walk through exactly what they do and why you need multiple.\n\n## The Setup: One Inner Link Per Agent\n\nImagine a sequential 4-agent system for a math problem:\n\n| Agent | Role | Backbone Model | Hidden Dim | Inner Link |\n|---|---|---|---|---|\n| A\u2081 | Planner | Qwen-2.5-7B | 4096 | `R_in\u2081` |\n| A\u2082 | Mathematician | Llama-3-8B | 4096 | `R_in\u2082` |\n| A\u2083 | Code Interpreter | Mistral-7B | 4096 | `R_in\u2083` |\n| A\u2084 | Verifier | Gemma-2-9B | 4096 | `R_in\u2084` |\n\nEach agent has its **own** inner RecursiveLink. They're not shared.\n\n## Concrete Example: A Math Question\n\n**Question:** *\"Find all n > 1 such that 2\u00b2\u2074 is a perfect nth power.\"*\n\n### Step 1 \u2014 A\u2081 generates latent thoughts (planning)\n\n```\nA\u2081 receives: [question tokens] + [instruction: \"You are a planner. Break this down.\"]\nA\u2081 runs forward pass \u2192 gets last-layer hidden states h_t\nh_t is passed through R_in\u2081 \u2192 becomes e_{t+1} (input for next step)\nA\u2081 repeats for m steps, generating: H_A\u2081 = [h_{t}, h_{t+1}, ..., h_{t+m}]\n```\n\nR_in\u2081 has learned: *\"I need to produce latent thoughts that look like valid embeddings in my own model's space.\"*\n\n### Step 2 \u2014 Transfer to A\u2082 (outer link)\n\n```\nH_A\u2081 \u2192 R_out(A\u2081\u2192B\u2082) \u2192 transformed embeddings in A\u2082's embedding space\nA\u2082 receives: [own question embeddings] \u2295 [transformed H_A\u2081]\n```\n\n### Step 3 \u2014 A\u2082 generates latent thoughts (mathematical reasoning)\n\n```\nA\u2082 runs forward pass \u2192 gets last-layer hidden states h'_t\nh'_t is passed through R_in\u2082 \u2192 becomes e'_{t+1} (A\u2082's own input for next step)\nA\u2082 repeats for m steps, generating: H_A\u2082\n```\n\n**Notice:** R_in\u2081 and R_in\u2082 do **different things** because:\n- A\u2081 is a planner \u2192 its inner thoughts are *structural* (\"break into cases,\" \"use prime factorization\")\n- A\u2082 is a mathematician \u2192 its inner thoughts are *computational* (\"2\u00b2\u2074 = (2\u1d4f)\u207f where k\u00b7n = 24\")\n\n### Step 4\u20135 \u2014 A\u2083 and A\u2084 follow the same pattern\n\nEach agent generates its own latent thoughts with its own inner link, then passes to the next agent via an outer link.\n\n### Step 6 \u2014 Loop back\n\n```\nA\u2084's output \u2192 back to A\u2081 (through outer + inner link) \u2192 A\u2081 reflects and refines\n```\n\n## Why Can't You Share One Inner Link Across All Agents?\n\nBecause each agent's backbone has a **different parameter distribution**, even if they share the same hidden dimension:\n\n1. **Different input embedding spaces**: Even if `d_h = 4096`, the embedding matrix `Emb_\u03b8` is model-specific. A\u2081's `Emb_Qwen` maps token IDs to a very different space than A\u2082's `Emb_Llama`.\n\n2. **Different last-layer output distributions**: After a forward pass through Qwen vs. Llama, the last-layer hidden states `h_t` land in different parts of the latent space, even for the same input. R_in\u2081 must learn to map Qwen's output distribution back into Qwen's input distribution, while R_in\u2082 must learn the analogous mapping for Llama.\n\n3. **Different reasoning styles**: A\u2081 (planner) thinks in \"structure.\" A\u2082 (mathematician) thinks in \"computation.\" The inner link is trained to produce thoughts that match the ground-truth embedding of the expected answer \u2014 and each agent's contribution to that answer is semantically different.\n\n## Training Analogy to LoRA\n\n| | LoRA | Inner RecursiveLink |\n|---|---|---|\n| **What it adapts** | One model \u2192 one adapter | One model \u2192 one adapter |\n| **How many adapters** | One adapter per task/model | One adapter per agent/model |\n| **Training** | `L = CE(y, model_with_LORA(x))` | `L = 1 - cos(R_in(H), Emb(y))` |\n| **Key difference** | Fine-tunes for a *task* | Fine-tunes for *latent autoregression* (replacing text decode/re-encode) |\n\nIn RecursiveMAS you get **N inner adapters** (one per agent) + **N outer adapters** (one per inter-agent connection). For a 4-agent system, that's 8 adapters total \u2014 tiny compared to fine-tuning the 4 backbone models.\n\nThe critical insight: each inner adapter lets its agent **\"think\" in latent space** (autoregressively generate continuous tokens to itself), and each outer adapter lets agents **\"speak\" to each other** despite having different model internals. Neither is reusable across agents because the underlying distributions differ."}]}, "uuid": "5f8bd889-b1d2-fc85-4015-f28e70ba9adc", "parentUuid": "0b5c3e93-6aba-fbba-7177-2bf9e964f629", "sessionId": "40a26b08-f6bd-4a79-b1af-9f3f58f90589", "timestamp": "2026-05-10T19:36:30.015486"}
23
  {"type": "user", "message": {"role": "user", "content": "so the inner loop is analogous to model's internal thinking"}, "uuid": "1d7c2fee-67a3-96dd-2182-792192f78bdb", "parentUuid": "5f8bd889-b1d2-fc85-4015-f28e70ba9adc", "sessionId": "40a26b08-f6bd-4a79-b1af-9f3f58f90589", "timestamp": "2026-05-10T19:36:30.015486"}
24
+ {"type": "assistant", "message": {"role": "assistant", "model": "llamacpp/default", "content": [{"type": "text", "text": "Exactly. The inner link is the model's **private reasoning channel**.\n\nThink of it like a human:\n\n| | What happens |\n|---|---|\n| **Inner loop** | You think to yourself, refining your thoughts silently |\n| **Outer loop** | You speak your answer to someone else |\n\nThe inner link lets each agent run `m` autoregressive steps where it passes its own last-layer hidden state back through `R_in` and into its own next input \u2014 **without producing any text**. It's \"thinking to itself\" in continuous space.\n\nThen when it passes information to the next agent, that's the outer link \u2014 \"talking to a colleague.\"\n\nSo the full flow for a single agent is:\n\n```\nQuestion arrives\n \u2192 think internally (inner loop, m steps of latent thoughts via R_in)\n \u2192 share with next agent (outer loop, via R_out)\n \u2192 receive feedback from system loop\n \u2192 think again (inner loop, new round)\n \u2192 ... repeat\n \u2192 finally, decode text and output answer\n```\n\nThe outer loop is **system-level reflection** (round after round of the whole multi-agent loop). The inner loop is **individual-level reflection** (each agent's own private reasoning steps before it speaks)."}]}, "uuid": "32c0d397-d301-3e6d-426e-563f466df219", "parentUuid": "1d7c2fee-67a3-96dd-2182-792192f78bdb", "sessionId": "40a26b08-f6bd-4a79-b1af-9f3f58f90589", "timestamp": "2026-05-10T19:36:30.015486"}