{"id":113859,"date":"2026-10-07T19:17:40","date_gmt":"2026-10-07T11:17:40","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/113859.html"},"modified":"2026-10-07T19:17:40","modified_gmt":"2026-10-07T11:17:40","slug":"faiss-%e7%b4%a2%e5%bc%95%e6%80%8e%e4%b9%88%e9%80%89%ef%bc%9a10-%e4%b8%87%e6%9d%a1-128-%e7%bb%b4%e5%90%91%e9%87%8f%e4%b8%8a-ivf%e3%80%81pq%e3%80%81hnsw-%e7%9a%84%e5%8f%ac%e5%9b%9e%e4%b8%8e%e5%bb%b6","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/113859.html","title":{"rendered":"Faiss \u7d22\u5f15\u600e\u4e48\u9009\uff1a10 \u4e07\u6761 128 \u7ef4\u5411\u91cf\u4e0a IVF\u3001PQ\u3001HNSW \u7684\u53ec\u56de\u4e0e\u5ef6\u8fdf\u5b9e\u6d4b"},"content":{"rendered":"<p>\u624b\u91cc\u6709 10 \u4e07\u6761 128 \u7ef4\u5411\u91cf\u3001\u673a\u5668\u53ea\u6709 2 \u6838\u7684\u65f6\u5019&#xff0c;Faiss \u91cc\u6700\u5148\u8be5\u8bd5\u7684\u4e0d\u662f HNSW&#xff0c;\u800c\u662f\u5012\u6392\u8868\u4e0d\u52a0\u538b\u7f29\u7684 IVF&#xff1a;nprobe&#061;16 \u5c31\u80fd\u628a\u53ec\u56de\u505a\u5230\u548c\u66b4\u529b\u68c0\u7d22\u4e00\u6837&#xff08;1.000&#xff09;&#xff0c;\u5355\u6761\u67e5\u8be2\u4ece 0.452 ms \u6389\u5230 0.195 ms\u3002HNSW \u66f4\u5feb&#xff0c;0.031 ms \u62ff\u5230 0.998 \u7684\u53ec\u56de&#xff0c;\u4ee3\u4ef7\u662f\u7d22\u5f15\u4f53\u79ef\u53d8\u6210\u539f\u59cb\u5411\u91cf\u7684 1.53 \u500d\u3001\u5165\u5e93 2.93 \u79d2&#xff08;IVF \u53ea\u8981 0.10 \u79d2&#xff09;\u3002PQ \u538b\u7f29\u80fd\u628a\u7d22\u5f15\u538b\u5230 1\/20&#xff0c;\u4f46\u53ec\u56de\u53ea\u5269 0.337&#xff0c;\u800c\u4e14\u8c03 nprobe \u5b8c\u5168\u6551\u4e0d\u56de\u6765\u2014\u2014\u74f6\u9888\u5728\u538b\u7f29\u7801\u672c&#xff0c;\u4e0d\u5728\u626b\u591a\u5c11\u4e2a\u5012\u6392\u6876\u3002<\/p>\n<p>\u4e0b\u9762\u8fd9\u7ec4\u6570\u5168\u90e8\u5728\u4e00\u53f0 2 \u6838\u673a\u5668\u4e0a\u8dd1\u51fa\u6765&#xff1a;faiss-cpu 1.15.1\u3001numpy 2.5.3&#xff0c;10 \u4e07\u6761 128 \u7ef4 float32 \u5411\u91cf&#xff0c;1000 \u6761\u67e5\u8be2&#xff0c;top-10\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261007111737-6ac62a51e7c27.png\" alt=\"10 \u4e07\u6761\u5411\u91cf\u4e0a\u4e09\u79cd Faiss \u7d22\u5f15\u7684\u5b9e\u6d4b\" \/><\/p>\n<h3>\u5b9e\u9a8c\u600e\u4e48\u642d\u7684<\/h3>\n<p>\u6570\u636e\u7528 2000 \u4e2a\u7c07\u5fc3\u52a0\u9ad8\u65af\u566a\u58f0\u5408\u6210&#xff0c;\u6a21\u62df\u771f\u5b9e embedding \u7684\u7c07\u7ed3\u6784&#xff1a;512 \u5b57\u8282\u4e00\u6761\u7684\u5411\u91cf&#xff0c;\u603b\u5171 48.8 MB\u3002\u8bc4\u6d4b\u53e3\u5f84\u662f\u53ec\u56de&#064;10\u2014\u2014\u7528\u66b4\u529b\u68c0\u7d22&#xff08;IndexFlatL2&#xff09;\u7684\u7ed3\u679c\u5f53\u6807\u51c6\u7b54\u6848&#xff0c;\u770b\u8fd1\u4f3c\u7d22\u5f15\u7684\u524d 10 \u6761\u91cc\u547d\u4e2d\u4e86\u51e0\u6761\u3002<\/p>\n<p><span class=\"token keyword\">import<\/span> faiss<span class=\"token punctuation\">,<\/span> numpy <span class=\"token keyword\">as<\/span> np<span class=\"token punctuation\">,<\/span> time<\/p>\n<p>np<span class=\"token punctuation\">.<\/span>random<span class=\"token punctuation\">.<\/span>seed<span class=\"token punctuation\">(<\/span><span class=\"token number\">7<\/span><span class=\"token punctuation\">)<\/span><br \/>\nd<span class=\"token punctuation\">,<\/span> nb<span class=\"token punctuation\">,<\/span> nq<span class=\"token punctuation\">,<\/span> k<span class=\"token punctuation\">,<\/span> nc <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">128<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token number\">100_000<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token number\">1000<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token number\">10<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token number\">2000<\/span><br \/>\ncenters <span class=\"token operator\">&#061;<\/span> np<span class=\"token punctuation\">.<\/span>random<span class=\"token punctuation\">.<\/span>rand<span class=\"token punctuation\">(<\/span>nc<span class=\"token punctuation\">,<\/span> d<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">.<\/span>astype<span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;float32&#034;<\/span><span class=\"token punctuation\">)<\/span><br \/>\nxb <span class=\"token operator\">&#061;<\/span> <span class=\"token punctuation\">(<\/span>centers<span class=\"token punctuation\">[<\/span>np<span class=\"token punctuation\">.<\/span>random<span class=\"token punctuation\">.<\/span>randint<span class=\"token punctuation\">(<\/span><span class=\"token number\">0<\/span><span class=\"token punctuation\">,<\/span> nc<span class=\"token punctuation\">,<\/span> nb<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">]<\/span> <span class=\"token operator\">&#043;<\/span> <span class=\"token number\">0.08<\/span> <span class=\"token operator\">*<\/span> np<span class=\"token punctuation\">.<\/span>random<span class=\"token punctuation\">.<\/span>randn<span class=\"token punctuation\">(<\/span>nb<span class=\"token punctuation\">,<\/span> d<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">.<\/span>astype<span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;float32&#034;<\/span><span class=\"token punctuation\">)<\/span><br \/>\nxq <span class=\"token operator\">&#061;<\/span> <span class=\"token punctuation\">(<\/span>centers<span class=\"token punctuation\">[<\/span>np<span class=\"token punctuation\">.<\/span>random<span class=\"token punctuation\">.<\/span>randint<span class=\"token punctuation\">(<\/span><span class=\"token number\">0<\/span><span class=\"token punctuation\">,<\/span> nc<span class=\"token punctuation\">,<\/span> nq<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">]<\/span> <span class=\"token operator\">&#043;<\/span> <span class=\"token number\">0.08<\/span> <span class=\"token operator\">*<\/span> np<span class=\"token punctuation\">.<\/span>random<span class=\"token punctuation\">.<\/span>randn<span class=\"token punctuation\">(<\/span>nq<span class=\"token punctuation\">,<\/span> d<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">.<\/span>astype<span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;float32&#034;<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p><span class=\"token comment\"># \u66b4\u529b\u68c0\u7d22\u65e2\u5f53\u57fa\u7ebf&#xff0c;\u4e5f\u5f53\u6807\u51c6\u7b54\u6848<\/span><br \/>\nflat <span class=\"token operator\">&#061;<\/span> faiss<span class=\"token punctuation\">.<\/span>IndexFlatL2<span class=\"token punctuation\">(<\/span>d<span class=\"token punctuation\">)<\/span><br \/>\nflat<span class=\"token punctuation\">.<\/span>add<span class=\"token punctuation\">(<\/span>xb<span class=\"token punctuation\">)<\/span><br \/>\n_<span class=\"token punctuation\">,<\/span> gt <span class=\"token operator\">&#061;<\/span> flat<span class=\"token punctuation\">.<\/span>search<span class=\"token punctuation\">(<\/span>xq<span class=\"token punctuation\">,<\/span> k<span class=\"token punctuation\">)<\/span>          <span class=\"token comment\"># gt: (1000, 10) \u7684\u90bb\u5c45 id<\/span><\/p>\n<p><span class=\"token keyword\">def<\/span> <span class=\"token function\">recall<\/span><span class=\"token punctuation\">(<\/span>I<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span><br \/>\n    <span class=\"token keyword\">return<\/span> <span class=\"token builtin\">float<\/span><span class=\"token punctuation\">(<\/span>np<span class=\"token punctuation\">.<\/span>mean<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">[<\/span><span class=\"token builtin\">len<\/span><span class=\"token punctuation\">(<\/span><span class=\"token builtin\">set<\/span><span class=\"token punctuation\">(<\/span>I<span class=\"token punctuation\">[<\/span>i<span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token operator\">&amp;<\/span> <span class=\"token builtin\">set<\/span><span class=\"token punctuation\">(<\/span>gt<span class=\"token punctuation\">[<\/span>i<span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token operator\">\/<\/span> k <span class=\"token keyword\">for<\/span> i <span class=\"token keyword\">in<\/span> <span class=\"token builtin\">range<\/span><span class=\"token punctuation\">(<\/span><span class=\"token builtin\">len<\/span><span class=\"token punctuation\">(<\/span>I<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">]<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p><span class=\"token keyword\">def<\/span> <span class=\"token function\">bench<\/span><span class=\"token punctuation\">(<\/span>name<span class=\"token punctuation\">,<\/span> index<span class=\"token punctuation\">,<\/span> need_train<span class=\"token operator\">&#061;<\/span><span class=\"token boolean\">True<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span><br \/>\n    t0 <span class=\"token operator\">&#061;<\/span> time<span class=\"token punctuation\">.<\/span>perf_counter<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><br \/>\n    <span class=\"token keyword\">if<\/span> need_train<span class=\"token punctuation\">:<\/span><br \/>\n        index<span class=\"token punctuation\">.<\/span>train<span class=\"token punctuation\">(<\/span>xb<span class=\"token punctuation\">)<\/span>              <span class=\"token comment\"># IVF\/PQ \u5fc5\u987b\u5148\u8bad\u7ec3<\/span><br \/>\n    t_train <span class=\"token operator\">&#061;<\/span> time<span class=\"token punctuation\">.<\/span>perf_counter<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token operator\">&#8211;<\/span> t0<br \/>\n    t0 <span class=\"token operator\">&#061;<\/span> time<span class=\"token punctuation\">.<\/span>perf_counter<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span> index<span class=\"token punctuation\">.<\/span>add<span class=\"token punctuation\">(<\/span>xb<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span> t_add <span class=\"token operator\">&#061;<\/span> time<span class=\"token punctuation\">.<\/span>perf_counter<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token operator\">&#8211;<\/span> t0<br \/>\n    t0 <span class=\"token operator\">&#061;<\/span> time<span class=\"token punctuation\">.<\/span>perf_counter<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span> _<span class=\"token punctuation\">,<\/span> I <span class=\"token operator\">&#061;<\/span> index<span class=\"token punctuation\">.<\/span>search<span class=\"token punctuation\">(<\/span>xq<span class=\"token punctuation\">,<\/span> k<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span> t_q <span class=\"token operator\">&#061;<\/span> time<span class=\"token punctuation\">.<\/span>perf_counter<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token operator\">&#8211;<\/span> t0<br \/>\n    <span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string-interpolation\"><span class=\"token string\">f&#034;<\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>name<span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">: \u8bad\u7ec3 <\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>t_train<span class=\"token punctuation\">:<\/span><span class=\"token format-spec\">.2f<\/span><span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">s \u5165\u5e93 <\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>t_add<span class=\"token punctuation\">:<\/span><span class=\"token format-spec\">.2f<\/span><span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">s &#034;<\/span><\/span><br \/>\n          <span class=\"token string-interpolation\"><span class=\"token string\">f&#034;\u67e5\u8be2 <\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>t_q <span class=\"token operator\">\/<\/span> nq <span class=\"token operator\">*<\/span> <span class=\"token number\">1000<\/span><span class=\"token punctuation\">:<\/span><span class=\"token format-spec\">.3f<\/span><span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\"> ms\/\u6761 \u53ec\u56de&#064;10 <\/span><span class=\"token interpolation\"><span class=\"token punctuation\">{<\/span>recall<span class=\"token punctuation\">(<\/span>I<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span><span class=\"token format-spec\">.3f<\/span><span class=\"token punctuation\">}<\/span><\/span><span class=\"token string\">&#034;<\/span><\/span><span class=\"token punctuation\">)<\/span><br \/>\n    <span class=\"token keyword\">return<\/span> I<\/p>\n<p>ivf <span class=\"token operator\">&#061;<\/span> faiss<span class=\"token punctuation\">.<\/span>IndexIVFFlat<span class=\"token punctuation\">(<\/span>faiss<span class=\"token punctuation\">.<\/span>IndexFlatL2<span class=\"token punctuation\">(<\/span>d<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span> d<span class=\"token punctuation\">,<\/span> <span class=\"token number\">256<\/span><span class=\"token punctuation\">)<\/span>   <span class=\"token comment\"># 256 \u4e2a\u5012\u6392\u6876<\/span><br \/>\nivf<span class=\"token punctuation\">.<\/span>nprobe <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">16<\/span>                                          <span class=\"token comment\"># \u6bcf\u6b21\u626b 16 \u4e2a\u6876<\/span><br \/>\nbench<span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;IVF256,Flat nprobe&#061;16&#034;<\/span><span class=\"token punctuation\">,<\/span> ivf<span class=\"token punctuation\">)<\/span><\/p>\n<p>pq <span class=\"token operator\">&#061;<\/span> faiss<span class=\"token punctuation\">.<\/span>IndexIVFPQ<span class=\"token punctuation\">(<\/span>faiss<span class=\"token punctuation\">.<\/span>IndexFlatL2<span class=\"token punctuation\">(<\/span>d<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">,<\/span> d<span class=\"token punctuation\">,<\/span> <span class=\"token number\">256<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token number\">16<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token number\">8<\/span><span class=\"token punctuation\">)<\/span>  <span class=\"token comment\"># 16 \u4e2a\u5b50\u91cf\u5316\u5668 x 8 bit<\/span><br \/>\npq<span class=\"token punctuation\">.<\/span>nprobe <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">32<\/span><br \/>\nbench<span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;IVF256,PQ16x8 nprobe&#061;32&#034;<\/span><span class=\"token punctuation\">,<\/span> pq<span class=\"token punctuation\">)<\/span><\/p>\n<p>hnsw <span class=\"token operator\">&#061;<\/span> faiss<span class=\"token punctuation\">.<\/span>IndexHNSWFlat<span class=\"token punctuation\">(<\/span>d<span class=\"token punctuation\">,<\/span> <span class=\"token number\">32<\/span><span class=\"token punctuation\">)<\/span>   <span class=\"token comment\"># \u56fe\u7d22\u5f15\u4e0d\u9700\u8981\u8bad\u7ec3<\/span><br \/>\nhnsw<span class=\"token punctuation\">.<\/span>hnsw<span class=\"token punctuation\">.<\/span>efSearch <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">64<\/span><br \/>\nbench<span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;HNSW32 efSearch&#061;64&#034;<\/span><span class=\"token punctuation\">,<\/span> hnsw<span class=\"token punctuation\">,<\/span> need_train<span class=\"token operator\">&#061;<\/span><span class=\"token boolean\">False<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<h3>\u56db\u79cd\u7d22\u5f15\u7684\u5b9e\u6d4b\u7ed3\u679c<\/h3>\n<table>\n<tr>\u7d22\u5f15\u8bad\u7ec3\u8017\u65f6\u5165\u5e93\u8017\u65f6\u67e5\u8be2 ms\/\u6761\u53ec\u56de&#064;10\u7d22\u5f15\u6587\u4ef6\u4f53\u79ef\u500d\u7387<\/tr>\n<tbody>\n<tr>\n<td>Flat&#xff08;\u66b4\u529b&#xff0c;\u57fa\u7ebf&#xff09;<\/td>\n<td>\u4e0d\u9700\u8981<\/td>\n<td>0.02 s<\/td>\n<td>0.452<\/td>\n<td>1.000<\/td>\n<td>48.8 MB<\/td>\n<td>1.00<\/td>\n<\/tr>\n<tr>\n<td>IVF256,Flat nprobe&#061;16<\/td>\n<td>0.70 s<\/td>\n<td>0.10 s<\/td>\n<td>0.195<\/td>\n<td>1.000<\/td>\n<td>49.7 MB<\/td>\n<td>1.02<\/td>\n<\/tr>\n<tr>\n<td>HNSW32 efSearch&#061;64<\/td>\n<td>\u4e0d\u9700\u8981<\/td>\n<td>2.93 s<\/td>\n<td>0.031<\/td>\n<td>0.998<\/td>\n<td>74.8 MB<\/td>\n<td>1.53<\/td>\n<\/tr>\n<tr>\n<td>IVF1024,PQ32x8 nprobe&#061;32<\/td>\n<td>5.37 s<\/td>\n<td>0.51 s<\/td>\n<td>0.063<\/td>\n<td>0.573<\/td>\n<td>4.4 MB<\/td>\n<td>0.09<\/td>\n<\/tr>\n<tr>\n<td>IVF256,PQ16x8 nprobe&#061;32<\/td>\n<td>1.99 s<\/td>\n<td>0.24 s<\/td>\n<td>0.072<\/td>\n<td>0.337<\/td>\n<td>2.5 MB<\/td>\n<td>0.05<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u53e3\u5f84\u8bf4\u660e&#xff1a;\u53ec\u56de&#064;10 \u4ee5\u66b4\u529b\u68c0\u7d22\u7ed3\u679c\u4e3a\u6807\u51c6\u7b54\u6848&#xff1b;\u4f53\u79ef\u500d\u7387 &#061; \u7d22\u5f15\u6587\u4ef6 \u00f7 \u539f\u59cb\u5411\u91cf 48.8 MB&#xff1b;\u67e5\u8be2\u8017\u65f6\u4e3a 1000 \u6761\u67e5\u8be2\u8fde\u7eed\u6267\u884c\u540e\u7684\u5e73\u5747\u503c&#xff0c;\u672a\u505a\u9884\u70ed\u5254\u9664\u3002<\/p>\n<p>Flat&#xff08;\u57fa\u7ebf&#xff09;: \u5165\u5e93 0.02s \u67e5\u8be2 0.452 ms\/\u6761 \u53ec\u56de 1.000<br \/>\nIVF256,Flat nprobe&#061;16: \u8bad\u7ec3 0.70s \u5165\u5e93 0.10s \u67e5\u8be2 0.195 ms\/\u6761 \u53ec\u56de 1.000<br \/>\nIVF256,PQ16x8 nprobe&#061;32: \u8bad\u7ec3 1.99s \u5165\u5e93 0.24s \u67e5\u8be2 0.072 ms\/\u6761 \u53ec\u56de 0.337<br \/>\nIVF1024,PQ32x8 nprobe&#061;32: \u8bad\u7ec3 5.37s \u5165\u5e93 0.51s \u67e5\u8be2 0.063 ms\/\u6761 \u53ec\u56de 0.573<br \/>\nHNSW32 efSearch&#061;64: \u5165\u5e93 2.93s \u67e5\u8be2 0.031 ms\/\u6761 \u53ec\u56de 0.998<\/p>\n<p>\u8fd9\u7ec4\u6570\u636e\u91cc\u6700\u80fd\u8bf4\u660e\u95ee\u9898\u7684\u662f IVF \u548c HNSW \u7684\u5dee\u522b&#xff1a;\u4e24\u8005\u53ec\u56de\u90fd\u5728 0.998 \u4ee5\u4e0a&#xff0c;\u4f46 HNSW \u7684\u67e5\u8be2\u5feb 6 \u500d&#xff0c;\u5165\u5e93\u6162 29 \u500d&#xff0c;\u7d22\u5f15\u5927 50%\u3002\u67e5\u8be2\u91cf\u5927\u7684\u5728\u7ebf\u670d\u52a1&#xff0c;\u8fd9\u70b9\u5dee\u5f02\u503c\u5f97&#xff1b;\u79bb\u7ebf\u6279\u5904\u7406\u6bcf\u5929\u8dd1\u4e00\u6b21\u7684\u573a\u666f&#xff0c;\u5c31\u6ca1\u5fc5\u8981\u4e3a HNSW \u4ed8\u8fd9\u4efd\u5165\u5e93\u4ee3\u4ef7\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261007111738-6ac62a5261feb.png\" alt=\"\u56db\u79cd\u7d22\u5f15\u7684\u53ec\u56de\u3001\u5ef6\u8fdf\u4e0e\u4f53\u79ef\u7ed3\u8bba\" \/><\/p>\n<h3>\u8c03 nprobe \u6551\u4e0d\u56de PQ<\/h3>\n<p>PQ \u7248\u672c\u7684\u53ec\u56de 0.337 \u770b\u7740\u96be\u53d7&#xff0c;\u7b2c\u4e00\u53cd\u5e94\u662f\u52a0\u5927 nprobe\u3002\u7ed3\u679c\u662f\u767d\u8d39\u529f\u592b&#xff1a;<\/p>\n<p>nprobe&#061;  1 \u67e5\u8be2 0.005 ms\/\u6761 \u53ec\u56de&#064;10 0.336<br \/>\nnprobe&#061;  4 \u67e5\u8be2 0.012 ms\/\u6761 \u53ec\u56de&#064;10 0.337<br \/>\nnprobe&#061;  8 \u67e5\u8be2 0.021 ms\/\u6761 \u53ec\u56de&#064;10 0.337<br \/>\nnprobe&#061; 16 \u67e5\u8be2 0.040 ms\/\u6761 \u53ec\u56de&#064;10 0.337<br \/>\nnprobe&#061; 32 \u67e5\u8be2 0.076 ms\/\u6761 \u53ec\u56de&#064;10 0.337<br \/>\nnprobe&#061; 64 \u67e5\u8be2 0.132 ms\/\u6761 \u53ec\u56de&#064;10 0.337<br \/>\nnprobe&#061;128 \u67e5\u8be2 0.229 ms\/\u6761 \u53ec\u56de&#064;10 0.337<\/p>\n<p>nprobe \u4ece 1 \u6da8\u5230 128&#xff0c;\u626b\u63cf\u7684\u6876\u6570\u91cf\u7ffb\u4e86 128 \u500d&#xff0c;\u67e5\u8be2\u8017\u65f6\u6da8\u4e86 46 \u500d&#xff0c;\u53ec\u56de\u4e00\u4f4d\u5c0f\u6570\u90fd\u6ca1\u52a8\u3002\u539f\u56e0\u4e0d\u96be\u7406\u89e3&#xff1a;\u6b63\u786e\u7684\u90a3\u6761\u90bb\u5c45\u65e9\u5c31\u88ab\u5012\u6392\u6876\u5708\u8fdb\u6765\u4e86&#xff0c;\u95ee\u9898\u51fa\u5728\u8ddd\u79bb\u662f\u7528 16 \u5b57\u8282\u7684\u538b\u7f29\u7801\u7b97\u7684&#xff0c;\u7b97\u51fa\u6765\u7684\u6392\u5e8f\u548c\u771f\u5b9e\u8ddd\u79bb\u4e0d\u4e00\u81f4&#xff0c;\u524d 10 \u540d\u88ab\u6324\u51fa\u53bb\u4e86\u3002\u626b\u66f4\u591a\u6876\u53ea\u4f1a\u5e26\u8fdb\u66f4\u591a\u540c\u6837\u88ab\u538b\u7f29\u7801\u626d\u66f2\u7684\u5019\u9009\u3002<\/p>\n<p>\u771f\u6b63\u7ba1\u7528\u7684\u65cb\u94ae\u662f\u6bcf\u4e2a\u5411\u91cf\u7684\u5b57\u8282\u6570\u3002\u628a\u5b50\u91cf\u5316\u5668\u6570\u91cf\u4ece 16 \u52a0\u5230 64&#xff0c;\u53ec\u56de\u4ece 0.337 \u5347\u5230 0.803&#xff0c;\u7d22\u5f15\u4e5f\u4ece 2.5 MB \u6da8\u5230 7.1 MB&#xff1a;<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261007111738-6ac62a52a9d0c.png\" alt=\"PQ \u538b\u7f29\u7684\u4e09\u4e2a\u5173\u952e\u6570\u5b57\" \/><\/p>\n<table>\n<tr>\u5b50\u91cf\u5316\u5668 mnbits\u5b57\u8282\/\u5411\u91cf\u8bad\u7ec3\u8017\u65f6\u67e5\u8be2 ms\/\u6761\u53ec\u56de&#064;10\u7d22\u5f15\u6587\u4ef6<\/tr>\n<tbody>\n<tr>\n<td>8<\/td>\n<td>8<\/td>\n<td>8<\/td>\n<td>1.63 s<\/td>\n<td>0.048<\/td>\n<td>0.244<\/td>\n<td>1.8 MB<\/td>\n<\/tr>\n<tr>\n<td>16<\/td>\n<td>8<\/td>\n<td>16<\/td>\n<td>1.94 s<\/td>\n<td>0.075<\/td>\n<td>0.337<\/td>\n<td>2.5 MB<\/td>\n<\/tr>\n<tr>\n<td>32<\/td>\n<td>8<\/td>\n<td>32<\/td>\n<td>2.86 s<\/td>\n<td>0.110<\/td>\n<td>0.509<\/td>\n<td>4.1 MB<\/td>\n<\/tr>\n<tr>\n<td>64<\/td>\n<td>8<\/td>\n<td>64<\/td>\n<td>4.97 s<\/td>\n<td>0.229<\/td>\n<td>0.803<\/td>\n<td>7.1 MB<\/td>\n<\/tr>\n<tr>\n<td>32<\/td>\n<td>6<\/td>\n<td>24<\/td>\n<td>1.62 s<\/td>\n<td>0.643<\/td>\n<td>0.425<\/td>\n<td>3.2 MB<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u53e3\u5f84\u8bf4\u660e&#xff1a;\u5168\u90e8\u4e3a IVF256 &#043; nprobe&#061;32&#xff0c;\u540c\u6837\u7684 10 \u4e07\u6761\u6570\u636e\u548c 1000 \u6761\u67e5\u8be2&#xff1b;\u5b57\u8282\/\u5411\u91cf &#061; m \u00d7 nbits \u00f7 8&#xff0c;\u4e0e\u7d22\u5f15\u6587\u4ef6\u5927\u5c0f\u4e92\u76f8\u5370\u8bc1&#xff08;16 \u5b57\u8282 \u00d7 10 \u4e07\u6761 &#061; 1.6 MB&#xff0c;\u52a0\u7801\u672c\u548c\u5012\u6392\u8868\u540e\u662f 2.5 MB&#xff09;\u3002<\/p>\n<p>\u8868\u91cc\u6700\u540e\u4e00\u884c\u662f\u4e2a\u610f\u5916\u7684\u5751&#xff1a;nbits&#061;6 \u6bcf\u5411\u91cf\u53ea\u8981 24 \u5b57\u8282&#xff0c;\u6bd4 m&#061;32\/nbits&#061;8 \u7701 8 \u5b57\u8282&#xff0c;\u4f46\u67e5\u8be2\u4ece 0.110 ms \u53d8\u6210 0.643 ms&#xff0c;\u6162\u4e86\u8fd1 6 \u500d\u3002faiss \u7684 PQ \u8ddd\u79bb\u8ba1\u7b97\u53ea\u5bf9 nbits&#061;8 \u548c 4 \u6709 SIMD \u5feb\u8def\u5f84&#xff0c;6 bit \u8d70\u901a\u7528\u8def\u5f84&#xff0c;\u7701\u4e0b\u7684\u90a3\u70b9\u4f53\u79ef\u5168\u88ab\u7b97\u529b\u5403\u56de\u53bb\u4e86\u3002<\/p>\n<h3>\u6211\u8e29\u5230\u7684\u4e24\u4e2a\u5751<\/h3>\n<p>\u7b2c\u4e00\u4e2a\u8ddf\u6570\u636e\u6709\u5173\u3002\u540c\u4e00\u5957\u4ee3\u7801&#xff0c;\u6211\u628a\u5411\u91cf\u6362\u6210\u5747\u5300\u968f\u673a\u6570&#xff08;\u6ca1\u6709\u7c07\u7ed3\u6784&#xff09;\u518d\u8dd1\u4e00\u904d&#xff0c;IVF256 nprobe&#061;8 \u7684\u53ec\u56de\u53ea\u6709 0.175&#xff0c;PQ \u662f 0.165\u3002128 \u7ef4\u7a7a\u95f4\u91cc\u5747\u5300\u968f\u673a\u7684\u70b9\u5f7c\u6b64\u8ddd\u79bb\u90fd\u5dee\u4e0d\u591a&#xff0c;\u5012\u6392\u6876\u5206\u4e0d\u51fa\u8c01\u8be5\u8fdb\u54ea\u4e2a\u6876&#xff0c;\u538b\u7f29\u7801\u4e5f\u5206\u4e0d\u51fa\u5dee\u8ddd\u3002\u6240\u4ee5\u5728\u81ea\u5df1\u7684\u8bed\u6599\u4e0a\u505a\u9009\u578b\u524d&#xff0c;\u5148\u786e\u8ba4\u6570\u636e\u662f\u4e0d\u662f\u771f\u7684\u6709\u7c07\u7ed3\u6784\u2014\u2014\u7528\u771f\u5b9e embedding \u8dd1&#xff0c;\u522b\u7167\u642c\u522b\u4eba\u7684\u53ec\u56de\u6570\u5b57\u3002<\/p>\n<p>\u7b2c\u4e8c\u4e2a\u662f\u6d41\u7a0b\u4e0a\u7684\u3002IVF \u548c PQ \u5fc5\u987b\u5148\u8bad\u7ec3\u518d\u5165\u5e93&#xff0c;\u987a\u5e8f\u53cd\u4e86\u4f1a\u76f4\u63a5\u62a5\u9519&#xff1a;<\/p>\n<p>RuntimeError: Error in virtual void faiss::IndexIVFFlat::add_core(&#8230;)<br \/>\nat \/project\/faiss\/IndexIVFFlat.cpp:66: Error: &#039;is_trained&#039; failed<\/p>\n<p>\u53e6\u5916 faiss \u5bf9\u8bad\u7ec3\u6837\u672c\u91cf\u6709\u81ea\u5df1\u7684\u5224\u65ad&#xff0c;\u8bad\u7ec3\u96c6\u7ed9 2000 \u6761\u65f6\u4f1a\u6253\u5370 please provide at least 9984 training points&#xff0c;\u8fd9\u4e2a 9984 \u7ea6\u7b49\u4e8e 39 \u00d7 nlist\u3002\u6211\u8bd5\u4e86 2000 \/ 13000 \/ 26000 \/ 100000 \u56db\u79cd\u8bad\u7ec3\u89c4\u6a21&#xff0c;\u53ec\u56de\u5206\u522b\u662f 0.346 \/ 0.337 \/ 0.333 \/ 0.337&#xff0c;\u5728\u8fd9\u4e2a\u6570\u636e\u96c6\u4e0a\u6ca1\u6709\u533a\u522b&#xff0c;\u4f46\u8bad\u7ec3\u6837\u672c\u5c11\u4e8e\u5efa\u8bae\u503c\u65f6\u8be5\u7ed9\u7684\u8b66\u544a\u8fd8\u662f\u4f1a\u7ed9\u3002<\/p>\n<h3>\u6211\u600e\u4e48\u7528\u5b83<\/h3>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261007111738-6ac62a52e6e9b.png\" alt=\"\u9009\u578b\u8981\u8dd1\u7684\u56db\u4e2a\u52a8\u4f5c\" \/><\/p>\n<p>\u5341\u4e07\u6761\u8fd9\u4e2a\u91cf\u7ea7&#xff0c;\u6211\u7684\u9ed8\u8ba4\u9009\u62e9\u662f IVF256 \u52a0 Flat \u5012\u6392\u8868\u3001nprobe&#061;16&#xff1a;\u53ec\u56de\u548c\u66b4\u529b\u68c0\u7d22\u4e00\u6837&#xff0c;\u67e5\u8be2\u5feb 2.3 \u500d&#xff0c;\u7d22\u5f15\u53ea\u5927 1.8%&#xff0c;\u8bad\u7ec3 0.7 \u79d2\u3002\u4e0a\u7ebf\u524d\u53ea\u5728\u771f\u5b9e\u8bed\u6599\u4e0a\u8dd1\u4e00\u904d\u53ec\u56de&#xff0c;\u5bf9\u5f97\u4e0a\u5c31\u6536\u5de5\u3002<\/p>\n<p>HNSW \u6211\u4f1a\u7559\u7ed9\u4e24\u79cd\u60c5\u51b5&#xff1a;\u67e5\u8be2\u5ef6\u8fdf\u6709\u786c\u6307\u6807&#xff08;\u6bd4\u5982\u8981\u538b\u5230 0.05 ms \u4ee5\u5185&#xff09;&#xff0c;\u6216\u8005\u6570\u636e\u662f\u6d41\u5f0f\u589e\u91cf\u3001\u6ca1\u6cd5\u505c\u673a\u91cd\u8bad\u3002\u5b83\u7684\u4ee3\u4ef7\u662f\u5165\u5e93 2.93 \u79d2\u548c 74.8 MB \u7d22\u5f15&#xff0c;\u589e\u91cf\u63d2\u5165\u8fd8\u4f1a\u8ba9\u56fe\u7ed3\u6784\u6162\u6162\u53d8\u5dee&#xff0c;\u9700\u8981\u5b9a\u671f\u91cd\u5efa\u3002<\/p>\n<p>PQ \u6211\u6682\u65f6\u4e0d\u7528\u5728\u8fd9\u4e2a\u91cf\u7ea7\u3002\u5341\u4e07\u6761\u538b\u7f29\u5230 2.5 MB \u7701\u4e0b\u6765\u7684\u5185\u5b58&#xff0c;\u6362 0.337 \u7684\u53ec\u56de\u4e0d\u5212\u7b97\u3002PQ \u771f\u6b63\u7684\u7528\u6b66\u4e4b\u5730\u662f\u5343\u4e07\u7ea7\u4ee5\u4e0a\u3001\u5185\u5b58\u88c5\u4e0d\u4e0b\u539f\u59cb\u5411\u91cf\u7684\u573a\u666f&#xff0c;\u90a3\u65f6\u5019\u8fde Flat \u5012\u6392\u8868\u90fd\u653e\u4e0d\u4e0b&#xff0c;\u538b\u7f29\u662f\u552f\u4e00\u9009\u9879&#xff0c;\u4ee3\u4ef7\u5c31\u662f\u53ec\u56de\u3002\u771f\u8981\u4e0a&#xff0c;\u6211\u4f1a\u5148\u628a m \u8c03\u5230 32 \u6216 64&#xff0c;\u800c\u4e0d\u662f\u53bb\u52a8 nprobe\u3002<\/p>\n<p>\u4e09\u6761\u53ef\u4ee5\u9a6c\u4e0a\u505a\u7684&#xff1a;<\/p>\n<li>\u7528\u771f\u5b9e\u8bed\u6599\u62bd 10 \u4e07\u6761\u5411\u91cf&#xff0c;\u6309\u4e0a\u9762\u7684\u5199\u6cd5\u8dd1\u4e00\u904d Flat \u548c IVF256&#xff08;nprobe \u53d6 8\u300116\u300132 \u4e09\u4e2a\u503c&#xff09;&#xff0c;\u770b\u53ec\u56de\u548c\u5ef6\u8fdf\u5bf9\u4e0d\u5bf9\u5f97\u4e0a\u9700\u6c42\u3002<\/li>\n<li>\u51b3\u5b9a\u662f\u5426\u4e0a HNSW \u4e4b\u524d&#xff0c;\u5148\u91cf\u4e00\u4e0b\u5165\u5e93\u8017\u65f6\u548c\u7d22\u5f15\u6587\u4ef6\u5927\u5c0f&#xff0c;\u628a\u8fd9\u4e24\u9879\u548c\u67e5\u8be2\u5ef6\u8fdf\u653e\u4e00\u8d77\u770b\u3002<\/li>\n<li>\u5982\u679c\u6700\u7ec8\u8981\u8d70 PQ&#xff0c;\u5148\u628a\u5b50\u91cf\u5316\u5668\u6570\u91cf\u626b\u4e00\u904d&#xff08;8 \/ 16 \/ 32 \/ 64&#xff09;&#xff0c;\u522b\u628a\u8c03\u53c2\u65f6\u95f4\u82b1\u5728 nprobe \u4e0a\u3002<\/li>\n","protected":false},"excerpt":{"rendered":"<p>\u624b\u91cc\u6709 10 \u4e07\u6761 128 \u7ef4\u5411\u91cf\u3001\u673a\u5668\u53ea\u6709 2 \u6838\u7684\u65f6\u5019&#xff0c;Faiss \u91cc\u6700\u5148\u8be5\u8bd5\u7684\u4e0d\u662f HNSW&#xff0c;\u800c\u662f\u5012\u6392\u8868\u4e0d\u52a0\u538b\u7f29\u7684 IVF&#xff1a;nprobe16 \u5c31\u80fd\u628a\u53ec\u56de\u505a\u5230\u548c\u66b4\u529b\u68c0\u7d22\u4e00\u6837&#xff08;1.000&#xff09;&#xff0c;\u5355\u6761\u67e5\u8be2\u4ece 0.452 ms \u6389\u5230 0.195 ms\u3002HNSW \u66f4\u5feb&#xff0c;0.031 ms \u62ff\u5230 0.998 \u7684\u53ec\u56de&#xff0c;\u4ee3\u4ef7\u662f\u7d22\u5f15\u4f53\u79ef\u53d8\u6210\u539f\u59cb\u5411\u91cf\u7684 1.53 \u500d\u3001\u5165\u5e93 2.93 \u79d2<\/p>\n","protected":false},"author":2,"featured_media":113855,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[10839,10237,6238,132],"topic":[],"class_list":["post-113859","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-faiss","tag-10237","tag-6238","tag-132"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Faiss \u7d22\u5f15\u600e\u4e48\u9009\uff1a10 \u4e07\u6761 128 \u7ef4\u5411\u91cf\u4e0a IVF\u3001PQ\u3001HNSW \u7684\u53ec\u56de\u4e0e\u5ef6\u8fdf\u5b9e\u6d4b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/113859.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Faiss \u7d22\u5f15\u600e\u4e48\u9009\uff1a10 \u4e07\u6761 128 \u7ef4\u5411\u91cf\u4e0a IVF\u3001PQ\u3001HNSW \u7684\u53ec\u56de\u4e0e\u5ef6\u8fdf\u5b9e\u6d4b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u624b\u91cc\u6709 10 \u4e07\u6761 128 \u7ef4\u5411\u91cf\u3001\u673a\u5668\u53ea\u6709 2 \u6838\u7684\u65f6\u5019&#xff0c;Faiss \u91cc\u6700\u5148\u8be5\u8bd5\u7684\u4e0d\u662f HNSW&#xff0c;\u800c\u662f\u5012\u6392\u8868\u4e0d\u52a0\u538b\u7f29\u7684 IVF&#xff1a;nprobe16 \u5c31\u80fd\u628a\u53ec\u56de\u505a\u5230\u548c\u66b4\u529b\u68c0\u7d22\u4e00\u6837&#xff08;1.000&#xff09;&#xff0c;\u5355\u6761\u67e5\u8be2\u4ece 0.452 ms \u6389\u5230 0.195 ms\u3002HNSW \u66f4\u5feb&#xff0c;0.031 ms \u62ff\u5230 0.998 \u7684\u53ec\u56de&#xff0c;\u4ee3\u4ef7\u662f\u7d22\u5f15\u4f53\u79ef\u53d8\u6210\u539f\u59cb\u5411\u91cf\u7684 1.53 \u500d\u3001\u5165\u5e93 2.93 \u79d2\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/113859.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-10-07T11:17:40+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261007111737-6ac62a51e7c27.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/113859.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/113859.html\",\"name\":\"Faiss \u7d22\u5f15\u600e\u4e48\u9009\uff1a10 \u4e07\u6761 128 \u7ef4\u5411\u91cf\u4e0a IVF\u3001PQ\u3001HNSW \u7684\u53ec\u56de\u4e0e\u5ef6\u8fdf\u5b9e\u6d4b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-10-07T11:17:40+00:00\",\"dateModified\":\"2026-10-07T11:17:40+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/113859.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/113859.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/113859.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Faiss \u7d22\u5f15\u600e\u4e48\u9009\uff1a10 \u4e07\u6761 128 \u7ef4\u5411\u91cf\u4e0a IVF\u3001PQ\u3001HNSW \u7684\u53ec\u56de\u4e0e\u5ef6\u8fdf\u5b9e\u6d4b\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Faiss \u7d22\u5f15\u600e\u4e48\u9009\uff1a10 \u4e07\u6761 128 \u7ef4\u5411\u91cf\u4e0a IVF\u3001PQ\u3001HNSW \u7684\u53ec\u56de\u4e0e\u5ef6\u8fdf\u5b9e\u6d4b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/113859.html","og_locale":"zh_CN","og_type":"article","og_title":"Faiss \u7d22\u5f15\u600e\u4e48\u9009\uff1a10 \u4e07\u6761 128 \u7ef4\u5411\u91cf\u4e0a IVF\u3001PQ\u3001HNSW \u7684\u53ec\u56de\u4e0e\u5ef6\u8fdf\u5b9e\u6d4b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u624b\u91cc\u6709 10 \u4e07\u6761 128 \u7ef4\u5411\u91cf\u3001\u673a\u5668\u53ea\u6709 2 \u6838\u7684\u65f6\u5019&#xff0c;Faiss \u91cc\u6700\u5148\u8be5\u8bd5\u7684\u4e0d\u662f HNSW&#xff0c;\u800c\u662f\u5012\u6392\u8868\u4e0d\u52a0\u538b\u7f29\u7684 IVF&#xff1a;nprobe16 \u5c31\u80fd\u628a\u53ec\u56de\u505a\u5230\u548c\u66b4\u529b\u68c0\u7d22\u4e00\u6837&#xff08;1.000&#xff09;&#xff0c;\u5355\u6761\u67e5\u8be2\u4ece 0.452 ms \u6389\u5230 0.195 ms\u3002HNSW \u66f4\u5feb&#xff0c;0.031 ms \u62ff\u5230 0.998 \u7684\u53ec\u56de&#xff0c;\u4ee3\u4ef7\u662f\u7d22\u5f15\u4f53\u79ef\u53d8\u6210\u539f\u59cb\u5411\u91cf\u7684 1.53 \u500d\u3001\u5165\u5e93 2.93 \u79d2","og_url":"https:\/\/www.wsisp.com\/helps\/113859.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-10-07T11:17:40+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261007111737-6ac62a51e7c27.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"3 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/113859.html","url":"https:\/\/www.wsisp.com\/helps\/113859.html","name":"Faiss \u7d22\u5f15\u600e\u4e48\u9009\uff1a10 \u4e07\u6761 128 \u7ef4\u5411\u91cf\u4e0a IVF\u3001PQ\u3001HNSW \u7684\u53ec\u56de\u4e0e\u5ef6\u8fdf\u5b9e\u6d4b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-10-07T11:17:40+00:00","dateModified":"2026-10-07T11:17:40+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/113859.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/113859.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/113859.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"Faiss \u7d22\u5f15\u600e\u4e48\u9009\uff1a10 \u4e07\u6761 128 \u7ef4\u5411\u91cf\u4e0a IVF\u3001PQ\u3001HNSW \u7684\u53ec\u56de\u4e0e\u5ef6\u8fdf\u5b9e\u6d4b"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/113859","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=113859"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/113859\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/113855"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=113859"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=113859"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=113859"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=113859"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}