> ## Documentation Index
> Fetch the complete documentation index at: https://docs.qwedai.com/llms.txt
> Use this file to discover all available pages before exploring further.

# What is neurosymbolic AI?

> Neurosymbolic AI combines neural networks with symbolic reasoning. Learn how QWED bridges both for verified results.

**Neurosymbolic AI** is the convergence of **Neural Networks** (deep learning, LLMs) and **Symbolic Reasoning** (logic, mathematics, formal methods).

## The two paradigms

### 1. Neural (subsymbolic)

* **Examples:** GPT-4, Claude, Llama
* **Strength:** Pattern recognition, language understanding, creativity
* **Weakness:** Cannot prove correctness, prone to hallucinations
* **Output:** Probabilistic (unverified correctness)

### 2. Symbolic

* **Examples:** Z3 (SAT Solver), SymPy (Computer Algebra), Prolog (Logic Programming)
* **Strength:** Deterministic reasoning, mathematical proof
* **Weakness:** Cannot understand natural language
* **Output:** Deterministic (proven correct)

## The neurosymbolic synthesis

**QWED bridges both worlds:**

```text theme={null}
Natural Language Query
         ↓
    LLM (Neural)
    "Translates to formal logic"
         ↓
   Symbolic Solver
   "Proves correctness"
         ↓
   Verified Result
```

**Example:**

**User Query:** "What is the derivative of x²?"

**Neural Step (GPT-4):**

```text theme={null}
LLM translates to SymPy code:
>>> from sympy import symbols, diff
>>> x = symbols('x')
>>> diff(x**2, x)
```

**Symbolic Step (SymPy):**

```python theme={null}
Result: 2*x  # Mathematically proven
```

**QWED verifies:** ✅ LLM said "2x", SymPy proves "2x" → **Verified!**

***

## Why neurosymbolic wins

### Problem: LLM-only systems

**Scenario:** Healthcare AI diagnoses patient

```text theme={null}
GPT-4: "Give aspirin (contraindicated with warfarin)"
      ↓
 NO VERIFICATION
      ↓
  ☠️ Patient harm
```

### Solution: QWED (neurosymbolic)

```text theme={null}
GPT-4: "Give aspirin"
      ↓
Medical Logic Engine: Checks drug interaction database
      ↓
Z3 Solver: Proves "aspirin + warfarin = contraindicated"
      ↓
🛑 BLOCKED + Alert doctor
```

***

## Research background

**Neurosymbolic AI** is backed by leading research:

* **Google DeepMind:** AlphaProof (math theorem proving)
* **MIT CSAIL:** Neurosymbolic programming
* **IBM Research:** Neuro-symbolic learning

**QWED** is the **first open-source implementation** focused on LLM verification.

***

## QWED's neurosymbolic architecture

### Neural components (untrusted translators)

* OpenAI GPT-4
* Anthropic Claude
* Google Gemini
* Ollama (Local LLMs)

### Symbolic components (trusted verifiers)

* **SymPy** → Math verification
* **Z3** → Logic verification
* **Python AST** → Code security verification

### The contract

| Component           | Role                                      | Trust Level  |
| ------------------- | ----------------------------------------- | ------------ |
| **LLM**             | Translate natural language → formal logic | ⚠️ Untrusted |
| **Symbolic Solver** | Execute logic, prove result               | ✅ Trusted    |

***

## Comparison: symbolic vs neural vs **neurosymbolic**

| Approach          | Understands Language? | Proves Correctness? | QWED Uses            |
| ----------------- | --------------------- | ------------------- | -------------------- |
| **Symbolic Only** | ❌ No                  | ✅ Yes               | Verification engines |
| **Neural Only**   | ✅ Yes                 | ❌ No                | Translation step     |
| **Neurosymbolic** | ✅ Yes                 | ✅ Yes               | ✅ **Both combined!** |

***

## Real-world impact

### Finance example

**Old Way (LLM-only):**

```text theme={null}
GPT: "Investment return = 12.5%"
→ Trust blindly
→ $12,889 error (from benchmark)
```

**QWED Way (Neurosymbolic):**

```text theme={null}
GPT: "Investment return = 12.5%"
→ SymPy calculates: 11.8%
→ 🛑 Mismatch detected!
→ ✅ Corrected before loss
```

### Code security example

**Old Way:**

````text theme={null}
GPT: "Here's the code"
```python
eval(user_input)  # Dangerous!
````

→ No check → 🔓 Security breach

```text theme={null}

**QWED Way:**
```

GPT: "Here's the code" → AST analyzer detects 'eval' → 🛑 UNSAFE CODE → ✅ Blocked before execution

```text theme={null}

---

## Why "neurosymbolic" matters for QWED

- The term has an established academic definition: neural plus symbolic.
- QWED meets that definition: LLMs (neural) plus SymPy and Z3 (symbolic).
- The architecture aligns with active research directions in AI verification.

---

## Further reading

- [Neurosymbolic AI - MIT](https://arxiv.org/abs/2305.00813)
- [DeepMind AlphaProof](https://deepmind.google/discover/blog/ai-solves-imo-problems-at-silver-medal-level/)
- [IBM Neurosymbolic AI](https://research.ibm.com/topics/neurosymbolic-ai)

---

**QWED: Where Neural Networks meet Mathematical Proof.** 🧠🔬
```
