Exploring RWKV for Sentence Embeddings: Layer-wise Analysis and Baseline Comparison for Semantic Similarity

Xinghan Pan
2/20/2025
cs.CLcs.AI

No official code found. Best implementation: PStarH/RWKV-embedding (1 star, last commit 2025-02-21).

Abstract

This paper investigates the efficacy of RWKV, a novel language model architecture known for its linear attention mechanism, for generating sentence embeddings in a zero-shot setting. I conduct a layer-wise analysis to evaluate the semantic similarity captured by embeddings from different hidden layers of a pre-trained RWKV model. The performance is assessed on the Microsoft Research Paraphrase Corpus (MRPC) dataset using Spearman correlation and compared against a GloVe-based baseline. My results indicate that while RWKV embeddings capture some semantic relatedness, they underperform compared to the GloVe baseline in terms of Spearman correlation. I also analyze the inference time and GPU memory usage, highlighting the computational trade-offs associated with RWKV embeddings. The findings suggest that while RWKV offers potential advantages in terms of linear scaling, its zero-shot sentence embedding quality for semantic similarity tasks requires further investigation and potential task-specific fine-tuning to match or exceed simpler baselines.

View on arXivView PDF

Code Implementations(1)

Official code repo for arxiv 2502.14620: Exploring RWKV for Sentence Embeddings: Layer-wise Analysis and Baseline Comparison for Semantic Similarity

10Jupyter NotebookFeb 21, 20251 years ago

Similar Papers

Cite this paper

@article{pan2025exploring,
  title  = {Exploring RWKV for Sentence Embeddings: Layer-wise Analysis and Baseline Comparison for Semantic Similarity},
  author = {Xinghan Pan},
  year   = {2025},
  eprint = {2502.14620},
  archivePrefix = {arXiv},
  url    = {http://arxiv.org/abs/2502.14620v1}
}

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2502.14620.svg)](https://codeofpaper.com/paper/2502.14620)

Discussion