Skip to content

[BUG] Low-similarity EMC memories injected into context cause hallucination #13

@OppaAI

Description

@OppaAI

Description

mcc.py filters EMC results with EMC_MIN_SIMILARITY = 0.25 which is too low. A similarity score of 0.25–0.30 means the retrieved memory is barely related to the current topic. Injecting irrelevant memories forces Cosmos to reconcile unrelated context, causing confused or hallucinatory responses.

Steps to Reproduce

  1. Have several unrelated conversations stored in EMC
  2. Ask GRACE about a topic
  3. Log the EMC episodes injected — observe low similarity scores (0.25–0.35)
  4. GRACE references unrelated past conversations inappropriately

Expected Behavior

Only genuinely relevant past episodes are injected into context.

Actual Behavior

Weakly related or unrelated episodes are injected, causing GRACE to bring up irrelevant past topics or confuse current context with old memories.

Error Logs

N/A — behaviour bug, no crash
[DEBUG] MCC injected 3 EMC episode(s) into context
# Episodes may have similarity 0.26, 0.27, 0.29 — barely relevant

Environment

  • Hardware: Jetson Orin Nano Super 8GB
  • OS: Ubuntu 22.04 / JetPack 6.2.2
  • ROS2: Humble
  • Python: 3.10
  • Package: scs
  • Node: mcc

Affected Files

mcc.py line 40 — EMC_MIN_SIMILARITY = 0.25

Possible Fix

Raise the threshold:

EMC_MIN_SIMILARITY = 0.45  # only inject clearly relevant memories

Or add a secondary check — only inject if at least one episode scores above a higher threshold:

if any(ep["similarity"] >= 0.5 for ep in emc_results):
    # inject memories

Additional Context

embeddinggemma-300m cosine similarity ranges: 0.0–0.3 = unrelated, 0.3–0.5 = loosely related, 0.5+ = clearly related. The current threshold of 0.25 is below "loosely related". Recommended minimum: 0.45.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

Status

Todo

Relationships

None yet

Development

No branches or pull requests

Issue actions