-
Notifications
You must be signed in to change notification settings - Fork 379
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make log optional in ProbabilisticScorer
#1372
Comments
So there's a little more required to make the math work. The success probability ranges from So by removing the |
Yea, so lets do |
Yep, and multiplying |
this should not be true! If you use the failure probability you will compute on the other side we tage the log of a number between 0 and 1 and this grows quite fast. so the negative log costs will actually be much higher than the linearized version Note that the highest cost that the negative log probabilities can create is if the amount to be sent would be in all of my observations long paths usually only happen when one optimizes for fees. if you make sure that even for small amounts the probabilistic features is dominant (I recall that I suggested to not take the arithmetic mean where it is difficult(but I am not sure what you actually ended up doing)) then the probabilistic model should naturally produces short paths without a static per hop cost. All that being said and without having looked at the code again I assume the key issue is that you don't weigh the costs from the probabilistic model heavily enough in particular when it comes to small payments. |
I'm really not sure what you mean here, with log you have to pick - either you have a crazy high maximum, or you have a really low common case. That's the problem. In real world tests, even a maximum penalty of 40 sats (which far dominates fees even on much lower probabilities, if they start getting high failure rates, eg for larger payments) makes the log scorer perform incredibly poorly. |
While your initial statement about the negative log producing "very very low penalties for quite some range" in comparison to the linearized failure probability is just wrong you still might end up at some right conclusions from your observations. Let me explain: In my last comment I tried to lay out from a mathematical point using the (very much desired) convexity of the negative log probabillity why your statement about the log is wrong. I guess code and numbers are more convincing so here you go:
you can chose a different value of the capacity That being said. your observation that the log cost gets very expensive for large amounts is absolutely correct which is the convex nature of the log and it should be this way. The main issue here (as discussed in #1227 is how to properly combine both features. This is naturally hard as the distribution of fees is different then the distribution of channel capacities. Thus you end up in situation where on some channel one feature dominates and on other channels the other feature dominates. In our research we explained why choosing just a linearized uncertainty cost for all channels is a very poor idea as it tends to saturate channels fully in payment delivery planning. Of course this may not be true if you don't use optimal splitting but just some heuristic that defines a split a head of the search for candidate paths. (yes according to the selected cost function the solution of the mcf problem is the optimal one despite your wishing me to stop saying so) ----- side remarks on ---- Back to your point about the growth of the log (which again I'd say is a feature and not a bug!) and the point of our research that one does not want to use a fully linear feature for reliability on the entire domain and that the problem is much more the feature engineering of combining fees cost and uncertainty cost properly. There is actually middle ground that goes very much into the direction that you are asking for: In my recent release of the piece wise linearized min cost flow problem I do not use the negative log either because I linearize piece wise. Thus I use costs like In my still on going / preliminary experiments it currently seems that I am ending up finding a practical way of combining both features though I don't have high enough confidence yet that this is universally true. Thus real world experiments would certainly help to support the current observations and I will repeat myself a last time. It would be very good to test this properly on real data. I believe this is the plan and suggestion with CashApp anyway and I can only offer help on building the model and testing the model. |
See conversation further up in this issue - I'm perfectly capable of doing basic math, thanks, we are talking about normalizing by the max penalty (in this case multiplying the non-log by 2, given we currently have a 0.01% cap on the log penalty).
Yep, its also why there's no one true solution here, especially in different contexts, and why we're talking about (optionally) removing the log - as different distributions of failure probabilitity scoring/addition may be useful in some contexts.
No, allowing one feature to dominate the other in different parts of the distribution is an intended and totally good behavior for most users! Indeed, it makes it hard to tune things properly, but if failure is very high or fees are very high, you totally want them to dominate the other! This is why we linearize everything to "msats willing to be paid to avoid X".
Awesome! Looking forward to when we eventually, sadly probably no time soon, have the time to go implement some stuff based on the fancier router you propose. |
To make the whole discussion way more concrete, I threw out some common scoring examples at #1375 (comment). I'm happy to re-examine any parameters you want, you can throw more table rows in the generation code below. Note the 6.25 and 12.5 bumps here are for efficiency (1/power-of-two) of calculation, but there may be clever ways to do other numbers I didn't immediately see.
|
Conversation from slack for context is pasted below, but TL;DR I think we really need to add knobs to
ProbabilisticScorer
to make it more general. While I'm still relatively confident it'll work reasonably well with active probing, its behavior without is pretty bad. At least in large part due to the use of the log on the success probability to linearize it - it simply doesn't penalize nearly enough unless you set the penalty ratio much, much too high, which doesn't help either as then it'll dominate fees. We could consider a different way of combining the scores, but that also sucks as it fails to allow the "larger" score to dominate, which is exactly what you want if you're looking at a path with very high fees or very high failure rates. Ultimately, the only obvious solution is to (optionally) remove the log, which gives us something more akin to the scorer we have today, which has very good results in practice.While we're at it, we should add a base penalty per-hop option in
ProbabilisticScorer
.Tagging 106 as ultimately the ProbabilisticScorer is a pretty substantial regression in terms of routing performance on nodes with less data from 105.
The text was updated successfully, but these errors were encountered: