SearcharxivSearch

arXiv subjects

Xiaofei Ma

Publications and source records attributed to Xiaofei Ma.

At least 19 recordsLinked to original sources

Poison Once, Exploit Forever: Environment-Injected Memory Poisoning Attacks on Web Agents

Memory makes LLM-based web agents personalized, powerful, yet exploitable. By storing past interactions to personalize future tasks, agents inadvertently create a persistent attack surface that spans websites and sessions. While existing security research on memory assumes attackers can directly inject into memory storage or exploit shared memory across users, we present a more realistic threat model: contamination through environmental observation alone. We introduce Environment-injected Trajectory-based Agent Memory Poisoning (eTAMP), the first attack to achieve cross-session, cross-site compromise without requiring direct memory access. A single contaminated observation (e.g., viewing a manipulated product page) silently poisons an agent's memory and activates during future tasks on different websites, bypassing permission-based defenses. Our experiments on (Visual)WebArena reveal two key findings. First, eTAMP achieves substantial attack success rates: up to 32.5% on GPT-5-mini, 23.4% on GPT-5.2, and 19.5% on GPT-OSS-120B. Second, we discover Frustration Exploitation: agents under environmental stress become dramatically more susceptible, with ASR increasing up to 8 times when agents struggle with dropped clicks or garbled text. Notably, more capable models are not more secure. GPT-5.2 shows substantial vulnerability despite superior task performance. With the rise of AI browsers like OpenClaw, ChatGPT Atlas, and Perplexity Comet, our findings underscore the urgent need for defenses against environment-injected memory poisoning.

cs.CR

Two-Step Tapering-Collapse Method Enables Element-Interdiffused Cladding for Enhanced Laser Amplification in Yb:YAG Single Crystal Fibers

The development of high-power single crystal fiber (SCF) lasers is critically hindered by the lack of a reliable cladding scheme to confine the optical mode and ensure beam quality. Here, we propose and demonstrate a two-step tapering-collapse method for the first time to fabricate a high-quality cladding on Yb:YAG SCFs based on elemental interdiffusion. This in-situ formed crystalline transition layer with a graded refractive index effectively suppresses lattice mismatch and abruptly mitigates core-cladding interfacial stress. Consequently, the numerical aperture of the SCF is significantly reduced from 0.280 to 0.199. In a master oscillator power amplifier configuration, the clad SCF delivers a remarkable 46.7% enhancement in slope efficiency compared to its bare counterpart, accompanied by a substantially improved near-field beam profile. This work establishes a facile and effective route to high-performance clad SCFs, unlocking their full potential for next-generation extreme-condition lasers.

physics.optics

Automated Composition of Agents: A Knapsack Approach for Agentic Component Selection

Designing effective agentic systems requires the seamless composition and integration of agents, tools, and models within dynamic and uncertain environments. Most existing methods rely on static, semantic retrieval approaches for tool or agent discovery. However, effective reuse and composition of existing components remain challenging due to incomplete capability descriptions and the limitations of retrieval methods. Component selection suffers because the decisions are not based on capability, cost, and real-time utility. To address these challenges, we introduce a structured, automated framework for agentic system composition that is inspired by the knapsack problem. Our framework enables a composer agent to systematically identify, select, and assemble an optimal set of agentic components by jointly considering performance, budget constraints, and compatibility. By dynamically testing candidate components and modeling their utility in real-time, our approach streamlines the assembly of agentic systems and facilitates scalable reuse of resources. Empirical evaluation with Claude 3.5 Sonnet across five benchmarking datasets shows that our online-knapsack-based composer consistently lies on the Pareto frontier, achieving higher success rates at significantly lower component costs compared to our baselines. In the single-agent setup, the online knapsack composer shows a success rate improvement of up to 31.6% in comparison to the retrieval baselines. In multi-agent systems, the online knapsack composer increases success rate from 37% to 87% when agents are selected from an agent inventory of 100+ agents. The substantial performance gap confirms the robust adaptability of our method across diverse domains and budget constraints.

cs.CL

Efficient high-quality photon pair generation in modal phase-matched thin-film lithium niobate micro-ring resonators

Efficient generation of high-quality photon pairs is essential for modern quantum technologies. Micro-ring resonator is an ideal platform for studying on-chip photon sources due to strong nonlinear effect, resonant-enhanced optical fields, and high integration. Thin-film lithium niobate (TFLN) micro-ring resonators with periodically poled quasi-phase matching have shown high-quality photon pair generation. However, periodic poling technology remains expensive and requires complex fabrication hindering its scalability and capability for practical application in nonlinear photonic devices. To address this, we propose a scalable approach using TFLN micro-ring resonators based on modal phase matching to achieve cost-effective, efficient high-quality photon-pair generation, significantly simplifying fabrication. We achieved pair generation rates up to 40.2 MHz/mW through spontaneous parametric down-conversion, with coincidence-to-accidental ratios exceeding 1200. By combining micro-ring resonance enhancement with modal phase matching, our approach reduces device size and fabrication cost while maintaining high nonlinear efficiency. These results advance the development of compact, efficient on-chip photon sources for next-generation nonlinear and quantum photonic applications.

physics.optics

Lunar Orbital VLBI Experiment: motivation, scientific purposes and status

The Lunar Orbital VLBI Experiment (LOVEX) is a scientific component of the Chinese Lunar Exploration Project (CLEP) Chang'E-7. The spaceborne component of LOVEX is implemented onboard the relay satellite QueQiao-2, which was launched on 2024 March 20, and later placed into an elliptical selenocentric orbit. The LOVEX-specific payload consists of an X-band cryogenic receiver, a hydrogen maser frequency standard, and VLBI data formatting and acquisition electronics. Several components of the QueQiao-2 nominal onboard instrumentation, such as the 4.2-meter antenna, the data storage device, and the downlink communication system, contribute to the overall spaceborne VLBI instrumentation. This allows us to form a space radio telescope capable of co-observing with Earth-based radio telescopes in VLBI mode. In this space VLBI system, the length of the baseline extends up to approximately 380,000 km. This paper presents the LOVEX scientific objectives, architecture, instrumentation, pre-launch tests, in-flight verification and calibration, and the first in-flight detections of interferometric response (''fringes'') achieved through observations of the quasar AO 0235+164 and the Chang'E-6 orbital module, positioned at the Sun-Earth Lagrange point L2. These initial results demonstrate the successful performance of LOVEX, verifying its capability for both astronomical and spacecraft tracking observations at ultra-long VLBI baselines.

astro-ph.IM

Structural Code Search using Natural Language Queries

Searching code is a common task that developers perform to understand APIs, learn common code patterns, and navigate code. Currently, developers most commonly search using keywords and regular expressions that are easy to use and widely available. Beyond keywords and regular expressions, structural code search tools allow developers to search for code based on its syntactic structure. This has numerous applications ranging from bug finding to systematically refactoring code. However, these structural code search tools operate on queries expressed in domain-specific languages (DSL) that can be difficult to learn and write. We propose to allow developers to use natural language to search for code structurally. Expressing queries in natural language provides an intuitive way to search for code and lowers the barrier to entry. In this work, we develop a novel general approach that combines the reasoning capabilities of an LLM to interpret natural language search queries with the power of structural search tools to efficiently and accurately retrieve relevant code. We then instantiate this approach for two structural code search DSLs: Semgrep and GQL. In our evaluation, we construct a new benchmark for structural code search consisting of 400 queries over 10 Java projects. We show that our approach for structural code search based on translating NL queries to DSL queries using an LLM is effective and robust, achieving a high precision and recall ranging from 55% - 70%. Further, our approach significantly outperforms baselines based on semantic code search and LLM retrievals by up to 57% and 14% on F1 scores.

cs.SE

High-brightness multimode fiber laser amplifier

Fiber lasers are widely used in various fields owing to their high efficiency, flexible transmission and excellent beam quality. In applications such as industrial manufacturing and defense systems, a higher output power is always desired. Nevertheless, the power scaling in fiber lasers is limited by nonlinear effects and transverse mode instability in conventional high-power fiber laser systems, where the laser is amplified within the fundamental fiber mode. A promising strategy to overcome these limitations is to utilize multimode fibers, which exhibit higher thresholds for both nonlinear effects and transverse mode instability, combined with wavefront shaping techniques to convert the output speckle pattern into a single concentrated spot. In this study, a high-power multimode fiber laser amplifier based on wavefront shaping is constructed and investigated, achieving a focused beam profile with a 168 W output power. The effects of objective function and the linewidth of seed laser on the system performance are also studied. Additionally, an all-fiber version of high-brightness multimode fiber laser amplifier is proposed. This work opens up new avenues for leveraging multimode fibers to achieve higher brightness in fiber lasers and may inspire other research based on wavefront shaping.

physics.optics

UTFix: Change Aware Unit Test Repairing using LLM

Software updates, including bug repair and feature additions, are frequent in modern applications but they often leave test suites outdated, resulting in undetected bugs and increased chances of system failures. A recent study by Meta revealed that 14%-22% of software failures stem from outdated tests that fail to reflect changes in the codebase. This highlights the need to keep tests in sync with code changes to ensure software reliability. In this paper, we present UTFix, a novel approach for repairing unit tests when their corresponding focal methods undergo changes. UTFix addresses two critical issues: assertion failure and reduced code coverage caused by changes in the focal method. Our approach leverages language models to repair unit tests by providing contextual information such as static code slices, dynamic code slices, and failure messages. We evaluate UTFix on our generated synthetic benchmarks (Tool-Bench), and real-world benchmarks. Tool- Bench includes diverse changes from popular open-source Python GitHub projects, where UTFix successfully repaired 89.2% of assertion failures and achieved 100% code coverage for 96 tests out of 369 tests. On the real-world benchmarks, UTFix repairs 60% of assertion failures while achieving 100% code coverage for 19 out of 30 unit tests. To the best of our knowledge, this is the first comprehensive study focused on unit test in evolving Python projects. Our contributions include the development of UTFix, the creation of Tool-Bench and real-world benchmarks, and the demonstration of the effectiveness of LLM-based methods in addressing unit test failures due to software evolution.

cs.SE

LibEvolutionEval: A Benchmark and Study for Version-Specific Code Generation

Recent advancements in code completion models have primarily focused on local file contexts. However, these studies do not fully capture the complexity of real-world software development, which often requires the use of rapidly-evolving public libraries. To fill the gap, we introduce LibEvolutionEval, a detailed study requiring an understanding of library evolution to perform in-line code completion accurately. LibEvolutionEval provides a version-specific code-completion task comprised of eight libraries (torch, torchvision, scipy, pil, tqdm, pyyaml, matplotlib, and pandas) as they evolve over the year along with a detailed analysis of the evolution of two popular and well-maintained public libraries: PyTorch and Matplotlib. We evaluate popular public models and find that public library evolution significantly influences model performance. We explored mitigation methods by studying how retrieved version-specific library documentation and prompting can improve the model's capability in handling these fast-evolving packages, paving a promising future path in better handling fast-evolving libraries.

cs.SE

Approximately Aligned Decoding

It is common to reject undesired outputs of Large Language Models (LLMs); however, current methods to do so require an excessive amount of computation to re-sample after a rejection, or distort the distribution of outputs by constraining the output to highly improbable tokens. We present a method, Approximately Aligned Decoding (AprAD), to balance the distortion of the output distribution with computational efficiency, inspired by algorithms from the speculative decoding literature. AprAD allows for the generation of long sequences of text with difficult-to-satisfy constraints, while amplifying low probability outputs much less compared to existing methods. We show through a series of experiments that the task-specific performance of AprAD is comparable to methods that do not distort the output distribution, while being much more computationally efficient.

cs.CL

LeDex: Training LLMs to Better Self-Debug and Explain Code

In the domain of code generation, self-debugging is crucial. It allows LLMs to refine their generated code based on execution feedback. This is particularly important because generating correct solutions in one attempt proves challenging for complex tasks. Prior works on self-debugging mostly focus on prompting methods by providing LLMs with few-shot examples, which work poorly on small open-sourced LLMs. In this work, we propose LeDex, a training framework that significantly improves the self-debugging capability of LLMs. Intuitively, we observe that a chain of explanations on the wrong code followed by code refinement helps LLMs better analyze the wrong code and do refinement. We thus propose an automated pipeline to collect a high-quality dataset for code explanation and refinement by generating a number of explanations and refinement trajectories from the LLM itself or a larger teacher model and filtering via execution verification. We perform supervised fine-tuning (SFT) and further reinforcement learning (RL) on both success and failure trajectories with a novel reward design considering code explanation and refinement quality. SFT improves the pass@1 by up to 15.92% and pass@10 by 9.30% over four benchmarks. RL training brings additional up to 3.54% improvement on pass@1 and 2.55% improvement on pass@10. The trained LLMs show iterative refinement ability and can keep refining code continuously. Lastly, our human evaluation shows that the LLMs trained with our framework generate more useful code explanations and help developers better understand bugs in source code.

cs.CL

BASS: Batched Attention-optimized Speculative Sampling

Speculative decoding has emerged as a powerful method to improve latency and throughput in hosting large language models. However, most existing implementations focus on generating a single sequence. Real-world generative AI applications often require multiple responses and how to perform speculative decoding in a batched setting while preserving its latency benefits poses non-trivial challenges. This paper describes a system of batched speculative decoding that sets a new state of the art in multi-sequence generation latency and that demonstrates superior GPU utilization as well as quality of generations within a time budget. For example, for a 7.8B-size model on a single A100 GPU and with a batch size of 8, each sequence is generated at an average speed of 5.8ms per token, the overall throughput being 1.1K tokens per second. These results represent state-of-the-art latency and a 2.15X speed-up over optimized regular decoding. Within a time budget that regular decoding does not finish, our system is able to generate sequences with HumanEval Pass@First of 43% and Pass@All of 61%, far exceeding what's feasible with single-sequence speculative decoding. Our peak GPU utilization during decoding reaches as high as 15.8%, more than 3X the highest of that of regular decoding and around 10X of single-sequence speculative decoding.

cs.LG

CodeFort: Robust Training for Code Generation Models

Code generation models are not robust to small perturbations, which often lead to incorrect generations and significantly degrade the performance of these models. Although improving the robustness of code generation models is crucial to enhancing user experience in real-world applications, existing research efforts do not address this issue. To fill this gap, we propose CodeFort, a framework to improve the robustness of code generation models, generalizing a large variety of code perturbations to enrich the training data and enabling various robust training strategies, mixing data augmentation, batch augmentation, adversarial logits pairing, and contrastive learning, all carefully designed to support high-throughput training. Extensive evaluations show that we increase the average robust pass rates of baseline CodeGen models from 14.79 to 21.74. We notably decrease the robustness drop rate from 95.02% to 54.95% against code-syntax perturbations.

cs.SE

Repoformer: Selective Retrieval for Repository-Level Code Completion

Recent advances in retrieval-augmented generation (RAG) have initiated a new era in repository-level code completion. However, the invariable use of retrieval in existing methods exposes issues in both efficiency and robustness, with a large proportion of the retrieved contexts proving unhelpful or harmful to code language models (code LMs). In this paper, we propose a selective RAG framework to avoid retrieval when unnecessary. To power this framework, we design a self-supervised learning approach to enable a code LM to accurately self-evaluate whether retrieval can improve its output quality and robustly leverage the potentially noisy retrieved contexts. Using this LM as both the selective RAG policy and the generation model, our framework achieves state-of-the-art repository-level code completion performance on diverse benchmarks including RepoEval, CrossCodeEval, and CrossCodeLongEval, a new long-form code completion benchmark. Meanwhile, our analyses show that selectively retrieving brings as much as 70% inference speedup in the online serving setting without harming the performance. We further demonstrate that our framework is able to accommodate different generation models, retrievers, and programming languages. These advancements position our framework as an important step towards more accurate and efficient repository-level code completion.

cs.SE

A conformal mapping approach to broadband nonlinear optics on chip

Integrated nonlinear optical devices play an important role in modern optical communications. However, conventional on-chip optical devices with homogeneous or periodic translation dimensions generally have limited bandwidth when applied to nonlinear optical applications. Up today, there lacks a general method to design compact nonlinear optical devices over a broadband continuous frequency range. In this work, we propose a general strategy based on transformation optics (TO) to design curved accelerating waveguides (CAWs) with spatially gradient curvatures able to achieve broadband nonlinear frequency conversion on chip. Through rigorous analytical calculation, we show that increasing the acceleration (i.e. gradient in the waveguide curvature) broadens the output signal spectrum in the nonlinear process. In the experiment, we take the sum-frequency generation for infrared signal upconversion (SFG-ISU) as the example and fabricated a variety of CAWs using thin-film lithium niobate on insulator (LNOI). Efficient SFG is observed over a broadband continuous spectrum. Our conformal mapping approach offers a platform for various nonlinear optical processes and works in any frequency range, including visible, infrared and terahertz bands. Apart from LNOI, our approach is also compatible with other nonlinear materials, such as silicon, silicon nitride and chalcogenide glasses etc.

physics.optics

Code Representation Learning At Scale

Recent studies have shown that code language models at scale demonstrate significant performance gains on downstream tasks, i.e., code generation. However, most of the existing works on code representation learning train models at a hundred million parameter scale using very limited pretraining corpora. In this work, we fuel code representation learning with a vast amount of code data via a two-stage pretraining scheme. We first train the encoders via a mix that leverages both randomness in masking language modeling and the structure aspect of programming language. We then enhance the representations via contrastive learning with hard negative and hard positive constructed in an unsupervised manner. We establish an off-the-shelf encoder model that persistently outperforms the existing models on a wide variety of downstream tasks by large margins. To comprehend the factors contributing to successful code representation learning, we conduct detailed ablations and share our findings on (i) a customized and effective token-level denoising scheme for source code; (ii) the importance of hard negatives and hard positives; (iii) how the proposed bimodal contrastive learning boost the cross-lingual semantic search performance; and (iv) how the pretraining schemes decide the downstream task performance scales with the model size.

cs.CL

Code-Aware Prompting: A study of Coverage Guided Test Generation in Regression Setting using LLM

Testing plays a pivotal role in ensuring software quality, yet conventional Search Based Software Testing (SBST) methods often struggle with complex software units, achieving suboptimal test coverage. Recent works using large language models (LLMs) for test generation have focused on improving generation quality through optimizing the test generation context and correcting errors in model outputs, but use fixed prompting strategies that prompt the model to generate tests without additional guidance. As a result LLM-generated testsuites still suffer from low coverage. In this paper, we present SymPrompt, a code-aware prompting strategy for LLMs in test generation. SymPrompt's approach is based on recent work that demonstrates LLMs can solve more complex logical problems when prompted to reason about the problem in a multi-step fashion. We apply this methodology to test generation by deconstructing the testsuite generation process into a multi-stage sequence, each of which is driven by a specific prompt aligned with the execution paths of the method under test, and exposing relevant type and dependency focal context to the model. Our approach enables pretrained LLMs to generate more complete test cases without any additional training. We implement SymPrompt using the TreeSitter parsing framework and evaluate on a benchmark challenging methods from open source Python projects. SymPrompt enhances correct test generations by a factor of 5 and bolsters relative coverage by 26% for CodeGen2. Notably, when applied to GPT-4, SymPrompt improves coverage by over 2x compared to baseline prompting strategies.

cs.SE

Lightweight reranking for language model generations

Large Language Models (LLMs) can exhibit considerable variation in the quality of their sampled outputs. Reranking and selecting the best generation from the sampled set is a popular way of obtaining strong gains in generation quality. In this paper, we present a novel approach for reranking LLM generations. Unlike other techniques that might involve additional inferences or training a specialized reranker, our approach relies on easy to compute pairwise statistics between the generations that have minimal compute overhead. We show that our approach can be formalized as an extension of self-consistency and analyze its performance in that framework, theoretically as well as via simulations. We show strong improvements for selecting the best k generations for code generation tasks as well as robust improvements for the best generation for the tasks of autoformalization, summarization, and translation. While our approach only assumes black-box access to LLMs, we show that additional access to token probabilities can improve performance even further.

cs.AI