Appendix Ⅲ: model compression verification
model compress 方案,将sij取值范围分成L等份,则共有l+1个插值点,分别记为x1,x2,⋯,xl+1。对于每个[xl,xl+1)区间,采用如下的五阶多项式替代 embedding network:
gml(x)=amlx5+bmlx4+cmlx3+dmlx2+emlx+fml
注意:此时多项式的自变量x值应为sij−xl。在每个网格点上,都需要满足如下三个边 界条件:
函数值一致
yl=Gm(xl)
函数一阶导数一致
yl′=Gm′(xl)
函数二阶导数一致
yl′′=Gm′′(xl)
由此可得六个系数值分别为
aml=2Δt51[12h−6(yl+1′+yl′)Δt+(yl+1′′−yl′′)Δt2]
bml=2Δt41[−30h+(14yl+1′+16yl′)Δt+(−2yl+1′′+3yl′′)Δt2]
cml=2Δt31[20h−(8yl+1′+12yl′)Δt+(yl+1′′−3yl′′)Δt2]
dml=21yl′′
eml=yl′
fml=yl
其中 h=yl+1−yl,Δt=xl+1−xl
需满足的条件是当sij=xl,xl+1时,函数值、一阶导数、二阶导数值均与 embedding network 的值相等,此时对应的x值分别为0,Δt。五阶多项式函数值为
gml(x)=2Δt5x5[12h−6(yl+1′+yl′)Δt+(yl+1′′−yl′′)Δt2]+2Δt4x4[−30h+(14yl+1′+16yl′)Δt+(−2yl+1′′+3yl′′)Δt2]+2Δt3x3[20h−(8yl+1′+12yl′)Δt+(yl+1′′−3yl′′)Δt2]+21yl′′x2+yl′x+yl
一阶导数为
gml(x)=2Δt5x45[12h−6(yl+1′+yl′)Δt+(yl+1′′−yl′′)Δt2]+2Δt4x34[−30h+(14yl+1′+16yl′)Δt+(−2yl+1′′+3yl′′)Δt2]+2Δt3x23[20h−(8yl+1′+12yl′)Δt+(yl+1′′−3yl′′)Δt2]+yl′′x+yl′
二阶导数为
gml(x)+yl′′=2Δt5x320[12h−6(yl+1′+yl′)Δt+(yl+1′′−yl′′)Δt2]+2Δt4x212[−30h+(14yl+1′+16yl′)Δt+(−2yl+1′′+3yl′′)Δt2]+2Δt3x6[20h−(8yl+1′+12yl′)Δt+(yl+1′′−3yl′′)Δt2]
当 x=0 时,显然满足需求;下面验证当 x=Δt 时的结果,函数值为
gml(Δt)=21[12h−6(yl+1′+yl′)Δt+(yl+1′′−yl′′)Δt2]+21[−30h+(14yl+1′+16yl′)Δt+(−2yl+1′′+3yl′′)Δt2]+21[20h−(8yl+1′+12yl′)Δt+(yl+1′′−3yl′′)Δt2]+21yl′′Δt2+yl′Δt+yl=h−yl′Δt−21yl′′Δt2+21yl′′Δt2+yl′Δt+yl=yl+1
一阶导数值为
gml(Δt)=2Δt5[12h−6(yl+1′+yl′)Δt+(yl+1′′−yl′′)Δt2]+2Δt4[−30h+(14yl+1′+16yl′)Δt+(−2yl+1′′+3yl′′)Δt2]+2Δt3[20h−(8yl+1′+12yl′)Δt+(yl+1′′−3yl′′)Δt2]+yl′′Δt+yl′=yl+1′−yl′−yl′′Δt+yl′′Δt+yl′=yl+1′
二阶导数值为
gml(Δt)=2Δt220[12h−6(yl+1′+yl′)Δt+(yl+1′′−yl′′)Δt2]+2Δt212[−30h+(14yl+1′+16yl′)Δt+(−2yl+1′′+3yl′′)Δt2]+2Δt26[20h−(8yl+1′+12yl′)Δt+(yl+1′′−3yl′′)Δt2]+yl′′=yl+1′′−yl′′+yl′′=yl+1′′