## 2 Design of LPU Reliability Assessment Algorithm for Flash-Memory Systems
### Cosine Similarity-Based LPL Reliability Assessment  
Cosine similarity [28] is a measure based on the vector space model that is used to evaluate the similarity between two vectors, which is given by  
\[ \begin{split} CS(\mathbf{x},\mathbf{y})&=\frac{ \mathbf{x}\cdot\mathbf{y}}{\|\mathbf{x}\|\|\mathbf{y}\|}\\ &=\frac{x_{1}\times y_{1}+x_{2}\times y_{2}+\cdots+x_{n}\times y_ {n}}{\sqrt{x_{1}^{2}+x_{2}^{2}+\cdots+x_{n}^{2}}\times\sqrt{y_{1}^{2}+y_{2}^{2 }+\cdots+y_{n}^{2}}},\end{split}  \tag{3}\]  
where \"\(\cdot\)\" represents the dot product of vectors and \"\(\|\cdot\|\)\" represents the length of the vector. Under certain conditions, that is, when all components of vectors \(\mathbf{x}\) and \(\mathbf{y}\) are non-negative, their dot product \(\mathbf{x}\cdot\mathbf{y}\) is also non-negative. This is because the dot product is essentially the accumulation of the products of corresponding components, thus ensuring the non-negativity of the result. Compared with Euclidean distance, it shows unique advantages when dealing with sparse vectors, especially when most elements are zero. This feature makes it particularly suitable for sparse data scenarios, such as the processing of LDPC codes, and it can pay more precise attention to the similarity between non-zero element positions. In addition, a significant advantage of cosine similarity compared to Euclidean distance is that its value range is fixed between \(-1\) and \(1\), independent of the dimension or length of the vector. This means that, no matter how long the vectors are, cosine similarity can provide a standardized similarity assessment, avoiding the changes in the metric due to increasing codeword length. In this section, we introduce an LPU reliability assessment method based on CS. Each LPU corresponds to a row in the LDPC matrix \(\mathbf{H}\), which is denoted as the CN processing unit constraint vector \(\mathbf{c_{\text{cmp}}}\). In \(\mathbf{c_{\text{cmp}}}\), 1 indicates that the corresponding VN participates in data interaction, while 0 indicates that there is no data interaction. Then, the proposed CS-based detection algorithm aims to effectively detect the reliability of LPU by calculating the cosine similarity between \(\mathbf{f_{\text{efv}}}\) (see Section 2.1) and \(\mathbf{c_{\text{cmp}}}\), as follows:  
\[CS(\mathbf{f_{\text{efv}}},\mathbf{c_{\text{cmp}}})=\frac{\mathbf{f_{\text{ efv}}}\cdot\mathbf{c_{\text{cmp}}}}{\|\mathbf{f_{\text{efv}}}\|\|\mathbf{c_{ \text{cmp}}}\|}. \tag{4}\] \begin{table}
\begin{tabular}{l c c c c c c c} \hline \hline  & \(\epsilon_{1}\) & \(\epsilon_{2}\) & \(\epsilon_{3}\) & \(\epsilon_{4}\) & \(\epsilon_{5}\) & \(\epsilon_{6}\) & \(\epsilon_{7}\) \\ \hline \(LLR_{\text{ch,j}}\) of LSB & \(-10\) & \(-10\) & \(-10\) & \(0.00001\) & \(10\) & \(10\) & \(10\) \\ \hline \(LLR_{\text{ch,j}}\) of MSB & \(-10\) & \(0.00001\) & \(10\) & \(10\) & \(10\) & \(0.00001\) & \(-10\) \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Mapping between the LLR of LSB and MSB from the flash-memory channel \(LLR_{\text{ch,j}}\) and the quantization voltage range of the corresponding cell. \begin{table}
\begin{tabular}{l c c c c c c} \hline \hline  & \(\epsilon_{1}\) & \(\epsilon_{2}\) & \(\epsilon_{3}\) & \(\epsilon_{4}\) & \(\epsilon_{5}\) & \(\epsilon_{6}\) & \(\epsilon_{7}\) \\ \hline entropy feature value of LSB & 0 & 0 & 0 & 1 & 0 & 0 & 0 \\ \hline entropy feature value of MSB & 0 & 1 & 0 & 0 & 0 & 1 & 0 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Mappings between the entropy feature value and the quantization voltage ranges of the corresponding cell. The defining characteristic of binary LDPC matrices is that their rows consist solely of 0s and 1s. This not only underscores the sparsity of the matrix but also its distinctive structural properties. Each row in an LDPC matrix can be perceived as a vector composed of non-negative elements.