Feature Extraction
Feature Extraction
- features_json
Feature Extraction turns a piece of text into a vector - the numeric fingerprint a language model uses to represent meaning. It's the text twin of the pack's image feature node, and it's the primitive behind embeddings, semantic search, and sentence similarity. Inside a ComfyUI graph it's the bridge from text into vector space, which makes it the kind of node you reach for when you want to compare, cluster, or retrieve text programmatically rather than just read it.
The default model is sentence-transformers/all-MiniLM-L6-v2 - the community's go-to small embedding model, a 6-layer MiniLM that compresses sentences into 384-dimensional vectors. It's fast, tiny, and good enough for most similarity work. The node runs the feature-extraction pipeline from Hugging Face and returns the result.
The inputs and output
- text - the string to embed, multiline.
- model_name - Hub model ID as a string, default
sentence-transformers/all-MiniLM-L6-v2.
The single output, features_json, is a STRING containing JSON with two fields: shape (for this model, typically [tokens, 384] - one vector per token, not a single sentence vector) and features_preview (the first few rows of the first token's vector, truncated). Note what's not there: no single pooled "sentence embedding" output. You get the per-token vectors in JSON form.
How to install it
Standard pack install - ComfyUI Manager (search "ComfyUI-Transformers") or:
cd ComfyUI/custom_nodes
git clone https://github.com/kadirnar/ComfyUI-Transformers
Restart ComfyUI. MiniLM is a ~90MB download on first use, and the pack's requirements.txt covers the stack.
Where people get burned
The output shape is the trap. For similarity work you almost always want one vector per sentence - a mean-pooled embedding - and this node hands you per-token vectors as JSON text instead. You can mean-pool them yourself by parsing the JSON, but there's no node in the pack to do it for you. For "get a sentence vector I can compare," a dedicated embedding node will save you the plumbing. Where this one genuinely helps is inspecting what an embedding model produces - shape, scale, and a preview - before you commit to a vector pipeline. It's a window into the embedding, not a finished similarity tool.
Inputs (2)
| Name | Type | Default | Description |
|---|---|---|---|
| text | STRING | — | |
| model_name | STRING | sentence-transformers/all-MiniLM-L6-v2 | — |
Outputs (1)
| Name | Type | Description |
|---|---|---|
| features_json | STRING | — |