fbf591ac88490f6db78ff6b6ba5fbe4e1582e6ff
- Restructure code into separate modules: data, algorithms, logging, cache - Add efficient caching system for keys and encrypted distances - Implement three sorting algorithms: selection, bitonic, heap - Add comprehensive logging with timestamps and progress tracking - Configure musl target for static compilation - Support command-line algorithm selection and cache control 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
hfe_knn
全同态加密下的KNN算法实现
knn算法关键是使用一个距离函数来计算样本之间的距离,常用的距离函数有欧氏距离、曼哈顿距离等。 计算距离可以在全密文下实现。 主要是寻找一个全同态加密的比较大小方案
全同态加密计划使用TFHE-rs, 简化后流程无须交互,仅在单个程序内模拟即可。 评分详情见参赛手册
评分机制
正确率计算
- 算法需要返回10个最近邻向量的索引
- 正确率 = 正确的索引数量 / 10
- 例如:10个结果中有9个正确,正确率 = 90%
评分规则
- 门槛要求:正确率必须≥90%(即10个结果中至少9个正确)
- 排名依据:达到门槛后,按总耗时排名(越快越好)
- 淘汰机制:正确率<90%直接得0分
"正确"的定义
- 比赛方有标准答案(真实的10个最近邻)
- 算法结果与标准答案比较
- 顺序不重要,只要索引正确即可
数据格式
- 训练数据:JSONL格式,每行包含一个query向量和data数组
- 输出格式:
{"answer": [索引1, 索引2, ..., 索引10]} - 索引从1开始编号
Languages
Rust
75.2%
Python
18.2%
Shell
4.6%
Dockerfile
2%