Source-linked AI summary

A General Framework for Producing Interpretable Semantic Text Embeddings

Yiqun Sun, Qiang Huang, Yixuan Tang, Anthony K. H. Tung, Jun Yu

arXiv:2410.03435v1cs.CLcs.AIcs.LG

TL;DR

Black-box text embeddings can perform well but are difficult to interpret, and existing question-based approaches are limited by expert input or prompt design. CQG-MBQA systematically generates discriminative yes/no questions as interpretable embedding dimensions and answers them with a multi-task model; across tasks, it performs comparably to advanced black-box models and outperforms other interpretable methods.

  • Problem

    Black-box embeddings are difficult to interpret, while expert-crafted or prompt-based question generation can limit generalizability and question discrimination across tasks.

    Source: §1 · pp. 1–2
  • Method

    CQG-MBQA uses contrastive question generation to create binary yes/no embedding dimensions and a multi-task binary question-answering model to answer them efficiently.

    Source: §1 · p. 2, §3.2 · p. 6
  • Results

    CQG-MBQA performs comparably to advanced black-box models and consistently outperforms other interpretable text embedding models across downstream tasks.

    Source: §5 · p. 11
  • Takeaways & Limitations

    The generated questions can expose shared semantic content and fine-grained differences between texts through interpretable dimensions.

    Source: §4.4 · p. 9

Abstract

from arXiv · show

Semantic text embedding is essential to many tasks in Natural Language Processing (NLP). While black-box models are capable of generating high-quality embeddings, their lack of interpretability limits their use in tasks that demand transparency. Recent approaches have improved interpretability by leveraging domain-expert-crafted or LLM-generated questions, but these methods rely heavily on expert input or well-prompt design, which restricts their generalizability and ability to generate discriminative questions across a wide range of tasks. To address these challenges, we introduce \algo{CQG-MBQA} (Contrastive Question Generation - Multi-task Binary Question Answering), a general framework for producing interpretable semantic text embeddings across diverse tasks. Our framework systematically generates highly discriminative, low cognitive load yes/no questions through the \algo{CQG} method and answers them efficiently with the \algo{MBQA} model, resulting in interpretable embeddings in a cost-effective manner. We validate the effectiveness and interpretability of \algo{CQG-MBQA} through extensive experiments and ablation studies, demonstrating that it delivers embedding quality comparable to many advanced black-box models while maintaining inherently interpretability. Additionally, \algo{CQG-MBQA} outperforms other interpretable text embedding methods across various downstream tasks.

1 INTRODUCTION

Black-box embeddings capture semantic similarity but remain opaque, while existing question-based interpretable approaches face limits in generalizability and question quality. CQG-MBQA generates binary questions as interpretable dimensions and answers them efficiently, with reported performance comparable to many black-box models and stronger than other interpretable methods across tasks.

1 INTRODUCTION

  • Black-box embeddings can capture semantic similarity effectively, but their opacity leaves users without explanations for why texts are judged similar.This limits their use in settings requiring transparency, including high-stakes legal and medical decisions and regulatory compliance.Source: §1 · p. 1
  • Earlier question-based interpretable methods rely on costly expert annotation or carefully engineered prompts, and example-based generation can yield generic, less discriminative questions.ChiLL uses domain-expert-crafted yes/no questions, while QAEmb uses six prompt templates for fMRI prediction.Source: §1 · p. 2
  • CQG-MBQA matches many black-box models and surpasses other interpretable embedding methods across various text embedding tasks.It uses contrastively generated binary questions as embedding dimensions and presents them as human-interpretable.Source: §1 · p. 2
  • CQG-MBQA combines contrastive question generation with multi-task binary question answering to create interpretable text embeddings across a broad range of tasks.The questions aim to be highly discriminative while minimizing users’ cognitive load; the MBQA model is presented as efficient at scale and as reducing LLM inference costs.Source: §1 · p. 2

2 RELATED WORK

Related work moves from word-level and contextual black-box embeddings toward interpretable representations, but creating context-aware interpretable dimensions remains difficult. Recent question-based approaches use expert-crafted or LLM-generated questions, motivating a cost-effective framework for generating questions as embedding dimensions.

2 RELATED WORK

  • Early word-embedding methods can miss context, while later transformer and contrastive models improve semantic representations but remain opaque.The section describes GloVe and Word2Vec limitations, then covers USE, BERT, SBERT, SimCSE, WhitenedCSE, and AnglE.Source: §2 · pp. 2–3
  • Earlier interpretable embedding work transforms word embeddings, derives dimensions from categorical knowledge or word senses, or uses autoencoders.Examples include biomedical categorical knowledge, latent semantic structure analysis, SPINE, and Word2Sense.Source: §2 · p. 3
  • Recent work explores heatmaps and conceptual representations, while ChiLL and QAEmb use yes/no questions to form interpretable features.ChiLL relies on expert-crafted questions for health-record classification; QAEmb generates questions using text and question examples and is reported effective for fMRI prediction.Source: §2 · p. 3

3 INTERPRETABLE TEXT EMBEDDING FRAMEWORK

CQG-MBQA represents texts with question-answer dimensions, generating discriminative yes/no questions and answering them through an efficient multi-task model. CQG contrasts cluster positives with hard and easy negatives; MBQA reduces the cost of producing embeddings at scale.

3 INTERPRETABLE TEXT EMBEDDING FRAMEWORK

  • CQG-MBQA uses yes/no questions as interpretable dimensions, with their answers forming text embedding vectors.Applying the same questions across corpus texts yields a consistent embedding matrix.Source: §3 · p. 3

3.1 QUESTION GENERATION

  • CQG addresses generic questions and repeated “yes” answers by generating discriminative questions intended to capture fine-grained semantic differences.The cited examples contrast broad questions with one that distinguishes whales and dolphins from other groups.Source: §3.1 · p. 4
  • CQG clusters text embeddings, samples positives and hard and easy negatives, then prompts an LLM for questions answered “yes” only for positives.Hard negatives encourage cluster-specific discrimination, while easy negatives support broader corpus relevance.Source: §3.1 · pp. 4–5
  • Generated questions are probed for discrimination, ranked by quality, and filtered to remove semantically similar questions.The quality measure compares positive- and negative-probe “yes” rates; question similarity is measured by cosine similarity.Source: §3.1 · p. 5

3.2 QUESTION ANSWERING

  • MBQA uses a frozen encoder and question-specific classification heads trained with weighted binary cross-entropy on LLM-generated question-answer pairs.The encoder produces text representations, and the heads predict binary scores for the questions.Source: §3.2 · p. 6
  • 96% accuracy reproduces LLM-generated CQG answers; embedding MS MARCO dev costs around 41 USD, or 0.017% of the original GPT-4o-mini cost.Training uses data from as few as 1,000 articles per question; training takes 36 hours and embedding the dev set takes 90 hours on a single GTX 1080 Ti.Source: §3.2 · p. 6

4 EXPERIMENTS

The experiments assess CQG-MBQA on embedding quality and interpretability, including how question count and the binary threshold affect their balance. They compare it with black-box and interpretable models across text-embedding tasks.

4 EXPERIMENTS

  • The experiments evaluate embedding quality on STS, retrieval, and clustering, and examine interpretability, question efficiency, and flexibility.The evaluation compares the framework with black-box and interpretable models.Source: §4 · pp. 6–7

4.1 METRICS

  • Embedding quality is measured with Spearman correlation for STS, nDCG@10 for retrieval, and V-Measure for clustering.Interpretability is assessed through the number of shared active dimensions, or questions, that a user must consider to understand a pairwise similarity.Source: §4.1 · p. 7

4.2 MODELS

  • The comparisons include interpretable baselines, including QAEmb-MBQA and Bag-of-Tokens, and black-box embedding models such as SimCSE, SBERT, OpenAI, and AnglE.BM25 is also included for retrieval.Source: §4.2 · pp. 7–8

4.3 EMBEDDING QUALITY

  • Across STS, retrieval, and clustering, CQG-MBQA is competitive with advanced black-box models and generally outperforms interpretable baselines, with exceptions in retrieval.It is comparable to SimCSE and SBERT (New) on STS, trails AnglE and OpenAI in retrieval, and approaches SBERT (New) in clustering; BM25 is an exception among retrieval baselines.Source: Table 2 · p. 7, §4.3 · pp. 8–9, Table 3 · p. 8

4.4 INTERPRETABILITY

  • CQG-MBQA requires 2.5–3.6× lower cognitive load than QAEmb-MBQA, while its lower load than Bag-of-Tokens comes with reduced embedding quality.The case study illustrates shared and distinguishing semantic dimensions: texts share health-related answers, while a question about neurological conditions separates them.Source: §4.4 · pp. 9–10

4.5 EFFECT ON NUMBER OF QUESTIONS

  • Embedding quality improves and stabilizes around 3,000 questions, while cognitive load rises as the number of dimensions increases.The paper identifies approximately 3,000 questions as a balance between embedding quality and interpretability without an excessive number of questions.Source: §4.5 · p. 10, Figure 4 · p. 10

4.6 TRADE-OFF BETWEEN EMBEDDING QUALITY AND INTERPRETABILITY

  • Raising the binary threshold τ improves interpretability but lowers Spearman correlation, as fewer active dimensions can lose subtle semantic distinctions.Users can tune τ to favor interpretability or embedding quality according to their scenario and available cognitive resources.Source: §4.6 · pp. 10–11, Figure 5 · p. 10

5 CONCLUSION

CQG-MBQA generates binary questions as interpretable embedding dimensions and uses their answers to represent text. Experiments across STS, retrieval, and clustering show performance comparable to advanced black-box models and consistent gains over other interpretable embedding models.

5 CONCLUSION

  • Across STS, retrieval, and clustering, CQG-MBQA performs comparably to advanced black-box models while consistently outperforming other interpretable text embedding models.The framework systematically creates binary questions and uses their answers as interpretable embedding dimensions.Source: §5 · p. 11

A PROMPTS

The appendix describes prompts for generating contrastive questions, adapting a QAEmb question-generation prompt, and collecting binary answers for MBQA training.

A.1 PROMPT: CONTRASTIVE QUESTION GENERATION

  • The CQG prompt discourages complex sentence structures because initial experiments found that combined conditions could yield discriminative questions without identifying deeper relationships.Formatting instructions are also included to improve result parsing accuracy.Source: §A.1 · p. 15
  • CQG prompts the LLM with positive and negative text examples and asks for questions answered “yes” for all positives and “no” for all negatives.The template requests 10 questions and concise wording, avoiding complex structures with “and” or “or” unless necessary.Source: §A.1 · p. 15

A.2 PROMPT: QAEMB QUESTION GENERATION

  • QAEmb’s Question Generation Prompt #5 uses narrative sentences and example yes/no questions to request 100 specific, non-overlapping questions about classification-relevant aspects.The original prompt was designed for fMRI prediction with narrative sentences.Source: §A.2 · p. 15
  • The adapted QAEmb template uses randomly selected training-set reference articles alongside example questions sourced from the original QAEmb paper.It requests 10 diverse yes/no questions about article properties.Source: §A.2 · pp. 15–16

A.3 PROMPT: MULTI-TASK BINARY QUESTION ANSWERING

  • The MBQA answer-generation prompt takes a training article sample and a list of questions, grouping up to 20 questions per prompt to optimize token usage.The prompt requests a yes/no response for each question in a numbered format.Source: §A.3 · p. 16

B TRAINING AND EVALUATION OF THE MBQA MODEL

The MBQA model is trained on LLM-generated binary answers and evaluated on held-out documents. Its held-out question-answering results indicate that it can predict those answers accurately.

Evaluation

Data Collection

  • Training data pairs each generated question with answers for 500 in-cluster, 300 neighboring-cluster, and 200 corpus-random samples per question.GPT-4o-mini generates the answers, which are batched in groups of 20 questions for multi-task binary-classifier training.Source: B TRAINING AND EVALUATION OF THE MBQA… · p. 16

Training

  • Training uses Adam with learning rate 1e-4, a batch size of one text sample, and BCEWithLogitsLoss weighted by the yes-to-no answer ratio.The weights are 7.5127 for CQG-MBQA and 4.9608 for QAEmb-MBQA; training runs for 3 million steps, when performance begins to converge.Source: B TRAINING AND EVALUATION OF THE MBQA… · p. 16

Evaluation

C COST ANALYSIS FOR LLM-BASED QA VS. MBQA

The cost analysis estimates LLM-based and MBQA question-answering expenses for producing interpretable embeddings on the MS MARCO development set. It accounts for LLM API pricing and, for MBQA, training-data collection and GPU runtime.

C COST ANALYSIS FOR LLM-BASED QA VS. MBQA

  • The cost comparison estimates question-answering expenses for producing interpretable embeddings across the MS MARCO dev set.Source: C COST ANALYSIS FOR LLM-BASED QA VS.… · p. 17
  • LLM-based QA costs are estimated for multiple question counts and models, assuming 20 questions per prompt and Batch API pricing.The stated rates per 1 million tokens are $2.5 input and $7.5 output for GPT-4o, and $0.075 input and $0.3 output for GPT-4o-mini.Source: C COST ANALYSIS FOR LLM-BASED QA VS.… · p. 17
  • MBQA cost includes an approximately $31 upfront GPT-4o-mini data-collection expense for 10 million text-question pairs from MEDI2, plus GPU training and inference runtime.Training took around 36 hours on one GTX 1080 Ti; MS MARCO inference ranged from 48 hours for 2,000 dimensions to 90 hours for 10,000 dimensions, estimated at $0.08 per GPU hour.Source: C COST ANALYSIS FOR LLM-BASED QA VS.… · p. 17

D.1 OUR CQG-MBQA MODEL

The CQG-MBQA experiments train on MEDI2 after filtering and deduplicating its text, then generate question dimensions through clustering and train the MBQA model.

D.1 OUR CQG-MBQA MODEL

  • The framework is trained using MEDI2, with experiment hyperparameters listed in Table 8 and model checkpoints listed in Table 9.Source: §D.1 · p. 17, Table 8 · p. 18, Table 9 · p. 18
  • Preprocessing removes task files and query/document instructions, extracts positive and negative instances, then exactly deduplicates the merged text corpus.Source: §D.1 · pp. 17–18
  • CQG encodes and normalizes 6.8 million unique texts, clusters them into 5,000 groups, and produces 9,614 deduplicated questions as embedding dimensions.Questions use random positive examples within each cluster, hard negatives from the three nearest clusters, and easy negatives from remaining clusters.Source: §D.1 · p. 18
  • The MBQA model is trained following the setup described in Appendix B.Source: §D.1 · p. 18

D.2 BASELINE MODELS

The baseline setup adapts QAEmb's example-based prompting for a comparison and draws black-box results from prior work, the MTEB leaderboard, and experiments on two retrieval datasets.

D.2 BASELINE MODELS

  • For a fair QAEmb comparison, the framework replaces CQG with QAEmb's example-based prompting, keeps other parameters unchanged except θ = 0.925, and yields 10,654 questions.The MBQA model uses the same training approach as CQG-MBQA.Source: §D.2 · p. 18
  • STS results for SBERT (Ori.) and USE come from Reimers & Gurevych (2019), while WhitenedCSE uses its best-performing model from Zhuo et al. (2023).All are evaluated using the same metric.Source: §D.2 · pp. 18–19
  • MTEB leaderboard results supply most listed black-box model and BM25 retrieval scores, while MS MARCO and NewsSpectrum retrieval results come from the authors' experiments.Table 9 lists the model checkpoints used for each black-box model.Source: §D.2 · p. 19
Loading 2410.03435v1…