Replies: 5 comments 10 replies
|
My personal research on this has shown significant value in operating off the turn-level embeddings while still routing the entire context. Most failures I've seen with the implementation of other open-source solutions, like vLLM Semantic Router, occur when semantic routing is applied to the entire context. Embedding models compress a text span into a fixed-dimensional vector by effectively averaging/pooling semantic signal across all tokens. As context length grows, the embedding becomes a diluted composite of many topics rather than a sharp representation of current intent, leading to semantic dilution, and it degrades discriminative power for similarity-based routing Adding to this, there are significant challenges of shared context. If model A is local and handles PPI, and model B is external and can't handle PPI due to compliance, there's a high risk that the router will share sensitive data across an egress security boundary. I'm more than willing to assist with this! Let me know how I can help. |
|
Thinking about this further, maybe help for multi-turn continuity exists in the form of some proposals in the works now
|
|
I think it is clear that the proxy architecture must adopt some kind of stateful, multi-layered session control plane to avoid typical issues such as misclassification due to context collapse but also beyond reasoning failures, the potential model bouncing which introduces financial penalties and tool execution loops. An example of implementation in vLLM-SR is Conversational Routing Momentum (check vllm-project/semantic-router#1458) which use asymmetric attack/release dynamics to track complexity trends over time, paired with a cache-aware switch gate that locks session affinity unless generation savings on a smaller model explicitly exceed the uncached re-hydration cost. I'd suggest we can start with an inventory of approaches / techniques including research literature if it can help but ultimately going with some real-world use cases and being able to test / evolve such decision algorithm at control plane level will be critical to test / validate which approach are relevant. Two things I'd like to highlight in the design approach:
|
|
tl;dr I think we can make real progress on mixture of models by treating classification as a black box and just building the machinery to safely do rewrites. Existing epic is praxis-proxy/ai#74 -- I can post a comment there. Thoughts follow. The classification portion of this is one discussion and nuances around things like context pollution are important for specific implementations, but, for Praxis specifically, I think the most important thing we can do is reason about what the overall flow of model selection looks like. Here's what I mean. We can treat model selection as a black box and solve the general problems in the space. This will let operators experiment with whatever classification schemes fit their needs best. As an infra provider, I think that's our appropriate scope, right? The generic problem in the space comes down to enforcing security boundaries and compliance policies while also allowing model rewriting. I think the philosophical stance of Praxis is separation of concerns via filter composition whenever possible. Here I think it looks like:
Where each one can be its own filter. The classifier can promote some headers with the common signals we'd expect: complexity, category, etc... The selection filter can be Then finally, we can promote our eventual model to a header like @franciscojavierarceo @bentito @cnuland I was thinking of proposing something like this "generic model selection" filter set, where the classifier is a black box with a contract based on well known headers or our state object, and then a general purpose select/validate and model rewrite filter can work across any. How would that sit with you all's model of the world? |
Thanks for helping framing this in a better way for actual implementation in Praxis! Is "our state object" already a thing or how does that relate to "Cross-Request Persistence (Proposal #412: Storage Layer"? I want to clarify because I think it all falls apart fast if Praxis can't keep a multi-turn conversation coherent across several LLMs. It really in many ways has to do the work of a sub-agent in order to do that. I'm also not sure about rewrite. I was thinking more like classic routing with the agent's message intact. I think trying to rewrite for PII might end badly and for things like complexity score, it really is just a question of what level LLM you send the message to. |
Uh oh!
There was an error while loading. Please reload this page.
I created a PR, praxis-proxy/ai#446, just to see if this idea might work well within Praxis and to share the idea with @rikatz
I've mentioned this concept to @shaneutt in passing as well, seeing where this might best be solved. It might fit under the umbrella of topics in praxis-proxy/ai#74 or it might not be solvable with Praxis today, I'm not sure.
But backing up a bit, my interest is to create something like the model router found in the gemini-cli coding agent. That tool relied on a light LLM to judge complexity of the prompt for a given turn of a conversation with the agent and route it to the best matching LLM in its list.
Obviously solving this on the wire has nice benefits in that it could be used with any agent and, if done right, should just give better solutions cheaper and faster with no complications on the agent side. If a given prompt is judged complex it heads off to a bigger, slower, more complex model for a better response, if it's easy it heads to light, fast, cheap model.
Sounds straightforward, but one issue I've realized as I think about it more is that in a multi-turn conversation how do you maintain state? When this concept is implemented within an agent it's more obvious, the agent is maintaining state via its memory functions. If this is implemented in Praxis, it's an important problem to solve, answers from various LLM without the context being tied together will not work. I'm not sure how you solve it, but I think it can be solved such that the model routing mechanism can keep an agent's complete conversation rational despite multiple LLMs being in the loop.
I'm sure there are some links I could add above, please advise, b/c I know there are already efforts in Praxis on cost based routing as well as maintaining state.
All reactions