semantic search rs
1.0.0
Rust의 gRPC 서버를 사용한 의미 검색 데모
src/hnsw_index
( hnswlib-rs
)를 제거하고 상자에서 가져옵니다. 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.275ms -> 3.000ms).
% i8은 1.73.0으로 벤치마킹되었습니다.
피 | 거리 | BS | 요구 사항 | 케이 | 유형 | 평균 | p95 | p99 | p99.9 | 최대 | QPS |
---|---|---|---|---|---|---|---|---|---|---|---|
f32 | L2 | 1 | 10,000 | 10 | 총 | 4.833ms | 5.426ms | 6.037ms | 9.578ms | 12.411ms | 207 |
모델 | 4.507ms | 4.994ms | 5.505ms | 8.979ms | 12.094ms | ||||||
찾다 | 0.203ms | 0.308ms | 0.354ms | 0.449ms | 0.567ms | 4926 | |||||
32 | 1천 | 10 | 총 | 10.403ms | 10.951ms | 11.625ms | 16.794ms | 16.794ms | 3076 | ||
모델 | 9.211ms | 9.684ms | 10.226ms | 14.796ms | 14.796ms | ||||||
찾다 | 0.981ms | 1.183ms | 1.386ms | 2.386ms | 2.386ms | 32620 | |||||
128 | 1천 | 10 | 총 | 32.220ms | 32.602ms | 32.862ms | 33.440ms | 33.440ms | 3973 | ||
모델 | 29.120ms | 29.411ms | 29.653ms | 30.333ms | 30.333ms | ||||||
찾다 | 2.855ms | 3.007ms | 3.154ms | 3.452ms | 3.452ms | 44834 | |||||
코사인 | 128 | 1천 | 10 | 총 | 31.547ms | 31.890ms | 32.087ms | 33.479ms | 33.479ms | 4128 | |
모델 | 28.992ms | 29.229ms | 29.438ms | 30.936ms | 30.936ms | ||||||
찾다 | 2.275ms | 2.444ms | 2.595ms | 2.722ms | 2.722ms | 56264 | |||||
i8 | 코사인 | 128 | 1천 | 10 | 총 | 30.896ms | 31.271ms | 31.483ms | 31.786ms | 31.786ms | 4142 |
모델 | 28.816ms | 29.123ms | 29.286ms | 29.598ms | 29.598ms | 4442 | |||||
찾다 | 1.764ms | 1.934ms | 2.006ms | 2.308ms | 2.308ms | 72560 |
피 | 거리 | BS | 요구 사항 | 케이 | 평균 | p50 | p95 | p99 | p99.9 | 최대 | QPS |
---|---|---|---|---|---|---|---|---|---|---|---|
f32 | 코사인 | 1024 | 2천 | 10 | 10.969ms | 10.856ms | 12.078ms | 12.384ms | 14.817ms | 18.024ms | 93354 |
2048년 | 2천 | 10 | 21.829ms | 21.617ms | 23.952ms | 24.514ms | 25.892ms | 26.171ms | 93820 | ||
4096 | 2천 | 10 | 43.538ms | 43.199ms | 46.303ms | 48.374ms | 50.194ms | 57.159ms | 94079 | ||
8192 | 2천 | 10 | 86.234ms | 85.684ms | 90.645ms | 93.850ms | 101.188ms | 102.607ms | 94997 | ||
i8 | 코사인 | 1024 | 2천 | 10 | 9.102ms | 9.022ms | 10.043ms | 10.222ms | 11.297ms | 11.602ms | 112506 |
2048년 | 2천 | 10 | 18.084ms | 17.867ms | 19.799ms | 20.548ms | 22.749ms | 29.330ms | 113249 | ||
4096 | 2천 | 10 | 35.772ms | 35.488ms | 38.246ms | 40.089ms | 41.745ms | 43.144ms | 114503 | ||
8192 | 2천 | 10 | 71.447ms | 70.790ms | 76.420ms | 78.610ms | 94.783ms | 122.490ms | 114659 |
피 | 거리 | BS | 요구 사항 | 케이 | 평균 | p50 | p95 | p99 | p99.9 | 최대 | QPS |
---|---|---|---|---|---|---|---|---|---|---|---|
f32 | 코사인 | 1024 | 2천 | 10 | 9.459ms | 9.033ms | 11.412ms | 11.842ms | 12.753ms | 12.819ms | 108252 |
2048년 | 2천 | 10 | 19.620ms | 19.708ms | 21.072ms | 22.023ms | 24.704ms | 24.881ms | 104383 | ||
4096 | 2천 | 10 | 38.269ms | 38.237ms | 40.505ms | 42.475ms | 45.439ms | 45.691ms | 107030 | ||
8192 | 2천 | 10 | 75.385ms | 74.877ms | 80.448ms | 84.589ms | 89.629ms | 89.887ms | 108668 | ||
i8 | 코사인 | 1024 | 2천 | 10 | 7.003ms | 6.700ms | 8.270ms | 8.668ms | 9.655ms | 10.011ms | 146223 |
2048년 | 2천 | 10 | 14.388ms | 14.419ms | 15.637ms | 16.067ms | 19.237ms | 20.231ms | 142341 | ||
4096 | 2천 | 10 | 27.894ms | 27.815ms | 29.818ms | 31.213ms | 39.733ms | 40.387ms | 146842 | ||
8192 | 2천 | 10 | 54.674ms | 54.348ms | 57.844ms | 61.486ms | 100.327ms | 135.911ms | 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