sfa_embedding_bank: Use a Pre-Generated Embedding Bank as an Embedder

View source: R/bank.R

sfa_embedding_bankR Documentation

Use a Pre-Generated Embedding Bank as an Embedder

Description

Turns an "sfa_bank" (or a path to one) into a lookup function that sfa_coverage() and sfa_embed() accept as their embed argument, so audits run entirely from published embeddings - no encoder loads.

Usage

sfa_embedding_bank(bank)

Arguments

bank

An "sfa_bank" from sfa_build_bank(), or a path to one.

Details

A lookup miss is an error, not a fallback: the bank must contain every item, definition, and planned narrowing the audit touches. The error lists what is missing so the bank can be rebuilt to include it.

Value

A function (texts) -> matrix, for use as ⁠embed = ⁠.

Examples

## Not run: 
bank <- sfa_embedding_bank("bank_qwen8b.rds")
region <- sfa_load_region("regions_qwen8b/procrastination.rds")
audit <- sfa_coverage(my_items, region, embed = bank,
                      model = region$encoder)

## End(Not run)

semanticfa documentation built on Sept. 2, 2026, 1:07 a.m.