Skip to main content

Module qualia_hybrid

Module qualia_hybrid 

Source
Expand description

Qualia-unique hybrid inference: graph + manifold + modes + deontic.

Most engines only optimise GEMV. QualiaDB can also:

  1. Graph-grounded speculative draft — encode fact-table repairs as draft tokens and verify with the same batch path as prompt-lookup (bit-exact when accepted; force-emit when QUALIA_GRAPH_FORCE=1).
  2. Graph route mask — hash prompt tokens into the U1 AttentionRouteMask so sparse attention can bias toward graph-linked KV provenance slots.
  3. 10D query publish — fold prompt word hashes into a Tensor10D query anchor for the continuous U1→U0 context-inject path.
  4. Graph logit bias — boost tokenizer ids for known answer strings mid-decode (neuro-symbolic sampling, not post-hoc string replace only).
  5. Deontic obligation — when a high-stakes fact matches the prompt, compile an OP_OBLIGATE norm Quin so the Rights/Webizen layer can audit the duty to ground (unique to Qualia’s logic stack).

These are first-class companions to portable/cuda/quant-graph modes — not a second engine.

Constants§

GRAPH_LOGIT_BIAS
Logit boost applied to graph answer-token ids (nats; soft guidance).

Functions§

apply_graph_logit_bias
Soft-boost logits for graph answer strings (first matching token id per string).
force_fact_tokens
If quant-graph + force, return full repair token sequence for immediate emit.
graph_force_enabled
Whether to force-emit graph repair without model verify (high-stakes capitals, etc.).
prepare_hybrid_decode
Prepare hybrid hints before a decode turn (safe no-ops when inactive). Call after any default publish_query_tensor so route/query are not wiped. FastVerify skips mid-decode hybrid work (post-turn verify owns quality).
propose_best_draft
Prefer fact draft when quant-graph; else prompt-lookup n-gram draft.
propose_fact_draft
Draft tokens from the quant-graph fact table (repair text encoded by caller).
publish_graph_route_from_prompt
Map prompt words → attention route bits (tensor/KV provenance indices). Novel: uses the same U1 mask path as 10D kNN routing, fed from language not GPU. When quant-graph matches a fact, also route bits from subject/object quin hashes so attention can prefer KV slots co-located with grounding provenance.
publish_grounding_obligation
Compile a deontic obligation Quin for a matched grounding fact (audit trail).
publish_prompt_query_tensor
Fold prompt into a 10D query for continuous graph–tensor inject.