Skip to content
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

feat: add support to sparse vectors #292

Open
mhordynski opened this issue Jan 21, 2025 · 3 comments
Open

feat: add support to sparse vectors #292

mhordynski opened this issue Jan 21, 2025 · 3 comments
Assignees
Labels
feature New feature or request

Comments

@mhordynski
Copy link
Member

Feature description

Goal of this task is to add support to calculate sparse vectors from text in ragbits.

Motivation

Sparse vectors will be important part in hybrid search approaches.

Additional context

No response

@mhordynski mhordynski added the feature New feature or request label Jan 21, 2025
@mhordynski mhordynski moved this to In Progress in ragbits Jan 22, 2025
@mhordynski mhordynski added this to the 9 / Hybrid Search milestone Jan 22, 2025
@nczerep
Copy link
Collaborator

nczerep commented Jan 22, 2025

@ludwiktrammer Podejście zaproponowane przez @kdziedzic68

  1. stworzenie modelu albo dataclassy (możnaby się ew. pokusić o implementacje jakiejś arytmetyki miedzy tymi wektorami) SparseVector z polami:
    non_zero_dims - list[int] pozycje na którcyh wektor jest różny od 0
    non_zero_vals - list[float] - wartości na tych pozycjach
    dim - wymiar wektora
  2. zdefiniowanie interfejsu SparseEmbedding - podobnego do istniejącego Embedding tą różnicą że zamiast list[list[float]] zwracamy list[SparseVector]
  3. przykladowa prosta implementacja takiego interfejsu - proponowałbym na początek jakiś BagOfTokens - zapuszczamy po prostu tokenizacje i id-kami są id-ki tokenow, wartosciami liczba ich wystąpień w tekscie, a wymiarem liczba tokenów w słowniku

@nczerep
Copy link
Collaborator

nczerep commented Jan 22, 2025

Więc w sumie ten sparse vector tez bylyby w ragbits core/ embeddings ? @kdziedzic68?

@kdziedzic68
Copy link
Collaborator

Więc w sumie ten sparse vector tez bylyby w ragbits core/ embeddings ? @kdziedzic68?

tak myślałem

@kdziedzic68 kdziedzic68 moved this from In Progress to In review in ragbits Jan 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
Status: In review
Development

No branches or pull requests

3 participants