Skip to content

Make log optional in ProbabilisticScorer #1372

Closed
@TheBlueMatt

Description

@TheBlueMatt

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.

Matt Corallo
	I'm playing with the new ProbabilisticScorer...some initial observations:
	* It ends up assigning very low penalties - I even doubled the multiplier knob and still see most penalties below 500msat.
	* I didn't want to more-than-double the multiplier knob, given the worst case there starts to look absurd.
	* It seems to be much more willing to take more hops than the old scorer, in line with the lower penalties. This, naturally, seems to cause much higher retry counts.
	* I assume this would change with aggressive probing or high payment volume, but with me just playing around on my own node that isn't the case. (edited) 
	I think we should think about (a) having a more aggressive "default" failure prob and maybe (b) dropping the log() entirely to increase the penalty even if our failure prob shows a low number.
	another idea would be re-introducing a per-hop static cost, irrespective of the failure prob.
Jeffrey Czyz
	what sort of amounts were you sending?
Matt Corallo
	was trying to both "huge" amounts (250k to 2.5m sats) and also one small payment (39k sats)
	not a big N here, mind you, but the old scorer was really aggressive on the limiting hops stuff, and this one just isn't at all, by comparison.
	sadly most of the merchants I regularly pay only take bitpay so I dont have a lot of places I can deposit sats :( (edited) 
	that said, sometimes it works out - just paid satoshis.place 8 sats with a 4 msat fee via 7 hops on the second try (edited) 
	so there is a part of me that wonders if its "doing the right thing" just has a bad default when you dont have enough data.
Jeffrey Czyz
	hmmm... IIUC, it degrades to what c-lightning does when it doesn't have any data. Also note that the default depends on the amount you are sending. Though I suppose that it is the case for the old scorer as of 104 (i.e., because of  overuse_penalty_msat_per_1024th)
Matt Corallo
	sure, but the 104 scorer also had a per-hop static cost, now we may get ~0 costs for a bunch of channels if we have no info, no?
Jeffrey Czyz
	nope, you only get zero penalty if the amount sent is under the lower bound, which starts at zero. So initially there should always be a penalty
Matt Corallo
	sure, but it can be incredibly small, even if not exactly 0
	especially cause the log makes it non-linear, so you can get a very, very, very low penalty for quite some range
Jeffrey Czyz
	Just playing with some numbers to recall how this works. With 1,000 msat multiplier, a payment of 250k sats through a 0.01 BTC channel (25% of the capacity) would give a 125 msat penalty with no information. 50% gives 301 msats, 75% gives 602 msats, 95% gives 1301 msats, and 99% gives 2000 msats, which is also where we artificially limit. So you really need to be using a significant portion of the capacity initially to get a 500 msat penatly. Less if you doubled the multiplier. So for small portions of the channel capacity, it seems the fees will dominate. Just wondering if it would be that bad to increase the multiplier significantly. (edited) 
	-log10((1,000,000,000 + 1 - 990,000,000) / (1,000,000,000 + 1)) * 1,000
Matt Corallo
	the default multiplier is 10k, not 1k msat
Jeffrey Czyz
	ah! right
Matt Corallo
	and I think you mean 250k sat not 250k msat, above.
	also 250k sat is actually kinda high (~$100), common payments are more like 5-20$, afaiu
	so a better analysis would be 25k sats or so
	which is ~100msat in penalty, which will get dwarfed by 1sat base fees (edited) 
Jeffrey Czyz
	yeah, you're right my numbers were off there :sweat_smile:
	or at least my units :slightly_smiling_face:
	anyhow, about 10% of the capacity gives about a 500 msat penalty if I got that right
	with the 10,000 msat multiplier
Matt Corallo
	right, my point is 1m sats is a common channel size, but a common payment amount would be something like 10k sats, which, iiuc, would be a penalty around 50msat
	cause its around 1% of the channel's capacity
	maybe 25k is also common, but that's still ~100msat in penalty
Jeffrey Czyz
	yup, I'm just wondering if increasing the multiplier would suffice, though. If you try to send an amount that is large percentage of the capacity, I would expect a large penalty would be called for
Matt Corallo
	channels are not irregularly unbalanced, I'm pretty dubious the probability is really linear here.
	like sending 95% I'd expect to succeed substantially more than 5% of the time
	so a penalty of like 100 sats seems more than excessive
	which is only a 5x on top of our current penalty multiplier, which seems like it'd be reasonable for the 1-2.5% cases above
	maybe we should add a ton of knobs here and ask cash app to play with them? like option to turn on and off log, mostly.
Jeffrey Czyz
	yeah, that's fair and simple enough change given it wouldn't affect the serialization
Matt Corallo
	right, the really nice thing about the prob. scorer is we can change the scoring pretty substantially without changing what we're storing.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions