-
Notifications
You must be signed in to change notification settings - Fork 7
Quantization Config support #126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -79,4 +79,40 @@ | |
| */ | ||
| boolean multithreading() default false; | ||
|
|
||
| /** | ||
| * Optional quantization configuration for HNSW index. | ||
| * | ||
| * <p>When {@code quantizationConfig.quantizationType} is empty, the whole block is ignored. | ||
| * | ||
| * <p>Currently supported type: {@code scalar_quantization_8_bit}. | ||
| */ | ||
| QuantizationConfig quantizationConfig() default @QuantizationConfig; | ||
|
|
||
| /** | ||
| * Nested annotation representing {@code quantization_config} block. | ||
| */ | ||
| @interface QuantizationConfig { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Как вариант - вынести в отдельный класс. Также, возможно, немного поменял бы имена. Правда, тогда будет рассинхрон с HnswConfig, а тот менять нельзя, т.к. имена полей сериализуются для RX. Пожалуй, пусть остается единообразно.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ну на ваше усмотрение) как будто перекладка в HSNWConfig в src/main/java/ru/rt/restream/reindexer/vector/HnswConfigs.java позволяет использовать другие имена в аннотации. Так что, как удобнее. |
||
| /** | ||
| * Quantization type. | ||
| * | ||
| * <p>Currently supported: {@code scalar_quantization_8_bit}. | ||
| */ | ||
| String quantizationType() default ""; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Если в будущем число вариантов квантизации будет больше одного, но останется небольшим - может, сразу сделать enum? Как Metric. Чтобы нельзя было присвоить неподходящее значение? Хотя, конечно, при расширении списка потребуется модификация кода коннектора, что неудобно... Если это единственный вариант, и в будущем останется единственным - может, сделать булевым полем? isScalarQuantization8bit.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ну у нас пока планов нет на добавление нового типа квантования. В ядре проверка захардкожена на строку "scalar_quantization_8_bit". Главное, что если в этом поле что-то приходит, то именно это значение. Так что, опять же, как удобнее
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. bool точно не стоит, так как в перспективе их будет несколько |
||
|
|
||
| /** | ||
| * Quantile for scalar quantization. | ||
| */ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Добавить бы в доку допустимые значения.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ну, разве что вот в таком виде, возможно урезанном: |
||
| float quantile() default -1.0f; | ||
|
|
||
| /** | ||
| * Sample size for estimating quantile(s). | ||
| */ | ||
| int sampleSize() default 20_000; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Допустимые значения? Отрицательное можно?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. целые знаковые, от 1 до UINT64_MAX |
||
|
|
||
| /** | ||
| * Minimal number of points in the index required to enable quantization. | ||
| */ | ||
| int quantizationThreshold() default 100_000; | ||
| } | ||
|
|
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| /* | ||
| * Copyright 2020 Restream | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| package ru.rt.restream.reindexer.connector; | ||
|
|
||
| import ru.rt.restream.category.BuiltinTest; | ||
|
|
||
| @BuiltinTest | ||
| public class BuiltinHnswQuantizationConfigUpdateTest extends HnswQuantizationConfigUpdateTest { | ||
| } | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| /* | ||
| * Copyright 2020 Restream | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| package ru.rt.restream.reindexer.connector; | ||
|
|
||
| import ru.rt.restream.category.CprotoTest; | ||
|
|
||
| @CprotoTest | ||
| public class CprotoHnswQuantizationConfigUpdateTest extends HnswQuantizationConfigUpdateTest { | ||
| } | ||
|
|
Uh oh!
There was an error while loading. Please reload this page.