demonstração de pesquisa semântica com servidor gRPC em Rust
src/hnsw_index
( hnswlib-rs
) deste projeto e importe-o da caixa. std::simd
( packed_simd_2
) Extraia embeddings dos documentos fornecidos e crie e salve um índice no disco local.
cargo +nightly run --release --features progress --bin embedding
Se você quiser uma quantização, passe quantize
para o argumento.
cargo +nightly run --release --features progress --bin embedding quantize
Construa e execute o servidor gRPC (para inferência de modelo e pesquisa).
make server
Crie e execute o cliente gRPC. O cliente começará a avaliar o servidor com base nos parâmetros fornecidos.
make client
Você também pode alterar os argumentos. por exemplo ./client num_users num_requests bs k
cargo +nightly run --release --bin client 1 1000 128 10
Execute um exemplo com a consulta fornecida. (deve haver um índice construído com o conjunto de dados ag_news
)
cargo +nightly run --release --features progress --bin main " query "
AVX2
FMA
% de latência é um pouco diferente da versão Rust. Na versão recente (1.73.0 noturna), a velocidade fica mais lenta (2.275 ms -> 3.000 ms).
% i8 é avaliado com 1.73.0.
p | distância | besteira | requisitos | k | tipo | significar | pág.95 | p99 | p99.9 | máx. | QPS |
---|---|---|---|---|---|---|---|---|---|---|---|
f32 | L2 | 1 | 10k | 10 | total | 4,833ms | 5,426ms | 6,037ms | 9,578ms | 12,411ms | 207 |
modelo | 4,507ms | 4,994ms | 5,505ms | 8,979ms | 12,094ms | ||||||
procurar | 0,203ms | 0,308ms | 0,354ms | 0,449ms | 0,567ms | 4926 | |||||
32 | 1k | 10 | total | 10,403ms | 10,951ms | 11,625ms | 16,794ms | 16,794ms | 3076 | ||
modelo | 9,211ms | 9,684ms | 10,226ms | 14,796ms | 14,796ms | ||||||
procurar | 0,981ms | 1,183ms | 1,386ms | 2,386ms | 2,386ms | 32620 | |||||
128 | 1k | 10 | total | 32,220ms | 32,602ms | 32,862ms | 33,440ms | 33,440ms | 3973 | ||
modelo | 29,120ms | 29,411ms | 29,653ms | 30,333ms | 30,333ms | ||||||
procurar | 2,855ms | 3,007ms | 3,154ms | 3,452ms | 3,452ms | 44834 | |||||
Porque | 128 | 1k | 10 | total | 31,547ms | 31,890ms | 32,087ms | 33,479ms | 33,479ms | 4128 | |
modelo | 28,992ms | 29,229ms | 29,438ms | 30,936ms | 30,936ms | ||||||
procurar | 2,275ms | 2,444ms | 2,595ms | 2,722ms | 2,722ms | 56264 | |||||
i8 | Porque | 128 | 1k | 10 | total | 30,896ms | 31,271ms | 31,483ms | 31,786ms | 31,786ms | 4142 |
modelo | 28,816ms | 29,123ms | 29,286ms | 29,598ms | 29,598ms | 4442 | |||||
procurar | 1,764ms | 1,934ms | 2,006ms | 2,308ms | 2,308ms | 72560 |
p | distância | besteira | requisitos | k | significar | p50 | pág.95 | p99 | p99.9 | máx. | QPS |
---|---|---|---|---|---|---|---|---|---|---|---|
f32 | porque | 1024 | 2k | 10 | 10,969ms | 10,856ms | 12,078ms | 12,384ms | 14,817ms | 18,024ms | 93354 |
2048 | 2k | 10 | 21,829ms | 21,617ms | 23,952ms | 24,514ms | 25,892ms | 26,171ms | 93820 | ||
4096 | 2k | 10 | 43,538ms | 43,199ms | 46,303ms | 48,374ms | 50,194ms | 57,159ms | 94079 | ||
8192 | 2k | 10 | 86,234ms | 85,684ms | 90,645ms | 93,850ms | 101,188ms | 102,607ms | 94997 | ||
i8 | porque | 1024 | 2k | 10 | 9,102ms | 9,022ms | 10,043ms | 10,222ms | 11,297ms | 11,602ms | 112506 |
2048 | 2k | 10 | 18,084ms | 17,867ms | 19,799ms | 20,548ms | 22,749ms | 29,330ms | 113249 | ||
4096 | 2k | 10 | 35,772ms | 35,488ms | 38,246ms | 40,089ms | 41,745ms | 43,144ms | 114503 | ||
8192 | 2k | 10 | 71,447ms | 70,790ms | 76,420ms | 78,610ms | 94,783ms | 122,490ms | 114659 |
p | distância | besteira | requisitos | k | significar | p50 | pág.95 | p99 | p99.9 | máx. | QPS |
---|---|---|---|---|---|---|---|---|---|---|---|
f32 | porque | 1024 | 2k | 10 | 9,459ms | 9,033ms | 11,412ms | 11,842ms | 12,753ms | 12,819ms | 108252 |
2048 | 2k | 10 | 19,620ms | 19,708ms | 21,072ms | 22,023ms | 24,704ms | 24,881ms | 104383 | ||
4096 | 2k | 10 | 38,269ms | 38,237ms | 40,505ms | 42,475ms | 45,439ms | 45,691ms | 107030 | ||
8192 | 2k | 10 | 75,385ms | 74,877ms | 80,448ms | 84,589ms | 89,629ms | 89,887ms | 108668 | ||
i8 | porque | 1024 | 2k | 10 | 7,003ms | 6.700ms | 8,270ms | 8,668ms | 9,655ms | 10,011ms | 146223 |
2048 | 2k | 10 | 14,388ms | 14,419ms | 15,637ms | 16,067ms | 19,237ms | 20,231ms | 142341 | ||
4096 | 2k | 10 | 27,894ms | 27,815ms | 29,818ms | 31,213ms | 39,733ms | 40,387ms | 146842 | ||
8192 | 2k | 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.
Distância cosseno
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.
Distância 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.
Distância do cosseno com i8 (sem escala)
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