Files
ik_llama.cpp/examples/retrieval/README.md
T
NexesenexandGitHub f8b5664c18 Chores : Typos fixing round 3 (project wide, ggml dir included, comments and user facing msg only) (#2249)
* ggml: fix typos in comments across ggml/src

Corrects misspellings found in source comments (no code/logic changes):

CUDA:
- quantize.cu / quantize_id.cu: 'memroy' -> 'memory', stray 'Exchange' word in reduction comment
- fattn-mma-f16.cuh / fattn-new-mma.cu: 'synchonization' -> 'synchronization'
- fattn-new-mma.cu / fattn-vec-common.cuh: 'at lease' -> 'at least'
- fattn-vec-f32.cuh: 'Currenlty'/'dose' -> 'Currently'/'does'
- mmq_id_common.cuh: 'alays' -> 'always'
- softmax.cu: 'noncontigous' -> 'noncontiguous'

CPU / quantization:
- ggml-quants.c: 'At leat' -> 'At least'
- ggml.c: 'repeatition' -> 'repetition'

CANN:
- aclnn_ops.cpp: 'alloced' -> 'allocated', 'contigous' -> 'contiguous'
- kernels/dup.cpp: 'contigous' -> 'contiguous'

IQK:
- iqk_gemm_1bit.cpp: 'explicitely' -> 'explicitly'
- iqk_gemm_ktquants.cpp: 'nn AVX2' -> 'in AVX2'

Vulkan:
- ggml-vulkan.cpp: duplicated 'in in' -> 'in'

* ggml: fix less-common typos in comments (spellchecker pass)

Second sweep using a spell-check pass with edit-distance filtering to catch
typos missed by the common-misspelling list. Comment/comment-context fixes
only, no code changes:

- aclnn_ops.cpp: 'performace' -> 'performance'
- acl_tensor.cpp: 'shoule in' -> 'should be in'
- common.h: 'opertors'/'available' -> 'operators'/'available'
- ggml-cuda.cu: 'resepctive' -> 'respective', 'resinding' -> 'residing'
- conv2d.cu: 'ouptut_chanles' -> 'output_channels'
- scale.cu: 'Whehn' -> 'When'
- mmq_id_common.cuh: 'renameing' -> 'renaming'
- solve_tri.cu: 'supress' -> 'suppress'
- ggml-quants.c: 'ptoducts' -> 'products', 'quckly' -> 'quickly',
  'Acummulate' -> 'Accumulate'
- ggml-sycl.cpp: 'solutino'/'walkaroud' -> 'solution'/'workaround'
- ggml-vulkan.cpp: 'aross' -> 'across'
- ggml.c unified base: signficantly -> significantly (recorded in iqk too)

Also fixed duplicate word 'get get' in the quckly comments (line 14272/14488).

* Fix typo: correct hard-to-count words in comments/docs across common/examples

Spellcheckedtypos across common/, examples/, tests/ and include/ (from
typos2.txt): preserve->preserving, replacement->replacemnt,
enhance->enchance, imatrix/ima->imatrix, correct->corerct,
parameter->parmeter, utilizing->utilitizing, backward->backwrad,
manipulate->manupulate, together->togather, incomplete->parial,
sentence->dentence, retrieval->retie, prepared->prepa, partial->parial,
randomly->Randonly. Comment/prose only, no code changes.

* fixing typos (public_simplechat example)

* fixing typos (examples subdirs)
2026-08-04 07:15:28 +03:00

2.1 KiB

llama.cpp/examples/retrieval

Demonstration of simple retrieval technique based on cosine similarity

More info: https://github.com/ggerganov/llama.cpp/pull/6193

How to use

retrieval.cpp has parameters of its own:

  • --context-file: file to be embedded - state this option multiple times to embed multiple files
  • --chunk-size: minimum size of each text chunk to be embedded
  • --chunk-separator: STRING to divide chunks by. newline by default

retrieval example can be tested as follows:

make -j && ./llama-retrieval --model ./models/bge-base-en-v1.5-f16.gguf --top-k 3 --context-file README.md --context-file License --chunk-size 100 --chunk-separator .

This chunks and embeds all given files and starts a loop requesting query inputs:

Enter query:

On each query input, top k chunks are shown along with file name, chunk position within file and original text:

Enter query: describe the mit license
batch_decode: n_tokens = 6, n_seq = 1
Top 3 similar chunks:
filename: README.md
filepos: 119
similarity: 0.762334
textdata:
png)

[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/licenses/MIT)

[Roadmap](https://github.
--------------------
filename: License
filepos: 0
similarity: 0.725146
textdata:
MIT License

Copyright (c) 2023 Georgi Gerganov

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
--------------------
filename: README.md
filepos: 9178
similarity: 0.621722
textdata:
com/cztomsik/ava) (MIT)
- [ptsochantaris/emeltal](https://github.com/ptsochantaris/emeltal)
- [pythops/tenere](https://github.
--------------------