Skip to content
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

mastic: Implement the heavy hitters sketch from ia.cr/2024/666 #1208

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

cjpatton
Copy link
Collaborator

This commit adds an initial implementation of the sketching technique from ia.cr/2024/666 for approximate heavy hitters. This main advantage is that the computation requires just one round of aggregation rather than many.

Comment on lines +350 to +357
// Make sure all heavy hitters are accounted for.
let num_heavy_hitters = count
.iter()
.filter(|(_weight, count)| **count >= mastic.szk.typ.threshold)
.count();
assert_eq!(heavy_hitters.len(), num_heavy_hitters);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test may flake, since bucket collisions can garble heavy hitters.

@cjpatton cjpatton force-pushed the cjpatton/mastic-approx-hh branch 5 times, most recently from 71cd831 to 0c7b791 Compare January 24, 2025 00:03
@cjpatton cjpatton marked this pull request as ready for review January 24, 2025 00:07
@cjpatton cjpatton requested a review from a team as a code owner January 24, 2025 00:07
Comment on lines +203 to +208
// Check that each input is either a `1` or a `-1`.
input
.iter()
.copied()
.map(|x| gadgets[0].call(&[x]))
.collect()
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A typical input length will probably be something like num_bits == 256. I wonder if we'd be better off (in terms of proof size and computation) with ParallelSum here.

That would mean we would need joint randomness and thus a larger field (Field128). I'm not sure if a larger field would pay off.

@cjpatton cjpatton force-pushed the cjpatton/mastic-approx-hh branch 2 times, most recently from da8f205 to c279d4f Compare January 24, 2025 02:24
This commit adds an initial implementation of the sketching technique
from ia.cr/2024/666 for approximate heavy hitters. This main advantage
is that the computation requires just one round of aggregation rather
than many.
@cjpatton cjpatton force-pushed the cjpatton/mastic-approx-hh branch from c279d4f to a38929d Compare January 24, 2025 02:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant