Skip to content

feat: Integrate Flock Extension#6

Open
brandonzhou2002 wants to merge 2 commits into
castorini:mainfrom
brandonzhou2002:flock-integration
Open

feat: Integrate Flock Extension#6
brandonzhou2002 wants to merge 2 commits into
castorini:mainfrom
brandonzhou2002:flock-integration

Conversation

@brandonzhou2002

@brandonzhou2002 brandonzhou2002 commented Nov 9, 2025

Copy link
Copy Markdown
Contributor

This PR integrates Flock into the repo for dense retrieval, and adds a walkthrough markdown file to run the dense retrieval with Flock using Ollama local server.

Running process and time
image

@brandonzhou2002

Copy link
Copy Markdown
Contributor Author

Hey @lilyjge, please take a look at this PR when you get a chance. Thanks!

cc: @lintool

@brandonzhou2002 brandonzhou2002 changed the title feat: integrate Flock extension feat: Integrate Flock Extension Nov 9, 2025
Comment thread docs/usage-dense-flock.md
@@ -0,0 +1,111 @@
# QuackIR: Dense Retrieval with Flock + Ollama

This short guide shows how to run a minimal dense-retrieval pipeline with the Flock extension and a local Ollama embedding model.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you please add a brief description of what the Flock extension is? maybe with a link? same for ollama. let's assume the reader has no background knowledge except for the previous guides

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for sure. added

Comment thread docs/usage-dense-flock.md Outdated

The `ollama serve &` command starts the Ollama server in the background.
The environment variables control concurrency and memory usage.
If you encounter `server busy, please try again. maximum pending requests exceeded` error while running the script, consider increasing the `OLLAMA_MAX_QUEUE` value, or reducing the `batch_size` parameter in the `options_json` field when registering the model.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what do you mean by "registering the model"? perhaps link to a dedicated ollama guide for ollama specific setup?

Comment thread docs/usage-dense-flock.md Outdated
+ Pull an embedding model:

```bash
ollama pull embeddinggemma

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

embeddinggemma is a specific model you're using for the guide right? please clarify that so readers know they can also play around with different models following the same instructions. add a brief description/link to the model?

Comment thread docs/usage-dense-flock.md Outdated
top_k = 10

"""
2) Initialize Flock + register model alias

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh is this what "register model" refer to? maybe clarify that in the earlier text or move the message about parameters here?

Comment thread docs/usage-dense-flock.md Outdated
The `ollama serve &` command starts the Ollama server in the background.
The environment variables control concurrency and memory usage.
If you encounter `server busy, please try again. maximum pending requests exceeded` error while running the script, consider increasing the `OLLAMA_MAX_QUEUE` value, or reducing the `batch_size` parameter in the `options_json` field when registering the model.
Tune these settings based on your hardware capacity and workload.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if relevant, ie, has significant requirements for hardware, could you provide what the minimum requirements are? or something along the lines of, on this hardware setup, this is how long you would expect this process to take

Comment thread docs/usage-dense-flock.md Outdated
embedding_dim = 768
model_alias = "Embedder"
queries_file = "collections/nfcorpus/queries.tsv"
output_path = Path("runs/run.quackir.duckdb.dense.flock.nfcorpus.txt")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please include embedding model name in run file name so it's easy to find

Comment thread quackir/_base.py

class SecretProvider(Enum):
OLLAMA = 'OLLAMA'
OPENAI = 'OPENAI'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we support openai and azure llm right now? if so, mention that in the documentation? eg add brief sections on if you wanted to do this with openai or azure, here's what steps would be different

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes we do support azure and openAI but I haven't tested with them yet. I will still add a section to show how to do it!

Comment thread quackir/flock.py Outdated
)
except Exception as e:
msg = str(e)
if skip_if_exists and ("Duplicate key" in msg or "already exists" in msg):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add comment for what this does?

Comment thread docs/usage-dense-flock.md
table_name = "corpus_dense"
corpus_file = "collections/nfcorpus/quackir_corpus.jsonl"
embedding_dim = 768
model_alias = "Embedder"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does this do? add comment?

Comment thread docs/usage-dense-flock.md
searcher.close()
```

## Evaluate with trec_eval

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add the expected output score?

@brandonzhou2002 brandonzhou2002 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for reviewing @lilyjge! I've resolved the comments and lemme know if there are any questions.

Comment thread docs/usage-dense-flock.md
@@ -0,0 +1,111 @@
# QuackIR: Dense Retrieval with Flock + Ollama

This short guide shows how to run a minimal dense-retrieval pipeline with the Flock extension and a local Ollama embedding model.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for sure. added

Comment thread quackir/_base.py

class SecretProvider(Enum):
OLLAMA = 'OLLAMA'
OPENAI = 'OPENAI'

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes we do support azure and openAI but I haven't tested with them yet. I will still add a section to show how to do it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants