Skip to content

feat: implementar Difusión Térmica (Ecuación del calor) y RWR - #2

Open
LeandroPG19 wants to merge 1 commit into
mainfrom
desarrollo-18294522849265896125
Open

feat: implementar Difusión Térmica (Ecuación del calor) y RWR#2
LeandroPG19 wants to merge 1 commit into
mainfrom
desarrollo-18294522849265896125

Conversation

@LeandroPG19

Copy link
Copy Markdown
Owner
  • Se reemplazó el antiguo modelo de Spreading Activation con un modelo topográfico mediante matriz Laplaciana.
  • Se cambió el algoritmo de expansión (Query Expansion V9) de una búsqueda de grado 1 (BFS) a Random Walk with Restart (RWR) basado en PageRank personalizado, para un contexto más profundo y estocástico.
  • Para evitar Full DB Scans (regresión de rendimiento), se implementaron consultas SQL jerárquicas con CTE limitando la profundidad de vecinos extraídos desde PostgreSQL (Depth 3 para difusión, Depth 2 para búsqueda RWR).
  • Mejoras de rendimiento delegando las funciones CPU-bound a un Executor y refactorizando el cálculo Laplaciano con numpy y scipy.sparse.

PR created automatically by Jules for task 18294522849265896125 started by @LeandroPG19

- Se implementó la difusión de calor Laplaciana en `hebbian.py` para la
  propagación de la activación de importancia, mejorando el modelo estático.
- Se implementó el Paseo Aleatorio con Reinicio (Random Walk with Restart - RWR)
  en `handlers.py` como mejora para la expansión de consultas (V9).
- Optimizaciones de rendimiento con CTE recursivos para subgrafos en DB,
  usando `scipy.sparse` para matemáticas vectorizadas, y ejecución de CPU-bound
  en `loop.run_in_executor()` para no bloquear el bucle de eventos Asyncio.

Co-authored-by: LeandroPG19 <151863062+LeandroPG19@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

LeandroPG19 added a commit that referenced this pull request Jul 13, 2026
…yle)

Closes gap #2: cuba resolved conflicts by a cosine threshold. Now the LLM
judge classifies each candidate vs its most similar existing fact and that
verdict maps to an explicit operation (cognitive/memory_op.rs): supersedes/
contradicts -> Update (supersede old + keep new), complementary/unrelated ->
Add, low-confidence/unknown -> Noop. Delete is modeled for explicit callers
(never inferred from an extraction turn). auto_extract now returns the full
{add,update,delete,noop} breakdown alongside the back-compat `superseded`.

Verified end-to-end in isolated brain_dev via a mock sampling client, run as
the non-superuser cuba_app: supersedes->update:1 (old superseded, new added),
complementary->add:1, low-conf->noop:1; active count stays constant
(bitemporal). 6 unit tests for the judgment->operation mapping.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014AckURooVGZsexXPrji9xw
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant