F
Florian
florian.github.io · Personal blog · on HN since 2016
Florian writes about algorithms, probabilistic data structures and machine learning, including the XOR trick, count-min sketch and federated learning.
What HN saysHN commenters link his XOR trick post for details and applications, and discuss it alongside other sketch data structures and reservoir sampling.
15HN people shared it
4linked it in comments
15stories submitted
1.0Kstory points
8 months agolast shared
2016people per year2026
Most-shared posts
- 1That XOR Trick (2020)7 people · 394 points · first shared 2021 · 130 comments on HN
- 2Show HN: A HN desktop app for reading links and comments next to each other2 people · 55 points · first shared 2016 · 15 comments on HN
- 3Count-Min Sketch: A probabilistic data structure for stream summaries2 people · 2 points · first shared 2019 · discussion on HN
- 4That XOR Trick (2020)1 people · 428 points · first shared 2021 · 231 comments on HN
- 5Federated Learning1 people · 89 points · first shared 2018 · 12 comments on HN
- 6Count-Min Sketch (2019)1 people · 44 points · first shared 2022 · 11 comments on HN
- 7Federated Learning for Firefox1 people · 4 points · first shared 2018 · discussion on HN
- 8LLMs Understand Base641 people · 3 points · first shared 2024 · discussion on HN
- 9Computing diffs using the longest common subsequence1 people · 1 points · first shared 2021 · discussion on HN
- 10Base641 people · first shared 2026
- 11Reservoir sampling1 people · first shared 2024
What HN people wrote when they linked it
crote · 2026-03-05
No, the real problem is that people keep giving LLMs the ability to take nontrivial actions without explicit human verification - despite bulletproof input sanitization not having been invented yet!
Until we do so, every single form of input should be considered hostile. We've already seen LLMs run base64-encoded instructions[0], so even something as trivial as passing a list of commit shorthashes could be dangerous: someone could've encoded instructions in that, after all.
And all of that is before considering the possibility of a LLM going "rogue" and hallucinating needing to take actions it wasn't explicitly instructed to. I genuinely can't understand how people even for a second think it is a good idea to give a LLM access to production systems...
[0]: https://florian.github.io/base64/
krior · 2025-07-18
https://florian.github.io//xor-trick/ if you want detailed information and a list of possible applications.
krackers · 2024-05-17
Knuth's presentation of this [1] seems very very similar to the heap-version (top-k on a uniform deviate) of reservoir sampling as mentioned in [2]. The difference is in how duplicates are handled. I wouldn't be surprised if this algorithm was in fact already in use somewhere!
[1] https://cs.stanford.edu/~knuth/papers/cvm-note.pdf [2] https://florian.github.io/reservoir-sampling/
Edit: Another commenter [3] brought up the BJKST algorithm which seems to be similar procedure except using a suitably "uniform" hash function (pairwise independence) as the deviate instead of a random number.
[3] https://news.ycombinator.com/item?id=40389178
kelseyfrog · 2022-07-22
I am enamored by data structures in the sketch/summary/probabilistic family: t-digest[1], q-digest[2], count-min sketch[3], matrix-sketch[4], graph-sketch[5][6], Misra-Gries sketch[7], top-k/spacesaving sketch[8], &c.
What I like about them is that they give me a set of engineering tradeoffs that I typically don't have access to: accuracy-speed[9] or accuracy-space. There have been too many times that I've had to say, "I wish I could do this, but it would take too much time/space to compute." Most of these problems still work even if the accuracy is not 100%. And furthermore, many (if not all of these) can tune accuracy to by parameter adjustment anyways. They tend to have favorable combinatorial properties ie: they form monoids or semigroups under merge operations. In short, a property of data structures that gave me the ability to solve problems I couldn't before.
I hope they are as useful or intriguing to you as they are to me.
1. https://github.com/tdunning/t-digest
2. https://pdsa.readthedocs.io/en/latest/rank/qdigest.html
3. https://florian.github.io/count-min-sketch/
4. https://www.cs.yale.edu/homes/el327/papers/simpleMatrixSketching.pdf
5. https://www.juanlopes.net/poly18/poly18-juan-lopes.pdf
6. https://courses.engr.illinois.edu/cs498abd/fa2020/slides/20-lec.pdf
7. https://people.csail.mit.edu/rrw/6.045-2017/encalgs-mg.pdf
8. https://www.sciencedirect.com/science/article/abs/pii/S002002551000397…
9. It may better be described as error-speed and…