[Paper Review] CQ-CiM: Hardware-Aware Embedding Shaping for Robust CiM-Based Retrieval
CQ-CiM jointly learns embedding adaptation, compression, and low-bit quantization to fit CiM crossbars, improving on-device RAG retrieval under hardware variations.
Deploying Retrieval-Augmented Generation (RAG) on edge devices is in high demand, but is hindered by the latency of massive data movement and computation on traditional architectures. Compute-in-Memory (CiM) architectures address this bottleneck by performing vector search directly within their crossbar structure. However, CiM's adoption for RAG is limited by a fundamental ``representation gap,'' as high-precision, high-dimension embeddings are incompatible with CiM's low-precision, low-dimension array constraints. This gap is compounded by the diversity of CiM implementations (e.g., SRAM, ReRAM, FeFET), each with unique designs (e.g., 2-bit cells, 512x512 arrays). Consequently, RAG data must be naively reshaped to fit each target implementation. Current data shaping methods handle dimension and precision disjointly, which degrades data fidelity. This not only negates the advantages of CiM for RAG but also confuses hardware designers, making it unclear if a failure is due to the circuit design or the degraded input data. As a result, CiM adoption remains limited. In this paper, we introduce CQ-CiM, a unified, hardware-aware data shaping framework that jointly learns Compression and Quantization to produce CiM-compatible low-bit embeddings for diverse CiM designs. To the best of our knowledge, this is the first work to shape data for comprehensive CiM usage on RAG.
Motivation & Objective
- Bridge the representation gap between high-precision, high-dimension embeddings and low-bit, fixed-size CiM crossbars.
- Develop a unified end-to-end pipeline that jointly adapts embeddings, compresses dimensions, and quantizes values for CiM compatibility.
- Incorporate hardware non-idealities and device variance into training to boost robustness in CiM-based retrieval.
- Enable self-supervised learning for embedding shaping without labeled data.
- Demonstrate generalizability across multiple embedding models and CiM device types.
Proposed method
- LoRA-based adapter for parameter-efficient embedding adaptation.
- Dense projection compression head to reduce dimensionality to CiM-compatible size.
- Noise-injection module to simulate device-level variance during training.
- Nonuniform-to-Uniform Quantization (N2UQ) head to map compressed embeddings to low-bit CiM levels.
- Contrastive loss to shape semantic space via self-supervision.
- Reconstruction loss (MSE) to stabilize compression and quantization during end-to-end training.

Experimental results
Research questions
- RQ1Can a unified, hardware-aware framework jointly compress and quantize embeddings to fit diverse CiM crossbars?
- RQ2Does end-to-end training with hardware-aware noise improve robustness of CiM-based retrieval under device variations?
- RQ3How does CQ-CiM perform against state-of-the-art dimension-reduction and quantization baselines on CiM-compatible tasks?
- RQ4Is the approach generalizable across different embedding models and CiM device technologies (SRAM, ReRAM, FeFET)?
Key findings
- CQ-CiM consistently achieves best or competitive retrieval performance across five datasets under aggressive 1-bit and 2-bit settings.
- The combination of LoRA adaptation, dense compression, and learned N2UQ quantization yields the strongest gains in ablations.
- N2UQ outperforms fixed STE by 3–7% absolute across settings in retrieval tasks.
- Framework demonstrates generalizability across four embedding models and maintains robustness in end-to-end RAG with device noise.
- End-to-end RAG results show stable performance under realistic device-variation models.

Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.