33med

---
title: "Solving LLM Hallucination in Medical Research"
description: "How 33MED is eliminating generative AI hallucinations by grounding autonomous agent logic in deterministic, mathematically verifiable biophysics simulations."
date: 2023-10-25
author: "33MED Engineering"
category: "Panoptix Swarm & AI Orchestration"
---

Solving LLM Hallucination in Medical Research: Grounding Agent Logic in Deterministic Simulation

In the realm of computational immunology and structural biology, Large Language Model (LLM) hallucinations are not just an inconvenienceβ€”they are a catastrophic failure mode. A generative agent fabricating a non-existent protein binding affinity or hallucinating a biological pathway can derail millions of dollars in clinical research.

At 33MED, we are pioneering a radical shift in how AI is utilized in biotech. We do not rely on LLMs to generate scientific truth. Instead, we use them as high-level orchestration enginesβ€”reasoning agents that hypothesize, design experiments, and then relentlessly ground those hypotheses in mathematically verifiable simulation data.

AI hypothesizes. Thermodynamics validates.

Here is an under-the-hood look at our engineering architecture for ImmuNav, our Phase 1 autonomous biotech engine. We’ve stripped out the bloated academic infrastructureβ€”no heavy Python wrapper frameworks, no fragile RabbitMQ brokers, no convoluted database layers. What remains is a hyper-performant, massively scalable Node.js, MongoDB, and React ecosystem designed for real-world commercial viability and strict Human-In-The-Loop (HITL) oversight.


🧬 Core Tool Matrix: Commercial-Safe and Native

To build a secure, commercially viable SaaS platform without falling into licensing traps, the 33MED Node.js backend operates by bypassing restrictive APIs (like AlphaFold 3’s non-commercial wrapper). Instead, our autonomous swarm orchestrates a suite of fully open, commercial-safe alternatives using native child_process CLI execution.

Tool Focus Area Licensing / Commercial Access Node.js Integration Strategy
Chai-1 / Boltz-1 Multimodal Molecular & Structure Prediction Free (Apache 2.0 / MIT). Chai-1 shifted its weights to allow commercial utilization. Execute via standalone pre-compiled CLI binaries, passing dynamically generated JSON/SMILES inputs.
GROMACS Molecular Dynamics & Binding Thermodynamics Free (GNU LGPL). Spawn native gmx commands via Node child_process.spawn() to monitor real-time thread progress.
Bioconductor Genomic / Transcriptomic Pathway Mapping Free (Open Source). Execute standalone R scripts via Rscript CLI to parse RNA/expression data sets.
Chaste Tissue-Scale Cellular Calcification Modeling Free (BSD License). Fire the compiled C++ binary, passing an agent-generated XML payload mapping cellular parameters.
OpenSim CLI Musculoskeletal Joint & Muscle Load Free (Apache 2.0). Programmatically execute opensim-cmd to validate physical mechanical stresses.

πŸ—οΈ The Native Swarm Engine: Lean, Atomic Task Queuing

You do not need a dedicated message broker to build a highly concurrent AI swarm. We utilize MongoDB as a durable, atomic task queue using standard queries. This drastically reduces infrastructural complexity while providing state-level persistence for our agents.

1. MongoDB Schema Design

Our database architecture relies on two foundational collections. The first tracks agent constraints and parameters; the second acts as the lightweight execution queue.

// Collection: agents (The Swarm Constitution)
{
  _id: ObjectId("66654a..."),
  role: "BioinformaticsOperator",
  status: "active",
  globalObjective: "Identify molecular targets to halt syndesmophyte growth and spine fusion.",
  humanGuidanceOverride: "Focus explicitly on small-molecule inhibitors targeting IL-17 pathways.",
  lastPulse: ISODate("2026-06-08T22:00:00Z")
}

// Collection: tasks (The Lightweight Queue)
{
  _id: ObjectId("66654b..."),
  agentId: ObjectId("66654a..."),
  tool: "gromacs",
  status: "pending_review", // AI proposes, Human approves, Hardware executes
  payload: {
    inputFiles: ["target_sequence.fasta"],
    md_params: { nsteps: 50000, dt: 0.002, integrator: "md" } // Strictly validated by Zod
  },
  humanSignOff: {
    isApproved: false,
    actionedAt: null
  },
  logs: [], 
  outputMetadata: { pdbId: "1AKI", finalEnergy: -420000 }
}

2. The Node.js Background Processing Loop

Operating on a lean Node backend, our Simulation Worker runs a recursive, non-blocking polling loop. It checks for swarm-wide pause commands, enforces mandatory human approvals, and leverages native OS execution for heavy compute tasks.

async function processQueue() {
  // 1. Structural Check: Ensure the entire swarm isn't globally paused by a human administrator
  const globalStatus = await db.collection('settings').findOne({ key: 'swarm_status' });
  if (globalStatus?.isPaused) {
    setTimeout(processQueue, 5000);
    return;
  }

  // 2. Fetch the next executable task (Must be approved by HITL and queued)
  const task = await db.collection('tasks').findOneAndUpdate(
    { status: 'queued', 'humanSignOff.isApproved': true },
    { $set: { status: 'processing', startedAt: new Date() } },
    { sort: { createdAt: 1 }, returnDocument: 'after' }
  );

  if (!task) {
    setTimeout(processQueue, 2000); // Exponential backoff if queue is empty
    return;
  }

  try {
    // 3. Native binary execution mapping AI payload to deterministic CLI commands
    const binaryProcess = child_process.spawn(getToolBinary(task.tool), task.payload.cliArgs);
    
    binaryProcess.stderr.on('data', (data) => {
      // Stream runtime thermodynamics logs directly to the MongoDB task document
      db.collection('tasks').updateOne({ _id: task._id }, { $push: { logs: data.toString() } });
    });

    binaryProcess.on('close', async (code) => {
      if (code === 0) {
        await handleTaskSuccess(task); // Agent evaluates verified simulation data
      } else {
        await db.collection('tasks').updateOne({ _id: task._id }, { $set: { status: 'failed' } });
      }
      processQueue(); // Instantly jump to the next job
    });

  } catch (error) {
    await db.collection('tasks').updateOne({ _id: task._id }, { $set: { status: 'failed', error: error.message } });
    processQueue();
  }
}

πŸ“‘ The Data Ingestion Engine: Parsing the Literature

Before the agents can run simulations, they need to map the current state of biological literature. Our automated background tasks harvest raw papers from open science databases and utilize structured LLM outputs to parse them into deterministic data schemas.

Once raw XML text hits the Node backend, it is passed to the Google Gemini SDK. Rather than asking Gemini to "write a summary," we use strict system prompting to force a structurally deterministic JSON output:

const systemPrompt = `You are an expert computational immunologist. Analyze the provided scientific text. 
Extract any explicit molecular targets, binding affinities, genetic expressions, or pathways related to Ankylosing Spondylitis.
Return the output strictly in the following JSON format:
{
  "targetProtein": "string",
  "associatedCytokines": ["string"],
  "observedEffect": "string",
  "confidenceScore": 0.00
}`;

const result = await geminiModel.generateContent([systemPrompt, rawPaperText]);
const structuredData = JSON.parse(result.response.text());
await db.collection('knowledge_base').insertOne(structuredData);

Note: Any output that fails strict JSON schema validation is rejected, preventing LLM syntax hallucinations from corrupting the knowledge base.


πŸŽ›οΈ Absolute Executive Control: The HITL Dashboard

Autonomous systems require unbreakable human guardrails. To guarantee that researchers maintain absolute executive control over our AI agents, ImmuNav features a React-driven Swarm Management Dashboard.

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ IMMUNAV AUTOMATION HUB                                [ SYSTEM STATUS: RUNNING ] β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ [ πŸ›‘ GLOBAL SWARM PAUSE ]   [ πŸ”„ RESUME SYSTEM ]   [ ✍️ EDIT GLOBAL OBJECTIVE ] β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ ACTIVE AGENTS                                                                β”‚
β”‚ πŸ€– Agent_Ingestion_1  β”‚ Status: [ WORKING ]  β”‚ Task: Scraping arXiv q-bio    β”‚
β”‚ πŸ€– Agent_Operator_3   β”‚ Status: [ BLOCKED ]  β”‚ Task: Awaiting Config Approvalβ”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ 🚨 AGENT CONFIGURATION APPROVAL GATEWAY                                      β”‚
β”‚ Task ID: #98322  β”‚ Tool Target: GROMACS Molecular Dynamics                    β”‚
β”‚ Target Interaction: Small-molecule inhibitor binding to IL-17 Receptor        β”‚
β”‚                                                                              β”‚
β”‚ [ View Agent-Suggested md_params Payload ]                                   β”‚
β”‚  {                                                                           β”‚
β”‚    "integrator": "md",                                                       β”‚
β”‚    "nsteps": 50000,                                                          β”‚
β”‚    "dt": 0.002                                                               β”‚
β”‚  }                                                                           β”‚
β”‚                                                                              β”‚
β”‚  ✏️ [ Manually Edit JSON Parameters Inline ]                                  β”‚
β”‚  ──────────────────────────────────────────────────────────────────────────  β”‚
β”‚            [ ❌ REJECT CONFIGURATION ]      [ ⚠️ APPROVE & RUN JOB ]          β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
  1. The Global Interrupter: Toggling the Global Pause updates MongoDB to { isPaused: true }. Because our Node workers check this atomic state prior to executing any job, the swarm halts predictablyβ€”protecting live simulation runs from data corruption.
  2. The Guidance Injector: Researchers can inject high-level pivots on the fly. This text appends directly to the agent's database document, instantly adjusting the system instruction for the next cycle without requiring code redeployments.
  3. The Mandatory Approval Gate: When an agent attempts to spin up a compute-heavy GROMACS run, the task is stored as pending_review. Researchers can verify and manually tweak the Zod-validated parameters on the dashboard. Clicking Approve updates the state to queued, handing it securely to the local hardware loop.

πŸ§ͺ Micro-Dataset Testing Protocol: Building Safely

Developing autonomous physics simulations can easily burn through API quotas or crash local hardware if an agent loops out of control. 33MED utilizes a strict micro-testing protocol during software architecture development:

The Future of the Panoptix Swarm

By decoupling the reasoning capabilities of LLMs from the fact-generating process, we solve the hallucination problem at its core. Generative AI becomes the driver; verified biophysics becomes the terrain.

Through highly performant engineering and an unwavering commitment to deterministic computational biology, 33MED is not just predicting the future of autonomous medical infrastructureβ€”we are building it, one mathematically verifiable interaction at a time.