Repository navigation
Bidirectional Context Branching with Selective Inheritance #8332
f0the999th
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Labels: enhancement, architecture, context-management, compute-efficiency, research-tooling
Status: Open for discussion
Summary
Proposal to replace linear, monolithic conversation histories with a Directed Acyclic Graph (DAG) primitive supporting bidirectional selective context inheritance. This architecture allows users to branch upward (selectively inheriting subsets of prior context), branch downward (partitioning future context into scoped sub-threads), and merge/partition vector namespaces without destructive edits or token wastage.
Current conversation models rely on a linear, monolithic paradigm where every turn re-transmits the full history. When exploring alternative directions, users face three suboptimal paths:
Token Processing Inefficiency
For a conversation of length N, a linear model processes:
For a 50-turn conversation, this yields ~1,275 message-equivalents processed when only ~50 were authored. This architecture forces the platform to absorb unnecessary inference costs while delivering a restricted user experience.
2. Architectural Solution: Bidirectional Selective Branching
Replace the linear message list with a Directed Acyclic Graph (DAG) of message nodes. Each new turn evaluates as a parameterized query over the graph rather than a monolithic replay.
Core Affordances
Mathematical Impact
Comparative Metrics (Estimated per 50-Turn Thread with 3 Branches)
| Metric | Linear Model (Current) | Bidirectional DAG (Proposed) |
|---|---|---|
| Tokens Processed / Thread | ~375,000 | ~140,000 |
| Prefix Cache Utilization | ~60% | ~90% |
| Effective Compute / Branch | Full replay | Delta + selected ancestors |
| Estimated Savings | — | ~55% – 65% reduction |
4.1 Default Mode: "Auto Context" (Average User)
4.2 Power User Mode: "Context Composer" (Researchers, Developers, Analysts)
POST /conversations/{id}/branch
{
"parent_node_id": "msg_20",
"direction": "up",
"context_ref": ["msg_03", "msg_07", "msg_20"],
"label": "alt-hypothesis-A"
}
POST /conversations/{id}/turn
{
"branch_id": "br_abc123",
"content": "...",
"context_ref": ["msg_03", "msg_07", "msg_20"],
"vector_scope": "branch"
}
All reactions