# An Explainable Deep Semantic Coding for Binary-Classification-Oriented Communication
## 3 Deep Variational Semantic Coding
### The DVSC Model and Training Algorithm
2:repeat
3:Step 1 Train Discriminator 1 (\(\phi_{1}\)) and Discriminator 2 (\(\phi_{2}\))
4: Randomly sample mini-batches (batchsize is \(M\)) \[\mathcal{B}_{X_{1}}\subset\mathcal{S}_{1},\ \mathcal{B}_{X_{2}}\subset \mathcal{S}_{2}\]
5: Obtain \[\mathcal{B}_{Y_{1}}=\big{\{}y_{1,j}\mid y_{1,j}=F_{\omega_{1}}(x_{1,j}),x_{1,j }\in\mathcal{B}_{X_{1}}\big{\}},\ \mathcal{B}_{Y_{2}}=\big{\{}y_{2,j}\mid y_{2,j}=F_{\omega_{2}}(x_{2,j}),x_{2, j}\in\mathcal{B}_{X_{2}}\big{\}}\]
6: Compute loss functions and update \(\phi_{1},\phi_{2}\) using the Adam optimizer via backpropagation: \[L_{\phi_{1}}=-\frac{1}{M}\sum_{i=1}^{M}\log\sigma(T_{\phi_{1}}(x_{1,i},y_{1,i }))-\frac{1}



10.  Compute loss functions and update \(\omega_{1},\omega_{2}\): \[L_{\omega_{1}}= \frac{1}{M}\sum_{i=1}^{M}\log\sigma(T_{\phi_{1}}(x_{1,i},F_{\omega_ {1}}(x_{1,i})))\] \[-\mu\Bigg{(}-\log\big{(}\frac{1}{M}\sum_{i=1}^{M}e^{(\alpha-1)T_{ \phi}(F_{\omega_{1}}(x_{1,i}))}\big{)}+\frac{\alpha-1}{\alpha}\log\big{(}\frac{ 1}{M}\sum_{i=1}^{M}e^{\alpha T_{\phi}(y_{2,i})}\big{)}\Bigg{)}\] \[+\lambda_{1}\Bigg{(}\frac{1}{M}\sum_{i=1}^{M}d(x_{1,i},F_{\omega_ {1}}(x_{1,i}))-D\Bigg{)}\] \[L_{\omega_{2}}= \frac{1}{M}\sum_{i=1}^{M}\log\sigma(T_{\phi_{2}}(x_{2,i},F_{ \omega_{2}}(x_{2,i})))\] \[-\mu\Bigg{(}-\log\big{(}\frac{1}{M}\sum_{i=1}^{M}e^{(\alpha-1)T_{ \phi}(y_{i,i})}+\frac{\alpha-1}{\alpha}\log\big{(}\frac{1}{M}\sum_{i=1}^{M}e^{ \alpha T_{\phi}(F_{\omega_{2}}(x_{2,i}))}\big{)}\Bigg{)}\] \[+\lambda_{2}\Bigg{(}\frac{1}{M}\sum_{i=1}^{M}d(x_{2,i},F_{\omega_ {2}}(x_{2,i}))-D\Bigg{)}\]
11. **Step 4 Train Lagrange multipliers (\(\lambda_{1},\lambda_{2}\))**
12. Compute loss functions and update \(\lambda_{1},\lambda_{2}\): \[\mathcal{S}_{1}=\big{\{}x_{1,i}\mid x_{1,i}\sim P_{1}(X)\big{\}},\ \mathcal{S}_{2}=\big{\{}x_{2,i}\mid x_{2,i}\sim P_{2}(X)\big{\}},i=1,2,\dots,N;\]0 \[\mathcal{S}_{1}=\big{\{}x_{1,i}\mid x_{1,i}\sim P_{1}(X)\big{\}},\ \mathcal{S}_{2}=\big{\{}x_{2,i}\mid x_{2,i}\sim P_{2}(X)\big{\}},i=1,2,\dots,N;\]1 \[\mathcal{S}_{1}=\big{\{}x_{1,i}\mid x_{1,i}\sim P_{1}(X)\big{\}},\ \mathcal{S}_{2}=\big{\{}x_{2,i}\mid x_{2,i}\sim P_{2}(X)\big{\}},i=1,2,\dots,N;\]2 \[\mathcal{S}_{1}=\big{\{}x_{1,i}\mid x_{1,i}\sim P_{1}(X)\big{\}},\ \mathcal{S}_{2}=\big{\{}x_{2,i}\mid x_{2,i}\sim P_{2}(X)\big{\}},i=1,2,\dots,N;\]3 \[\mathcal{S}_{1}=\big{\{}x_{1,i}\mid x_{1,i}\sim P_{1}(X)\big{\}},\ \mathcal{S}_{2}=\big{\{}x_{2,i}\mid x_{2,i}\sim P_{2}(X)\big{\}},i=1,2,\dots,N;\]4 \[\mathcal{S}_{1}=\big{\{}x_{1,i}\mid x_{1,i}\sim P_{1}(X)\big{\}},\ \mathcal{S}_{2}=\big{\{}x_{2,i}\mid x_{2,i}\sim P_{2}(X)\big{\}},i=1,2,\dots,N;\]5
13. **until** convergence
14. **Output:** Optimized parameters \(\omega_{1}^{*},\omega_{2}^{*},\phi_{1}^{*},\phi_{2}^{*},\psi^{*}\);  Lagrange multipliers \(\lambda_{1}^{*},\lambda_{2}^{*}\), Chernoff coefficient \(\alpha^{*}\). The DVSC-Opt algorithm provides a semantic coding framework for BCOC systems, aiming to jointly optimize data compression while preserving task-critical information. Although several state-of-the-art semantic coding models, such as DeepSC [8], VISTA [13], and multi-task JSCC [14] frameworks, have achieved notable progress in semantic communication, their problem formulations differ fundamentally from ours. These models typically consider noisy communication channels and focus on general semantic transmission across diverse tasks, whereas DVSC-Opt focuses solely on semantic source coding and is specifically tailored to the BCOC scenario. Moreover, most of current semantic coding models primarily emphasize semantic extraction, often overlooking effective data compression and lacking theoretical interpretability. In contrast, the DVSC model is designed to preserve task-critical information while simultaneously enhancing data efficiency under explicit distortion constraints. By integrating information-theoretic principles with deep learning techniques, the DVSC-Opt algorithm achieves a favorable balance among theoretical grounding, structural explain ability, and practical trainability.