semantic search rs
1.0.0
Rust 中的 gRPC 服务器语义搜索演示
src/hnsw_index
( hnswlib-rs
) 并将其从 crate 中导入。 std::simd
距离实现( packed_simd_2
) 从给定文档中提取嵌入并构建索引并将其保存到本地磁盘。
cargo +nightly run --release --features progress --bin embedding
如果您想要量化,请将quantize
传递给参数。
cargo +nightly run --release --features progress --bin embedding quantize
构建并运行 gRPC 服务器(用于模型和搜索推理)。
make server
构建并运行 gRPC 客户端。客户端将根据给定的参数开始对服务器进行基准测试。
make client
您还可以更改参数。例如./client num_users num_requests bs k
cargo +nightly run --release --bin client 1 1000 128 10
使用给定的查询运行示例。 (必须有ag_news
数据集的内置索引)
cargo +nightly run --release --features progress --bin main " query "
AVX2
、 FMA
标志编译%延迟与 Rust 版本有点不同。在最近的版本(1.73.0 nightly)中,速度变得更慢(2.275 ms -> 3.000 ms)。
% i8 以 1.73.0 为基准。
p | 距离 | 废话 | 要求 | k | 类型 | 意思是 | p95 | p99 | p99.9 | 最大限度 | QPS |
---|---|---|---|---|---|---|---|---|---|---|---|
F32 | L2 | 1 | 10k | 10 | 全部的 | 4.833 毫秒 | 5.426 毫秒 | 6.037 毫秒 | 9.578 毫秒 | 12.411 毫秒 | 207 |
模型 | 4.507 毫秒 | 4.994 毫秒 | 5.505 毫秒 | 8.979 毫秒 | 12.094 毫秒 | ||||||
搜索 | 0.203毫秒 | 0.308毫秒 | 0.354 毫秒 | 0.449 毫秒 | 0.567 毫秒 | 4926 | |||||
32 | 1k | 10 | 全部的 | 10.403 毫秒 | 10.951 毫秒 | 11.625 毫秒 | 16.794 毫秒 | 16.794 毫秒 | 3076 | ||
模型 | 9.211 毫秒 | 9.684 毫秒 | 10.226 毫秒 | 14.796 毫秒 | 14.796 毫秒 | ||||||
搜索 | 0.981 毫秒 | 1.183 毫秒 | 1.386 毫秒 | 2.386 毫秒 | 2.386 毫秒 | 32620 | |||||
128 | 1k | 10 | 全部的 | 32.220 毫秒 | 32.602 毫秒 | 32.862 毫秒 | 33.440 毫秒 | 33.440 毫秒 | 3973 | ||
模型 | 29.120 毫秒 | 29.411 毫秒 | 29.653 毫秒 | 30.333 毫秒 | 30.333 毫秒 | ||||||
搜索 | 2.855 毫秒 | 3.007 毫秒 | 3.154 毫秒 | 3.452 毫秒 | 3.452 毫秒 | 44834 | |||||
科斯 | 128 | 1k | 10 | 全部的 | 31.547 毫秒 | 31.890 毫秒 | 32.087 毫秒 | 33.479 毫秒 | 33.479 毫秒 | 4128 | |
模型 | 28.992 毫秒 | 29.229 毫秒 | 29.438 毫秒 | 30.936 毫秒 | 30.936 毫秒 | ||||||
搜索 | 2.275 毫秒 | 2.444 毫秒 | 2.595 毫秒 | 2.722 毫秒 | 2.722 毫秒 | 56264 | |||||
i8 | 科斯 | 128 | 1k | 10 | 全部的 | 30.896 毫秒 | 31.271 毫秒 | 31.483 毫秒 | 31.786 毫秒 | 31.786 毫秒 | 4142 |
模型 | 28.816 毫秒 | 29.123 毫秒 | 29.286 毫秒 | 29.598 毫秒 | 29.598 毫秒 | 4442 | |||||
搜索 | 1.764 毫秒 | 1.934 毫秒 | 2.006 毫秒 | 2.308 毫秒 | 2.308 毫秒 | 72560 |
p | 距离 | 废话 | 要求 | k | 意思是 | p50 | p95 | p99 | p99.9 | 最大限度 | QPS |
---|---|---|---|---|---|---|---|---|---|---|---|
F32 | 因斯 | 1024 | 2k | 10 | 10.969 毫秒 | 10.856 毫秒 | 12.078 毫秒 | 12.384 毫秒 | 14.817 毫秒 | 18.024 毫秒 | 93354 |
2048 | 2k | 10 | 21.829 毫秒 | 21.617 毫秒 | 23.952 毫秒 | 24.514 毫秒 | 25.892 毫秒 | 26.171 毫秒 | 93820 | ||
4096 | 2k | 10 | 43.538 毫秒 | 43.199 毫秒 | 46.303 毫秒 | 48.374 毫秒 | 50.194 毫秒 | 57.159 毫秒 | 94079 | ||
8192 | 2k | 10 | 86.234 毫秒 | 85.684 毫秒 | 90.645 毫秒 | 93.850 毫秒 | 101.188 毫秒 | 102.607 毫秒 | 94997 | ||
i8 | 因斯 | 1024 | 2k | 10 | 9.102 毫秒 | 9.022 毫秒 | 10.043 毫秒 | 10.222 毫秒 | 11.297 毫秒 | 11.602 毫秒 | 112506 |
2048 | 2k | 10 | 18.084 毫秒 | 17.867 毫秒 | 19.799 毫秒 | 20.548 毫秒 | 22.749 毫秒 | 29.330 毫秒 | 113249 | ||
4096 | 2k | 10 | 35.772 毫秒 | 35.488 毫秒 | 38.246 毫秒 | 40.089 毫秒 | 41.745 毫秒 | 43.144 毫秒 | 114503 | ||
8192 | 2k | 10 | 71.447 毫秒 | 70.790 毫秒 | 76.420 毫秒 | 78.610 毫秒 | 94.783 毫秒 | 122.490 毫秒 | 114659 |
p | 距离 | 废话 | 要求 | k | 意思是 | p50 | p95 | p99 | p99.9 | 最大限度 | QPS |
---|---|---|---|---|---|---|---|---|---|---|---|
F32 | 因斯 | 1024 | 2k | 10 | 9.459 毫秒 | 9.033 毫秒 | 11.412 毫秒 | 11.842 毫秒 | 12.753 毫秒 | 12.819 毫秒 | 108252 |
2048 | 2k | 10 | 19.620 毫秒 | 19.708 毫秒 | 21.072 毫秒 | 22.023 毫秒 | 24.704 毫秒 | 24.881 毫秒 | 104383 | ||
4096 | 2k | 10 | 38.269 毫秒 | 38.237 毫秒 | 40.505 毫秒 | 42.475 毫秒 | 45.439 毫秒 | 45.691 毫秒 | 107030 | ||
8192 | 2k | 10 | 75.385 毫秒 | 74.877 毫秒 | 80.448 毫秒 | 84.589 毫秒 | 89.629 毫秒 | 89.887 毫秒 | 108668 | ||
i8 | 因斯 | 1024 | 2k | 10 | 7.003 毫秒 | 6.700 毫秒 | 8.270 毫秒 | 8.668 毫秒 | 9.655 毫秒 | 10.011 毫秒 | 146223 |
2048 | 2k | 10 | 14.388 毫秒 | 14.419 毫秒 | 15.637 毫秒 | 16.067 毫秒 | 19.237 毫秒 | 20.231 毫秒 | 142341 | ||
4096 | 2k | 10 | 27.894 毫秒 | 27.815 毫秒 | 29.818 毫秒 | 31.213 毫秒 | 39.733 毫秒 | 40.387 毫秒 | 146842 | ||
8192 | 2k | 10 | 54.674 毫秒 | 54.348 毫秒 | 57.844 毫秒 | 61.486 毫秒 | 100.327 毫秒 | 135.911 毫秒 | 149834 |
Asia shares drift lower as investors factor in Fed rate hike.
余弦距离
top 1 | id : 92048, dist : 0.3335874
Asian Shares Lower as Oil Fall Stalls SINGAPORE (Reuters) - Asian share markets saw light selling in line with a slowing retreat in oil prices on Tuesday, while the dollar steadied as officials in Europe and Japan fretted about the U.S. currency's recent decline.
top 2 | id : 65687, dist : 0.38142937
Asian Shares Lower on Earnings, Steel SINGAPORE (Reuters) - Asian share markets staged a broad-based retreat on Wednesday, led by steelmakers amid warnings of price declines, but also enveloping technology and financial stocks on worries that earnings may disappoint.
top 3 | id : 15361, dist : 0.39869058
Asian Stocks Mostly Lower on Tech Worries SINGAPORE (Reuters) - Asian shares were mostly lower on Tuesday, pulled down by technology stocks following worries about a sales forecast from bellwether Intel Corp. and unexpectedly flat industrial output in Japan.
top 4 | id : 63234, dist : 0.40184337
Asian Stocks Slip as Oil Moves Above $55 Asian share markets fell on Monday after oil hit a record above $55 a barrel, with investors cautious ahead of earnings reports from bellwether firms IBM and Texas Instruments later in the day.
top 5 | id : 76590, dist : 0.4137212
Asian Stocks Ease After China Rate Rise SINGAPORE (Reuters) - China's surprise interest rate rise weighed down Asian stocks on Friday as investors sold shares of miners, shippers and other firms whose fortunes have been closely linked to the country's rapid growth.
top 6 | id : 65572, dist : 0.4192986
Asian Shares Lower on Earnings SINGAPORE (Reuters) - Asian share markets slumped on Wednesday, led by South Korea's POSCO Co. Ltd. and other steelmakers amid warnings of a drop in prices, and as investors worried that third-quarter earnings may disappoint.
top 7 | id : 14210, dist : 0.41932273
Asian Stocks Mostly Flat to Lower SINGAPORE (Reuters) - Asian shares were mostly flat to lower on Monday as investors kept a wary eye on stabilizing oil prices and looked past signs Japanese consumers were beginning to spend more freely.
top 8 | id : 14904, dist : 0.4203742
European Shares Drift Down in Thin Trade European stocks were slightly lower by mid-day in holiday-hit trading on Monday, with crude oil rises weighing on shares, though Sanofi-Aventis gained on the result of trials of an anti-obesity drug.
top 9 | id : 76632, dist : 0.4244548
Asian Stocks Ease After China Rate Rise (Reuters) Reuters - China's surprise interest rate riseweighed down Asian stocks on Friday as investors sold shares ofminers, shippers and other firms whose fortunes have beenclosely linked to the country's rapid growth.
top 10 | id : 15265, dist : 0.42584515
Asian Stocks Mostly Lower on Tech Worries (Reuters) Reuters - Asian shares were mostly lower onTuesday, pulled down by technology stocks following worriesabout a sales forecast from bellwether Intel Corp. andunexpectedly flat industrial output in Japan.
L2距离
top 1 | id : 92048, dist : 0.667175
Asian Shares Lower as Oil Fall Stalls SINGAPORE (Reuters) - Asian share markets saw light selling in line with a slowing retreat in oil prices on Tuesday, while the dollar steadied as officials in Europe and Japan fretted about the U.S. currency's recent decline.
top 2 | id : 65687, dist : 0.76285875
Asian Shares Lower on Earnings, Steel SINGAPORE (Reuters) - Asian share markets staged a broad-based retreat on Wednesday, led by steelmakers amid warnings of price declines, but also enveloping technology and financial stocks on worries that earnings may disappoint.
top 3 | id : 15361, dist : 0.7973814
Asian Stocks Mostly Lower on Tech Worries SINGAPORE (Reuters) - Asian shares were mostly lower on Tuesday, pulled down by technology stocks following worries about a sales forecast from bellwether Intel Corp. and unexpectedly flat industrial output in Japan.
top 4 | id : 63234, dist : 0.80368686
Asian Stocks Slip as Oil Moves Above $55 Asian share markets fell on Monday after oil hit a record above $55 a barrel, with investors cautious ahead of earnings reports from bellwether firms IBM and Texas Instruments later in the day.
top 5 | id : 76590, dist : 0.82744247
Asian Stocks Ease After China Rate Rise SINGAPORE (Reuters) - China's surprise interest rate rise weighed down Asian stocks on Friday as investors sold shares of miners, shippers and other firms whose fortunes have been closely linked to the country's rapid growth.
top 6 | id : 65572, dist : 0.83859724
Asian Shares Lower on Earnings SINGAPORE (Reuters) - Asian share markets slumped on Wednesday, led by South Korea's POSCO Co. Ltd. and other steelmakers amid warnings of a drop in prices, and as investors worried that third-quarter earnings may disappoint.
top 7 | id : 14210, dist : 0.83864534
Asian Stocks Mostly Flat to Lower SINGAPORE (Reuters) - Asian shares were mostly flat to lower on Monday as investors kept a wary eye on stabilizing oil prices and looked past signs Japanese consumers were beginning to spend more freely.
top 8 | id : 14904, dist : 0.8407483
European Shares Drift Down in Thin Trade European stocks were slightly lower by mid-day in holiday-hit trading on Monday, with crude oil rises weighing on shares, though Sanofi-Aventis gained on the result of trials of an anti-obesity drug.
top 9 | id : 77269, dist : 0.84736
Asian Markets Mixed on China Rate Hike (AP) AP - Asian financial markets showed a mixed reaction Friday to China's first interest rate rise in nine years, which analysts welcomed as a shift toward capitalist-style economic tools and away from central planning.
top 10 | id : 76632, dist : 0.8489096
Asian Stocks Ease After China Rate Rise (Reuters) Reuters - China's surprise interest rate riseweighed down Asian stocks on Friday as investors sold shares ofminers, shippers and other firms whose fortunes have beenclosely linked to the country's rapid growth.
带 i8 的余弦距离(未缩放)
top 1 | id : 70945, dist : 8807
Asian Shares Fall on Dollar; Gold, Oil Up (Reuters) Reuters - The U.S. dollar stumbled on Monday,setting multi-month lows against the yen and euro and tradingaround four-year lows against the Korean won and Singaporedollar, prompting investors to clip Asian share markets.
top 2 | id : 33140, dist : 10982
US Stock-Index Futures Decline; Citigroup, GE Slip in Europe US stock-index futures declined. Dow Jones Industrial Average shares including General Electric Co. slipped in Europe. Citigroup Inc.
top 3 | id : 33077, dist : 11208
US Stock-Index Futures Are Little Changed; Citigroup, GE Slip US stock-index futures were little changed. Dow Jones Industrial Average shares including General Electric Co. slipped in Europe. Citigroup Inc.
top 4 | id : 95897, dist : 11290
Red hot Google shares cooling Google Inc. may be subject to the law of gravity, after all. Its shares, which more than doubled in the two months after the company's Aug. 19 initial public offering and traded as high as $201.60 on Nov. 3, have slipped about 17 percent over the past two weeks. They closed at $167.54 yesterday, down 2.88 percent for the day, ...
top 5 | id : 40354, dist : 11390
Tokyo stocks open slightly lower TOKYO - Stocks opened slightly lower Monday on the Tokyo Stock Exchange as declines in US technology shares last Friday prompted selling.
top 6 | id : 64025, dist : 12241
E*Trade Profit Rises as Expenses Drop (Reuters) Reuters - E*Trade Financial Corp. , anonline bank and brokerage, on Monday said its third-quarterprofit rose as lower expenses offset a drop in net revenue.
top 7 | id : 58035, dist : 12458
UK inflation rate fall continues The UK's inflation rate fell in September, thanks in part to a fall in the price of airfares, increasing the chance that interest rates will be kept on hold.
top 8 | id : 65573, dist : 12583
Yen Eases Against Dollar TOKYO (Reuters) - The yen edged down against the dollar on Wednesday as Japanese stock prices slid, but it remained within striking distance of three-month highs on persistent concerns about the health of the U.S. economy.
top 9 | id : 50470, dist : 12828
Tower Auto Sees Wider Loss, Shares Fall CHICAGO (Reuters) - Auto parts maker Tower Automotive Inc. <A HREF="http://www.investor.reuters.com/FullQuote.aspx?ticker=TWR.N target=/stocks/quickinfo/fullquote">TWR.N</A> said on Tuesday its third-quarter loss would be twice as deep as previously expected because of lower vehicle production in North America and higher steel costs.
top 10 | id : 1267, dist : 13020
Study: Global Warming Could Change Calif. (AP) AP - Global warming could cause dramatically hotter summers and a depleted snow pack in California, leading to a sharp increase in heat-related deaths and jeopardizing the water supply, according to a study released Monday.
@kozistr