Comments (5)
Nice catch. The Backward
encoding is pretty old and already not used by other cheetah's code. And yes that is a bug.
The sign flip here is ok. You can consider in this way.
The Forward & Backward encodings are defined over the plaintext space which is modulo 2^k in SPU. Thus, the sign flip here should work over mod 2^k.
In more details, (-xvec[i] mod 2^k) mod q
= -(xvec[i] mod q)
when we view xvec[i]
in the centric range [-2^{k-1}, 2^{k-1})
in stead of the unsigned range [0, 2^k)
from spu.
@fionser , is this a bug?
Similar problems appear at template <typename Scalar> void ModulusDownRNS(absl::Span<const uint64_t> src, absl::Span<Scalar> out) const
:
// [0, gamma) -> [-gamma/2, gamma/2]
if (on_gamma > gamma_div_2) {
return ((on_t + gamma_.value() - on_gamma) * inv_gamma_mod_t_) &
mod_t_mask_;
} else {
return ((on_t - on_gamma) * inv_gamma_mod_t_) & mod_t_mask_;
}
from spu.
More questions:
(2) in packlwes.cc. The function void NegacyclicRightShiftInplace(RLWECt &ct, size_t shift, const seal::SEALContext &context)
is just multiplying a plaintext seal::Evaluator:: multiply_plain
, right?
(3) at line 356 in packlwes_test.cc, the index in xtmp[num_coeffs - 1 - i] = -xvec[i];
is not right. And the minus sign will cause wrong answer, since we want -xvec[i] mod q[mod_idx]
, while -xvec[i]
is computed module
from spu.
- Viewing
$x \in [0, 2^k)$ as$[-2^{k-1}, 2^{k-1})$ or in$(-2^{k-1}, 2^{k-1}]$ should be all right for `CenteralizeAt. - Yes, the document is mismatching the code in
CenteralizeAt
where the code is actually doing$(-2^{k-1}, 2^{k-1}]$ - For the
[0, gamma) -> [-gamma/2, gamma/2]
sincegamma
is an odd value. -
NegacyclicRightShiftInplace
might be efficient than usingmultiply_plain
. At least, you don't really need the plain polynomial except the non-zero index. -
-xvec[i] mod 2^k
is fine, since that is what we what. Themod q
part is defered to Line 365 or Line 367
from spu.
(3) xtmp[num_coeffs - 1 - i]
should be xtmp[num_coeffs - i]
. Note that -xvec[i]
mod -xvec[i] mod q
. Actually, a possible case is -xvec[i]
mod
from spu.
Related Issues (20)
- [Bug]: gRPC Socket Shutting Down After Many Runs HOT 7
- [Bug]: gcc 11.2下的编译问题 HOT 12
- [Question]: 能否不重复编译外部库,加速编译速度? HOT 4
- [Question]: stub_method方法实现将函数交由server执行,请问如何调试server中函数的具体执行过程? HOT 4
- [Question]: Common type of Ashare and Bshare HOT 1
- [Question]: Evaluating the model with significantly reduced number of ReLUs receives limited communication savings HOT 17
- [Question]: Allocator (GPU_0_bfc) ran out of memory trying to allocate 3.0KiB (rounded to 3072) HOT 9
- [Usability]: 运行LLaMa时报错'Config' object has no attribute 'define_bool_state' HOT 10
- 我想请问一下bumblebee的复现配置 HOT 4
- When i use spu infenrence on vit, on cifar10, the result changes every time HOT 4
- [Bug]: example/ml/flax_gpt2 文档依赖冲突 HOT 2
- 2PC下SPU返回的推理结果不正确 HOT 3
- [Bug]: Run example "simple_pphlo.cc" failed HOT 3
- 使用SPU实现Robust Scaler预处理算法 HOT 3
- 使用 SPU 实现 QuantileTransformer 预处理算法
- 使用 SPU 实现 OneHotEncoder HOT 1
- 使用SPU实现两个accuracy函数
- 使用 SPU 实现 AP(average_precision_score) 函数 HOT 2
- 使用 SPU 实现 brier_score_loss 函数 HOT 1
- 老师们好,请问这个https://www.secretflow.org.cn/zh-CN/docs/secretflow/v1.6.1b0/tutorial/gpt2_with_spu在使用spu过程中,不需要劫持gelu函数和softmax的替换吗 HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spu.