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

Hybrid-dual speed #119

Merged
merged 3 commits into from
Aug 12, 2024
Merged

Hybrid-dual speed #119

merged 3 commits into from
Aug 12, 2024

Conversation

bencrts
Copy link
Collaborator

@bencrts bencrts commented Aug 2, 2024

hybrid-dual is a bit slow after the move to make MATZOV techniques default, e.g.:

sage: %time LWE.dual_hybrid(schemes.CHHS_4096_67)
CPU times: user 10.3 s, sys: 124 ms, total: 10.4 s
Wall time: 10.8 s
rop: ≈2^198.3, red: ≈2^198.3, guess: ≈2^193.5, β: 585, p: 2, ζ: 0, t: 175, β': 589, N: ≈2^119.6, m: ≈2^12.0

sage: %time LWE.dual_hybrid(schemes.TFHE1024)
CPU times: user 11.8 s, sys: 170 ms, total: 12 s
Wall time: 12 s
rop: ≈2^122.0, red: ≈2^121.9, guess: ≈2^118.1, β: 318, p: 2, ζ: 10, t: 85, β': 331, N: ≈2^68.6, m: 1024

sage: %time LWE.dual_hybrid(schemes.SEAL22_32768)
CPU times: user 15.6 s, sys: 202 ms, total: 15.8 s
Wall time: 15.8 s
rop: ≈2^125.9, red: ≈2^125.9, guess: ≈2^105.5, β: 313, p: 3, ζ: 0, t: 55, β': 345, N: ≈2^59.6, m: ≈2^15.0

Changing the max blocksize to 1754 (RC.ADPS16(1754,1754) ~ 512, I think we made this change somewhere else as well), and increasing the step-size from 5 to 10 in the searches increases things reasonably.

sage: %time LWE.dual_hybrid(schemes.CHHS_4096_67)
CPU times: user 4.52 s, sys: 46.3 ms, total: 4.57 s
Wall time: 4.67 s
rop: ≈2^198.6, red: ≈2^198.6, guess: ≈2^188.4, β: 586, p: 2, ζ: 0, t: 170, β': 590, N: ≈2^119.2, m: ≈2^12.0

sage: %time LWE.dual_hybrid(schemes.TFHE1024)
CPU times: user 3.38 s, sys: 31.5 ms, total: 3.41 s
Wall time: 3.41 s
rop: ≈2^122.2, red: ≈2^122.1, guess: ≈2^117.9, β: 319, p: 2, ζ: 0, t: 100, β': 332, N: ≈2^68.5, m: 1024

sage: %time LWE.dual_hybrid(schemes.SEAL22_32768)
CPU times: user 4.47 s, sys: 73.9 ms, total: 4.55 s
Wall time: 4.7 s
rop: ≈2^125.9, red: ≈2^125.9, guess: ≈2^97.4, β: 313, p: 3, ζ: 0, t: 50, β': 345, N: ≈2^61.1, m: ≈2^15.0

Maybe there's a better way to cut the search space without degrading the estimates, I'll leave this as a draft and see if I can think of anything.

@bencrts bencrts marked this pull request as draft August 2, 2024 15:02
@bencrts
Copy link
Collaborator Author

bencrts commented Aug 2, 2024

The tests don't seem too bad to me, will fix them now. Open for suggestions on how to do this better.

@bencrts bencrts marked this pull request as ready for review August 2, 2024 16:01
@bencrts bencrts requested a review from malb August 2, 2024 16:01
@malb
Copy link
Owner

malb commented Aug 5, 2024

yeah, I think this approach makes sense

@bencrts
Copy link
Collaborator Author

bencrts commented Aug 12, 2024

Ok! I'll sort out the tests.

@bencrts
Copy link
Collaborator Author

bencrts commented Aug 12, 2024

Have updated tests and they all pass now.

@bencrts
Copy link
Collaborator Author

bencrts commented Aug 12, 2024

@malb since you previously gave the OK I will just merge this PR myself now -- let me know if you prefer that I don't do this.

@bencrts bencrts merged commit e80ec6b into main Aug 12, 2024
4 checks passed
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.

2 participants