---
title: "Use the right task prefixes"
lesson_id: "01"
---

# Use the right task prefixes

- **Lesson ID:** 01
- **Goal:** Embed queries and documents with the prefixes the model was trained with.
- **Human lesson:** [01-use-the-right-prefixes.html](01-use-the-right-prefixes.html)

## Prerequisites

- llama.cpp installed.
- uv and Python 3.11+.

## Inputs, outputs, and artifacts

- **Inputs:** Query and document text.
- **Outputs:** 768-dimensional unit vectors.
- **Artifacts:** A prefix constants module.

## Agent build steps

1. Do the environment setup in the human lesson.
2. Start `llama-server -hf ggml-org/embeddinggemma-2-GGUF:Q8_0 --embedding --port 8094 -c 8192 -b 8192 -ub 8192 -np 1`.
3. Embed one query with curl and confirm 768 numbers with length 1.0.
4. Use the model card prefixes, not the LiteRT-LM guide table.
5. Store prefixes as constants next to the model name.

## Constraints

Keep the language simple, friendly, and literal. No quizzes, no em dashes. Brand Edge FDE only. Use small local models. Do not invent flags, endpoints, or issue numbers. 

## Key concepts

- EmbeddingGemma 2 gives 768-dimensional vectors.
- Search uses different prefixes for queries and documents.
- The LiteRT-LM guide and the model card disagree (LiteRT-LM #3929).
- The model card and its config file are the source the model was trained with.

## Takeaways

- Use `task: search result | query: ` and `title: none | text: ` for search.
- Keep prefixes in one constant next to the model name.
- Re-embed everything if a prefix changes.

## Acceptance checks

- Query prefix is `task: search result | query: `.
- Document prefix is `title: none | text: ` or `title: {title} | text: `.
- LiteRT-LM #3929 and the model card are linked.
- [ ] Proceed to [lesson 02 brief](02-number-format-and-nan.llms.md).
