SearcharxivSearch

arXiv subjects

Yangfan Hu

Publications and source records attributed to Yangfan Hu.

At least 19 recordsLinked to original sources

Understanding Why Language Models Hallucinate: Testing Reasoning Against Priors

Large language models often produce hallucinated answers that violate prompt-level constraints. A key diagnostic question is whether these failures reflect missing knowledge, or whether the model has the relevant information but follows the wrong inference path. We study this phenomenon as inference misalignment: a mismatch between the answer supported by the prompt and the answer favored by statistically salient latent associations. We formalize this view with a latent key-task model, in which pretraining-frequency imbalance can cause a shortcut path to dominate the constraint-sensitive path and induce positive inference loss. The framework predicts two failure modes: task-retrieval bias in entity disambiguation and key-selection bias in action choice. We introduce TrapQA, a controlled diagnostic testbed with two components. ScientistQA tests disambiguation among similar scientists with supplementary factual probes, while Real-Life Constrained QA tests everyday constraint following under salient shortcuts. Our results show that hallucination can arise from biased latent inference rather than absent knowledge alone.

cs.CL

Beyond Similarity: Trustworthy Memory Search for Personal AI Agents

Personal AI agents increasingly rely on long-term memory to provide persistent personalization across sessions. However, existing memory pipelines are largely driven by semantic similarity: memory data close to the current query is retrieved and injected into the model context. This creates a critical trustworthiness gap, since a semantically related memory may still be contextually inappropriate, leading to threats such as cross-domain leakage, sycophancy, tool-call drift, or memory-induced jailbreaks. In this paper, we study memory search as a trust boundary in personal AI agents. We evaluate representative agentic memory frameworks, including A-Mem, Mem0, and MemOS, together with OpenClaw, a real-world personal-agent environment with persistent state and tool-use capability. Our results show that long-term memory is not merely a utility layer, but a durable control channel that can reshape how agents interpret tasks and execute actions, leaving them highly susceptible to the aforementioned threats. To mitigate these vulnerabilities, we propose MemGate, a lightweight and deployable memory plug-in for trustworthy memory search, with only 9M parameters and a 35.1MB footprint. MemGate is inserted between the vector memory store and the backbone LLM, requiring no LLM modification, memory-database rewriting, or inference-time LLM judge. It applies a query-conditioned neural gate to candidate memory representations, turning raw similarity search into task-conditioned memory admission. Across multiple mainstream memory frameworks, real-world agent settings, and diverse LLM backbones, MemGate reduces memory-induced threats while preserving long-term memory utility.

cs.AI

Understanding and Preserving Safety in Fine-Tuned LLMs

Fine-tuning is an essential and pervasive functionality for applying large language models (LLMs) to downstream tasks. However, it has the potential to substantially degrade safety alignment, e.g., by greatly increasing susceptibility to jailbreak attacks, even when the fine-tuning data is entirely harmless. Despite garnering growing attention in defense efforts during the fine-tuning stage, existing methods struggle with a persistent safety-utility dilemma: emphasizing safety compromises task performance, whereas prioritizing utility typically requires deep fine-tuning that inevitably leads to steep safety declination. In this work, we address this dilemma by shedding new light on the geometric interaction between safety- and utility-oriented gradients in safety-aligned LLMs. Through systematic empirical analysis, we uncover three key insights: (I) safety gradients lie in a low-rank subspace, while utility gradients span a broader high-dimensional space; (II) these subspaces are often negatively correlated, causing directional conflicts during fine-tuning; and (III) the dominant safety direction can be efficiently estimated from a single sample. Building upon these novel insights, we propose safety-preserving fine-tuning (SPF), a lightweight approach that explicitly removes gradient components conflicting with the low-rank safety subspace. Theoretically, we show that SPF guarantees utility convergence while bounding safety drift. Empirically, SPF consistently maintains downstream task performance and recovers nearly all pre-trained safety alignment, even under adversarial fine-tuning scenarios. Furthermore, SPF exhibits robust resistance to both deep fine-tuning and dynamic jailbreak attacks. Together, our findings provide new mechanistic understanding and practical guidance toward always-aligned LLM fine-tuning.

cs.LG

AVM: Towards Structure-Preserving Neural Response Modeling in the Visual Cortex Across Stimuli and Individuals

While deep learning models have shown strong performance in simulating neural responses, they often fail to clearly separate stable visual encoding from condition-specific adaptation, which limits their ability to generalize across stimuli and individuals. We introduce the Adaptive Visual Model (AVM), a structure-preserving framework that enables condition-aware adaptation through modular subnetworks, without modifying the core representation. AVM keeps a Vision Transformer-based encoder frozen to capture consistent visual features, while independently trained modulation paths account for neural response variations driven by stimulus content and subject identity. We evaluate AVM in three experimental settings, including stimulus-level variation, cross-subject generalization, and cross-dataset adaptation, all of which involve structured changes in inputs and individuals. Across two large-scale mouse V1 datasets, AVM outperforms the state-of-the-art V1T model by approximately 2% in predictive correlation, demonstrating robust generalization, interpretable condition-wise modulation, and high architectural efficiency. Specifically, AVM achieves a 9.1% improvement in explained variance (FEVE) under the cross-dataset adaptation setting. These results suggest that AVM provides a unified framework for adaptive neural modeling across biological and experimental conditions, offering a scalable solution under structural constraints. Its design may inform future approaches to cortical modeling in both neuroscience and biologically inspired AI systems.

cs.CV

Bridging Quantized Artificial Neural Networks and Neuromorphic Hardware

Neuromorphic hardware aims to leverage distributed computing and event-driven circuit design to achieve an energy-efficient AI system. The name "neuromorphic" is derived from its spiking and local computing nature, which mimics the fundamental activity of an animal's nervous system. In neuromorphic hardware, neurons, i.e., computing cores use single-bit, event-driven data (called spikes) for inter-communication, which differs substantially from conventional hardware. To leverage the advantages of neuromorphic hardware and implement a computing model, the conventional approach is to build spiking neural networks (SNNs). SNNs replace the nonlinearity part of artificial neural networks (ANNs) in the realm of deep learning with spiking neurons, where the spiking neuron mimics the basic behavior of bio-neurons. However, there is still a performance gap between SNNs and their ANN counterparts. In this paper, we explore a new way to map computing models onto neuromorphic hardware. We propose a Spiking-Driven ANN (SDANN) framework that directly implements quantized ANN on hardware, eliminating the need for tuning the trainable parameters or any performance degradation. With the power of quantized ANN, our SDANN ensures a lower bound of implementation performance on neuromorphic hardware. To address the limitation of bit width support on hardware, we propose bias calibration and scaled integration methods. Experiments on various tasks demonstrate that our SDANN achieves exactly the same accuracy as the quantized ANN. Beyond toy examples and software implementation, we successfully deployed and validated our spiking models on real neuromorphic hardware, demonstrating the feasibility of the SDANN framework.

cs.NE

Darkit: A User-Friendly Software Toolkit for Spiking Large Language Model

Large language models (LLMs) have been widely applied in various practical applications, typically comprising billions of parameters, with inference processes requiring substantial energy and computational resources. In contrast, the human brain, employing bio-plausible spiking mechanisms, can accomplish the same tasks while significantly reducing energy consumption, even with a similar number of parameters. Based on this, several pioneering researchers have proposed and implemented various large language models that leverage spiking neural networks. They have demonstrated the feasibility of these models, validated their performance, and open-sourced their frameworks and partial source code. To accelerate the adoption of brain-inspired large language models and facilitate secondary development for researchers, we are releasing a software toolkit named DarwinKit (Darkit). The toolkit is designed specifically for learners, researchers, and developers working on spiking large models, offering a suite of highly user-friendly features that greatly simplify the learning, deployment, and development processes.

cs.SE

Toward Large-scale Spiking Neural Networks: A Comprehensive Survey and Future Directions

Deep learning has revolutionized artificial intelligence (AI), achieving remarkable progress in fields such as computer vision, speech recognition, and natural language processing. Moreover, the recent success of large language models (LLMs) has fueled a surge in research on large-scale neural networks. However, the escalating demand for computing resources and energy consumption has prompted the search for energy-efficient alternatives. Inspired by the human brain, spiking neural networks (SNNs) promise energy-efficient computation with event-driven spikes. To provide future directions toward building energy-efficient large SNN models, we present a survey of existing methods for developing deep spiking neural networks, with a focus on emerging Spiking Transformers. Our main contributions are as follows: (1) an overview of learning methods for deep spiking neural networks, categorized by ANN-to-SNN conversion and direct training with surrogate gradients; (2) an overview of network architectures for deep spiking neural networks, categorized by deep convolutional neural networks (DCNNs) and Transformer architecture; and (3) a comprehensive comparison of state-of-the-art deep SNNs with a focus on emerging Spiking Transformers. We then further discuss and outline future directions toward large-scale SNNs.

cs.LG

A local criterion of topological phase transitions

A local criterion of topological phase transitions is established based on the Morse theory: a topological phase transition occurs when the count of Morse critical points of the order function changes. The locations in space where this change occurs are referred to as spatial critical points of the topological phase transition. In cases of continuous topological phase transitions, these spatial critical points are identified through the emergence of degenerate Morse critical points, where local maxima and minima of the order function split or merge. This resembles the formation and annihilation of a particle-antiparticle pair. The wide-ranging applicability of this criterion is demonstrated through three case studies that explore topological phase transitions in both configuration space and reciprocal space. Every topological phase transition is linked to a localized physical process that cannot be comprehended solely by studying changes in a global quantity, such as a topological invariant.

cond-mat.stat-mech

Fast-SNN: Fast Spiking Neural Network by Converting Quantized ANN

Spiking neural networks (SNNs) have shown advantages in computation and energy efficiency over traditional artificial neural networks (ANNs) thanks to their event-driven representations. SNNs also replace weight multiplications in ANNs with additions, which are more energy-efficient and less computationally intensive. However, it remains a challenge to train deep SNNs due to the discrete spike function. A popular approach to circumvent this challenge is ANN-to-SNN conversion. However, due to the quantization error and accumulating error, it often requires lots of time steps (high inference latency) to achieve high performance, which negates SNN's advantages. To this end, this paper proposes Fast-SNN that achieves high performance with low latency. We demonstrate the equivalent mapping between temporal quantization in SNNs and spatial quantization in ANNs, based on which the minimization of the quantization error is transferred to quantized ANN training. With the minimization of the quantization error, we show that the sequential error is the primary cause of the accumulating error, which is addressed by introducing a signed IF neuron model and a layer-wise fine-tuning mechanism. Our method achieves state-of-the-art performance and low latency on various computer vision tasks, including image classification, object detection, and semantic segmentation. Codes are available at: https://github.com/yangfan-hu/Fast-SNN.

cs.NE

Skyrmion annihilation in helimagnets and the critical condition of topological phase transitions with a soft mode

Since the 1950s, topological solitons have been used to describe elementary particles[1-3] and particle-like field configurations[4-13] that appear in almost all branches of physics ranging from subatomic to cosmological scales[3,14-16]. In this context, formation and annihilation of particles corresponds to topological phase transitions, whose actual process and mechanism remain elusive. Here, we show that annihilation of an isolated skyrmion in helimagnets as the applied magnetic field increases initiates at its center point by a local magnetization reversal. At the critical field, a soft mode of the spin-wave excitation appears, which vanishes the local magnetization modulus as well as the soft-mode-modulated emergent elastic stiffness[17] at the center, which makes it an emergent magnetic monopole[6]. This softened point vanishes the energy barrier of reversing the local magnetization at the center, which inevitably annihilates the skyrmion. On this basis, we propose a general critical condition for topological phase transitions of field solutions with a soft mode: topological phase transitions initiate at those spatial points where the soft-mode-modulated emergent stiffness matrix losses its positive-definiteness.

nlin.PS

General theory of emergent elasticity for second-order topological phase transitions

The raise of the symmetry breaking mechanism by Landau[1] is a landmark in the studies of phase transitions. The Kosterlitz-Thouless phase transition[2-3] and the fractional quantum Hall effect[4], however, are believed to be induced by another mechanism: topology change. Despite rapid development of the theory of topological orders[5-7], a unified theoretical framework describing this new paradigm of phase transition and its relation to the Landau paradigm, is not seen. Here, we establish such a framework based on variational principle, and show that the critical condition for any second-order topological phase transitions is loss of positive-definiteness of a topologically protected second-order variation of the free energy. A topologically protected variation of a field solution is performed with respect to its emergent displacements, which is introduced by constructing an emergent elasticity problem for the solution. The Landau paradigm of phase transitions studies global property changes induced instability, while topological phase transitions study local property changes induced topological instability. The general effectiveness of this criterion is shown through analyzing the topological stability of several prototype solutions in both real space (two-kink solutions of the sine-Gordon model; an isolated skyrmion in chiral magnets) and reciprocal space (phonon spectrum of a monoatomic chain and a diatomic chain; band structure of a monoatomic chain within the Kronig-Penny model). Every field is emergent elastic with spatially modulated stiffness, and changes of topological property occur at its softened points. We anticipate our work to be a starting point for a general study of topological phase transitions in all field theories.

cond-mat.mes-hall

Spiking Deep Residual Network

Spiking neural networks (SNNs) have received significant attention for their biological plausibility. SNNs theoretically have at least the same computational power as traditional artificial neural networks (ANNs). They possess potential of achieving energy-efficiency while keeping comparable performance to deep neural networks (DNNs). However, it is still a big challenge to train a very deep SNN. In this paper, we propose an efficient approach to build a spiking version of deep residual network (ResNet). ResNet is considered as a kind of the state-of-the-art convolutional neural networks (CNNs). We employ the idea of converting a trained ResNet to a network of spiking neurons, named Spiking ResNet (S-ResNet). We propose a shortcut conversion model to appropriately scale continuous-valued activations to match firing rates in SNN, and a compensation mechanism to reduce the error caused by discretisation. Experimental results demonstrate that, compared with the state-of-the-art SNN approaches, the proposed Spiking ResNet achieves the best performance on CIFAR-10, CIFAR-100, and ImageNet 2012. Our work is the first time to build a SNN deeper than 40, with comparable performance to ANNs on a large-scale dataset.

cs.NE

Thermodynamics and elasticity of emergent crystals

Periodic field patterns of atoms and their charges/spins/orbits emerge in crystals, forming novel states of matter called emergent crystals (ECs). In recent years, they are observed in diverse systems such as skyrmion crystals in helimagnets, and periodic ripples in 2D materials. ECs essentially changes the properties of material underneath, and are deformable when subject to various effective fields. A major challenge in application is first to predict what kind of EC will appear in the system of interest, and how to quantify its `elasticity' when subject to an effective field. Here we establish the theoretical framework of thermodynamics for deformable ECs, and derive from it the linear constitutive equations when subject to the primary external field. We provide a systematic study on the ECs that may appear in helimagnets induced by the Dzyaloshinskii-Moriya interaction, and analyze their elasticity when subject to bias magnetic fields. We construct in this work the basis of emergent elasticity, a new branch studying deformable emergent crystals under effective fields.

physics.app-ph

Emergent elastic waves in skyrmion crystals with finite frequencies at long wavelength limit

A fundamental fact in solids is that the frequencies of elastic waves vanish as the wave number approaches zero\cite{6}. Here we theoretically show that this fact is overturned when studying the lattice vibration of skyrmion crystals (SkX), i.e., periodic alignment of topologically nontrivial spin solitons called magnetic skyrmions. As emergent crystals, SkX possess collective excitations called "emergent phonons", which describe dynamics of SkX caused by lattice vibration (resembling acoustical branches of ordinary phonons) and in-lattice vibration (resembling optical branches of ordinary phonons). We find that lattice vibration and in-lattice vibration of the emergent phonons in SkX are coupled even at long wavelength limit, such that multiple types of "emergent elastic waves" (modes causing lattice vibration of SkX) with finite frequencies exist. This phenomenon, which originates from the Berry phase form of kinetic energy, is generally true for emergent crystalline states of spins. Our results show that the dynamics of magnetic emergent crystals are intrinsically different from that of ordinary crystals.

cond-mat.mes-hall

Lagrangian formulation for emergent elastic waves in magnetic emergent crystals

Magnetic emergent crystals are periodic alignment of "particle-like" spin textures that emerge in magnets. Instead of focusing on an individual spin or a macroscopic magnetization field, we analyze the dynamical behaviors of these novel states by taking a solid-state point of view. Based on variational principles, the basic equations for lattice dynamics of any emergent crystalline states appearing in magnetic materials is established. For small amplitude emergent elastic waves propagating in emergent crystals, the basic equations reduce to an eigenvalue problem, from which the dispersion relation and vibrational patterns for all emergent phonons are determined at the long wavelength limit.

cond-mat.mes-hall

Long-wavelength emergent phonons in skyrmion crystals distorted by exchange anisotropy and tilted magnetic fields

Skyrmion crystals (SkX) are periodic alignment of magnetic skyrmions, i.e., a type of topologically protected spin textures. Compared with ordinary crystals, they can be drastically deformed under anisotropic effects because they are composed of field patterns whose deformation does not cause any bond-breaking. This exotic ductility of SkX bring about great tunability of its collective excitations called emergent phonons, which are vital for magnonics application. The question is how to quantitatively determine the emergent phonons of distorted SkX. Here we systematically study the long wavelength emergent phonons of SkX distorted by (a) a negative exchange anisotropy, and (b) a tilted magnetic field. In both cases, deformation and structural transitions of SkX thoroughly influence the frequency, anisotropy of vibrational pattern and dispersion relation, and coupling between lattice vibration and in-lattice vibration for all modes. Tilted magnetic fields are very effective in tuning the emergent phonons, such that all modes except the Goldstone mode can be excited by AC magnetic fields when a tilted bias field is presented.

cond-mat.mes-hall

Wave-nature and metastability of emergent crystals in chiral magnets

Topological spin textures emerging in magnetic materials usually appear in crystalline states. A long-standing dilemma is whether we should understand these emergent crystals as gathering particles or coupling waves, the answer of which affects almost every aspect of our understanding on the subject. Here we prove that 2-D emergent crystals with long-range order in helimagnets, such as skyrmion crystals and dipole skyrmion crystals, have a wave nature. We systematically study their equilibrium properties, metastability, and phase transition path when unstable. We show that the robustness of a skyrmion crystal derives from its metastability, and that its phase transition dynamics at low (high) magnetic field is mediated by a soft mode which breaks (maintains) its hexagonal symmetry. Different from ordinary crystals which are formed by. and breaks into atoms, emergent crystals have a new formation (destruction) mechanism: they appear from (turn to) single-Q spin-density-wave states through nonlinear mode-mode interactions.

cond-mat.mes-hall

Nonlinear emergent elasticity and structural transitions of skyrmion crystal under uniaxial distortion

Emergent crystals are periodic alignment of "emergent particles", i.e., localized collective behavior of atoms or their charges/spins/orbits. These novel states of matter, widely observed in various systems, may deform under mechanical forces with elasticity strikingly different from that of the underlying material. However, their nonlinear and critical behaviors under strong fields are hitherto unclear. Here we theoretically study the nonlinear elasticity and structural transitions of skyrmion crystals (SkX) suffering uniaxial distortion by using three different methods. Under moderate tension, SkX behaves like a ductile material, with a negative crossover elastic stiffness and a negative emergent Poisson's ratio at appropriate conditions of magnetic field. Under strong straining, we observe at most six phase transitions, leading to appearance of four novel emergent crystals that are thermodynamically metastable. When subject to external loads, emergent crystals rotate globally, and their composing "particles" have unlimited deformability, which render their exotic polymorphism.

cond-mat.mes-hall