arXiv:2609.04266cs.ARSep 2026

Manuscript Offprint

arXiv:2609.04266

Compute-in-Memory Attention: A Time-Domain Analog Softmax Circuit with RC-Tunable Temperature

Ankur Singh, Ashish Gautam, Shruti R. Kulkarni, Guojing Cong

Ankur Singh 1^{1}, Ashish Gautam 2^{2}, Shruti R. Kulkarni 2^{2} and Guojing Cong 2^{2}

Abstract—Softmax is a key operation in Transformer attention, but its exponentiation and normalization add significant overhead in compute-in-memory (CIM) accelerators, especially when analog attention scores must first be converted to the digital domain. This work presents a tunable-temperature analog softmax circuit in GlobalFoundries 22-nm fully depleted silicon-on-insulator (FDSOI) technology that operates directly on CIM-generated score voltages without intermediate analog-to-digital conversion. Each input score is converted into a time-domain event using a shared falling ramp. The corresponding comparator transition samples an RC-decaying reference to generate an exponential weight, which is then processed by an in-circuit normalization stage. In contrast to analog softmax circuits that rely on transistor weak-inversion behavior for exponentiation, the proposed architecture controls the softmax response through the ramp slope and RC time constant, enabling programmable effective temperature. The 128-element architecture is evaluated using transistor-level and post-layout extracted simulations, including multi-level input vectors, capacitance variation and mismatch, process and temperature variation, monte carlo analysis, and shared-interconnect parasitics. The complete 128-element implementation occupies 9453.42 μ\mum 2^2 including the shared global ramp circuitry, while each replicated softmax element occupies 70.2 μ\mum 2^2. The circuit achieves a 242.97-ns evaluation latency at 13.44 mW total power, corresponding to 25.5 pJ per output element. The simultaneous 128-element evaluation achieves an RMSE of 24.46 mV relative to the ideal softmax response. The extracted circuit characteristics are further incorporated into a MemTorch-based hardware-aware Transformer model, where the proposed softmax achieves a validation loss within 2.5% of the ideal-softmax baseline.

Index Terms—Analog softmax, compute-in-memory, attention accelerator, time-domain computing, transformer accelerators.

I. INTRODUCTION

Transformer networks have become the dominant architecture for large language models (LLMs) and sequence-processing tasks due to their self-attention mechanism [1]. In scaled dot-product attention, query, key, and value matrices are used to compute

Attention(Q,K,V)=Softmax(QKTdk)V,(1)Attention(\mathbf{Q},\mathbf{K},\mathbf{V})=Softmax\left(\frac{\mathbf{Q}\mathbf{K}^{T}}{\sqrt{d_{k}}}\right)\mathbf{V}, \tag{1}

where the softmax function converts each attention-score vector into normalized weights. Unlike conventional classifiers, where softmax is typically applied only at the output layer, transformer models use softmax repeatedly across attention heads and layers. As sequence length and model size increase, softmax becomes a non-negligible operation because it requires exponentiation, maximum search for numerical stability, accumulation, and normalization [2].

Compute-in-memory (CIM) architectures are attractive for transformer acceleration because they reduce data movement by performing matrix-vector or matrix-matrix operations close to, or inside, the memory array [3]. This property is well matched to the dot-product operations used to generate attention scores. However, integrating softmax with analog CIM remains challenging. A CIM array can naturally generate analog score voltages or currents, but softmax requires a nonlinear exponential operation followed by vector-wide normalization. Conventional approaches therefore often rely on digital or mixed-signal peripheral blocks, such as lookup-based exponentiation, low-precision arithmetic, reciprocal/division units, or online normalization schemes [2]. These techniques reduce digital cost but still require dedicated softmax hardware and may introduce conversion overhead when interfaced with analog CIM outputs.

Recent analog in-memory attention work further illustrates this challenge. In [4], the attention computation is implemented with analog gain-cell arrays and charge-to-pulse conversion, avoiding intermediate analog-to-digital converters (ADCs) between attention stages. However, instead of implementing softmax directly, the architecture uses a HardSigmoid nonlinearity, since softmax normalization requires an additional interconnection along the sequence dimension, which is difficult to realize efficiently in analog hardware [4]. This motivates compact analog softmax circuits that can interface directly with CIM-generated score signals while preserving the normalization behavior required by attention.

Direct analog softmax circuits have been investigated using source-coupled transistor arrays. A representative approach implements softmax with bipolar junction transistor (BJT) or NMOS differential structures, where the normalized branch current follows the softmax form [5]. For the NMOS implementation, however, the exponential current–voltage relationship is obtained only when the input transistors operate in subthreshold. In this condition, the drain current is exponentially related to VGSV_{GS}, and the normalized current ratio approximates softmax with an effective slope determined by nUTnU_{T}, where n is the subthreshold factor and UTU_{T} is the thermal voltage [5], [6]. This operating condition also restricts the usable input-voltage range, since all input devices must remain within the weak-inversion region for the exponential relationship to remain valid. As the input voltage increases toward moderate or strong inversion, the current–voltage characteristic deviates from the desired exponential dependence, thereby limiting the dynamic range over which accurate softmax behavior

1^{1}Department of Electrical and Computer Engineering, University of Wisconsin–Madison, Madison, WI, USA. Email: ankur.singh@wisc.edu.

ORNL Oak Ridge, Tennessee, USA. Emails: {gautama, kulkarnisr, congg}@ornl.gov.

can be maintained. Although common threshold-dependent factors cancel in the ideal matched current ratio, practical operation therefore remains constrained by the narrow weak-inversion input range, temperature dependence, leakage, tail-current accuracy, device mismatch, and the need to keep all input devices in the intended operating region.

This work presents a programmable-temperature analog softmax circuit for CIM attention in 22-nm CMOS. Instead of relying on weak-inversion MOS exponential behavior, the proposed approach generates the exponential function in the time domain using a shared voltage ramp, comparator-based event detection, and RC-decay sampling. The effective softmax temperature is controlled by the ramp slope and RC time constant, enabling flexible tuning of the score-to-weight mapping within practical circuit constraints.

The key features and contributions of the proposed time-domain analog softmax architecture are summarized as follows:

  1. The proposed architecture realizes exponential-weight generation through score-to-time conversion using a shared ramp and RC-decay sampling, avoiding reliance on the weak-inversion exponential characteristics conventionally employed in analog softmax circuits.

  2. A programmable-temperature softmax operation is achieved by controlling the ramp slope and RC time constant. The relationship between these circuit parameters and the effective softmax selectivity is analytically derived and validated through transistor-level simulations.

  3. The proposed circuit evaluates a 128-element softmax vector in parallel within 242.97 ns at 25.5 pJ per element, achieving an RMSE of 24.46 mV for simultaneous 128-element operation, with robustness validated under capacitance variation, analog nonidealities, process corners, and monte carlo mismatch.

  4. Post-layout extraction quantifies the impact of device and interconnect parasitics on accuracy and performance. The implemented softmax element occupies 70.2μm270.2 \mu m^2, corresponding to 9453.42μm29453.42 \mu m^2 for the complete 128-element array.

  5. The extracted circuit characteristics are incorporated into a MemTorch-based hardware-aware decoder-only Transformer model, achieving a validation loss of 1.7868 versus 1.7435 for ideal softmax ( ≈\approx2.5% degradation) and confirming applicability to Transformer inference.

The remainder of this paper is organized as follows. Section II describes the proposed time-domain analog softmax architecture and its theoretical formulation. Section III presents circuit-level validation, including softmax accuracy, programmable-temperature operation, analog nonideality analysis, process and monte-carlo characterization, and post-layout extracted results. Section IV presents the MemTorch-based Transformer evaluation, compares the proposed architecture with prior softmax hardware, and discusses future implementation and scalability. Finally, Section V concludes the paper.

II. PROPOSED TIME-DOMAIN ANALOG SOFTMAX CIRCUIT

A. Temperature-Programmable Softmax

Softmax is a fundamental operation in attention mechanisms that converts raw similarity scores into a probability distribution. It enables the model to emphasize more relevant tokens while suppressing less important ones. Softmax transforms an attention-score vector s=[s1,s2,…,sN]\mathbf{s} = [s_1, s_2, \ldots, s_N] into normalized attention weights as

pi=exp⁡(si/T)∑j=1Nexp⁡(sj/T),i=1,…,N,(2)p_{i}=\frac{\exp\left(s_{i}/T\right)}{\sum_{j=1}^{N}\exp\left(s_{j}/T\right)},\qquad i=1,\ldots,N, \tag{2}

where pip_i denotes the attention weight corresponding to score sis_i, and TT is the softmax temperature. The normalization ensures that ∑i=1Npi=1\sum_{i=1}^N p_i = 1, allowing the resulting weights to represent the relative importance of tokens in the attention operation. The temperature controls the selectivity of the attention distribution. A lower TT increases the relative weight of the largest scores and produces a sharper distribution, whereas a higher TT produces smoother and more uniform attention weights.

The softmax characteristic can equivalently be expressed using the inverse-temperature coefficient, or softmax gain, γ\gamma, defined as

γ=1T.(3)\gamma=\frac{1}{T}. \tag{3}

Accordingly, (2) can be rewritten as

pi=exp⁡(γsi)∑j=1Nexp⁡(γsj).(4)p_{i}=\frac{\exp\left(\gamma s_{i}\right)}{\sum_{j=1}^{N}\exp\left(\gamma s_{j}\right)}. \tag{4}

A larger γ\gamma corresponds to a lower effective temperature and produces a sharper probability distribution, whereas a smaller γ\gamma produces a smoother distribution.

In CIM-based Transformer accelerators, the score range can vary with attention head, layer, array gain, and analog non-idealities. Therefore, a programmable softmax characteristic enables the score-to-weight mapping to be adjusted without modifying the preceding CIM dot-product operation. In the proposed circuit, this programmability is achieved through the slope of a shared ramp and the time constant of an RC-decay waveform. As derived in the following subsection, these circuit parameters directly determine the effective softmax temperature and the corresponding inverse-temperature coefficient γ\gamma.

References (25)