Adding extra modulus fails PNNSProcessDatabaseConfiguration
After generating a database similar to one created by
```bash
.build/release/PNNSGenerateDatabase --output-database database.txtpb --row-count 100 --vector-dimension 128 --metadata-size 100 --vector-type random
```
Running `PNNSProcessDatabase` with the following configuration
```bash
{
"batchSize" : 1,
"databasePacking" : {
"diagonal" : {
"babyStepGiantStep" : {
"babyStep" : 11,
"giantStep" : 12,
"vectorDimension" : 128
}
}
},
"distanceMetric" : {
"cosineSimilarity" : {
}
},
"extraPlaintextModuli" : [
65537
],
"inputDatabase" : "database.txtpb",
"outputDatabase" : "database.binpb",
"outputServerConfig" : "database-server-config.txtpb",
"queryPacking" : {
"denseRow" : {
}
},
"rlweParameters" : "n_4096_logq_27_28_28_logt_16",
"scalingFactor" : 36630,
"trialDistanceTolerance" : 0.01,
"trials" : 10
}
```
Leads to the issue
```bash
2026-01-18T01:24:38-0800 info PNNSProcessDatabase: [PNNSProcessDatabase] Processed database
2026-01-18T01:24:38-0800 info PNNSProcessDatabase: [PNNSProcessDatabase] Validating
2026-01-18T01:24:38-0800 error PNNSProcessDatabase: [PNNSProcessDatabase] Result error 1.0000085 exceeds tolerance 0.01
Error: Result error 1.0000085 exceeds tolerance 0.01
```
This only happens after I follow the [swift package index](https://swiftpackageindex.com/apple/swift-homomorphic-encryption/main/documentation/pnnsprocessdatabase) to increase precision by including the field `extraPlaintextModuli` as I was getting some tolerance issues earlier.
关闭于 2026-01-23 2 条评论