ShVaSa Blog
Tech & AI • 5 min read

EviDARL: Evidence-Centric Dual-Agent Reasoning via Alternating Reinforcement Learning for Multi-Table Question Answering

Published on 2026-11-20 by Sharath Japa, ShVaSa Lab Lead
aitechdeep-learningmultimodal
Discuss on r/shvasa

Executive Summary

Multi-Table Question Answering (MTQA) represents a critical frontier in structured data reasoning, moving beyond the isolated context windows of single-table LLMs to handle complex, relational dependencies. The EviDARL framework introduces a dual-agent architecture driven by alternating reinforcement learning, specifically designed to mitigate the compounding errors inherent in multi-hop reasoning over disparate tables. Unlike traditional retrieval-augmented generation (RAG) pipelines that treat table retrieval and answer generation as sequential, independent steps, EviDARL employs a feedback loop where an Evidence Agent and a Reasoning Agent co-adapt. The Evidence Agent identifies and extracts relevant sub-tables, while the Reasoning Agent constructs logical chains. The core innovation lies in the alternating RL update mechanism, which optimizes the joint policy space to maximize the validity of the final answer while penalizing hallucinated evidence links. This approach addresses the sparse reward signal problem typical in complex QA tasks by providing intermediate supervision through evidence quality metrics. The system demonstrates that decoupling evidence selection from logical inference, yet coupling their training dynamics, significantly reduces error propagation in cross-table joins and aggregation operations.

Implementation Architecture

The EviDARL system is structured around two distinct policy networks: $\pi_E$ (Evidence Policy) and $\pi_R$ (Reasoning Policy). These agents operate in an alternating optimization loop. The Evidence Agent utilizes a lightweight encoder, such as a fine-tuned T5 or BERT variant, to score candidate table pairs based on semantic similarity to the query and structural compatibility (e.g., foreign key matching). The Reasoning Agent, typically a larger transformer-based model, takes the selected evidence and generates the reasoning chain.

The training process employs Proximal Policy Optimization (PPO) with a custom reward function $R$. This reward is not solely based on the final answer correctness $R_{acc}$ but includes a structural consistency term $R_{struct}$ that penalizes invalid joins or missing intermediate steps. The loss function for the Evidence Agent incorporates a contrastive loss to ensure that relevant evidence is pulled closer in embedding space than irrelevant candidates.

Memory bandwidth and scheduling are critical bottlenecks in this dual-agent setup. Since both agents require context windows proportional to the size of the extracted tables, the system must implement dynamic windowing. Large tables are truncated or summarized before being passed to the Reasoning Agent, introducing a quantization-like effect on the information density. The implementation below illustrates the core loop structure for the alternating RL update, focusing on the policy gradient estimation and the evidence filtering mechanism.

PYTHON
import torch
import torch.nn as nn
import torch.optim as optim

class EviDARLAgent:
    def __init__(self, evidence_model, reasoning_model, lr=1e-5):
        self.evidence_model = evidence_model
        self.reasoning_model = reasoning_model
        self.evidence_optimizer = optim.Adam(evidence_model.parameters(), lr=lr)
        self.reasoning_optimizer = optim.Adam(reasoning_model.parameters(), lr=lr)
        
    def get_evidence_scores(self, query, table_candidates):
        """
        Scores candidate tables for relevance to the query.
        Returns top-k table IDs.
        """
        # Simplified embedding similarity calculation
        q_embed = self.evidence_model.encode(query)
        t_embeds = self.evidence_model.encode_batch(table_candidates)
        scores = torch.mv(t_embeds, q_embed)
        top_k_indices = torch.topk(scores, k=3).indices
        return [table_candidates[i] for i in top_k_indices]

    def alternating_step(self, query, tables, ground_truth_answer):
        """
        Performs one alternating update step for Evidence and Reasoning agents.
        """
        # 1. Evidence Agent selects sub-tables
        selected_tables = self.get_evidence_scores(query, tables)
        
        # 2. Reasoning Agent generates chain
        # In practice, this involves generating tokens with attention mask on selected tables
        reasoning_chain = self.reasoning_model.generate(query, selected_tables)
        
        # 3. Compute Reward
        # R_acc: Exact match with ground truth
        # R_struct: Penalty for invalid joins (simplified here)
        r_acc = 1.0 if reasoning_chain == ground_truth_answer else 0.0
        r_struct = self.compute_structural_penalty(reasoning_chain, selected_tables)
        total_reward = r_acc + 0.5 * r_struct
        
        # 4. Update Reasoning Agent (PPO step)
        # Loss = -log_prob(action) * advantage
        # Advantage approximated by total_reward in this simplified view
        reasoning_loss = -torch.log(torch.tensor(0.99)) * total_reward # Placeholder for actual log-prob
        reasoning_loss.backward()
        self.reasoning_optimizer.step()
        self.reasoning_optimizer.zero_grad()
        
        # 5. Update Evidence Agent
        # Reward is propagated back to the evidence selection
        evidence_loss = -torch.log(torch.tensor(0.95)) * total_reward # Placeholder
        evidence_loss.backward()
        self.evidence_optimizer.step()
        self.evidence_optimizer.zero_grad()
        
        return total_reward

    def compute_structural_penalty(self, chain, tables):
        # Check if join keys exist in selected tables
        # Return 1.0 if valid, 0.0 if invalid
        return 1.0 if len(tables) > 0 else 0.0

ShVaSa Intuition

The fundamental challenge in multi-table QA is the "search space explosion." As the number of tables increases, the number of possible join paths grows factorially. Traditional greedy retrieval fails because the most semantically similar table to the query is not necessarily the one that enables the correct logical path. EviDARL’s intuition is that evidence selection and reasoning are not independent tasks but coupled constraints. By using alternating reinforcement learning, the system learns that a slightly less semantically relevant table might be crucial for a valid join, thereby increasing the overall probability of a correct answer. This co-adaptation allows the Evidence Agent to learn "reasoning-aware" retrieval, prioritizing tables that facilitate logical consistency over mere keyword matching. The system effectively treats the QA process as a Markov Decision Process where the state is the current query and selected evidence, and the action is the next table to retrieve or the next logical step to generate.

graph TD
    subgraph "EviDARL Dual-Agent Loop"
        Q[Query Input] --> EA[Evidence Agent]
        DB[(Table Database)] --> EA
        EA -->|Select Top-K Tables| RA[Reasoning Agent]
        RA -->|Generate Reasoning Chain| RA
        RA -->|Output Answer| Q
        RA -->|Reward Signal R| EA
        EA -->|Policy Update π_E| EA
        RA -->|Policy Update π_R| RA
    end
    
    subgraph "Reward Computation"
        RA -->|Final Answer| RC[Reasoning Correctness]
        EA -->|Selected Tables| SC[Structural Consistency]
        RC -->|R_acc| R[Total Reward]
        SC -->|R_struct| R
    end
    
    R -->|Backpropagation| EA
    R -->|Backpropagation| RA

The architecture highlights the bidirectional flow of information. The Evidence Agent does not operate in a vacuum; it receives gradient signals from the Reasoning Agent’s success or failure. This ensures that the retrieval mechanism is optimized for the downstream reasoning task. The mermaid diagram illustrates the closed-loop nature of the system, where the reward signal serves as the bridge between the two agents, aligning their objectives. This design is particularly effective in scenarios where the correct answer requires synthesizing information from multiple, non-obvious sources, as the alternating updates allow the system to explore and refine the joint policy space more effectively than sequential fine-tuning.

<!-- Consensus Verified by Student (qwen3.6-35b-a3b) & Judge (gemma-4-31b-it) | VERIFICATION REPORT -->


Grounding & Source Attribution

Author Avatar

Sharath Japa, ShVaSa Lab Lead

Systems & AI Infrastructure Researcher, DGX Station homelab lead. Engineering RL environments, edge silicon inference, and local reasoning model distillation. Verified Profiles: Google Scholar • Google Patents • LinkedIn • GitHub (@sharathjapa) • Medium • r/shvasa.


Canonical Source: https://shvasa.us/posts/evidarl-evidence-centric-dual-agent-reasoning-via-alternating-reinforcement-learning-for-multi-table-question-answering

Advertisement

Related Research & Architectural Blueprints