arXiv Science⌕ Search

arXiv subjects

Zheng Zheng

Publications and source records attributed to Zheng Zheng.

At least 19 recordsLinked to original sources

The Milky Way-like radial structure in nearby galaxies

The Milky Way exhibits a distinctive plateau in its inner surface brightness profile around one effective radius, challenging the traditional view of a purely exponential disk. To explore the origin of this feature, we identify 65 nearby galaxies ($<50$ Mpc) with similar plateau structures and analyze their multi-band surface brightness and color profiles using SDSS, DESI, 2MASS, and Mephisto data. Of the 65 galaxies with Milky Way-like plateaus, 42 have bar classifications (25 barred, 17 non-barred). Barred galaxies show radial color variations more consistent with stellar population ageing, while non-barred galaxies align more with the dust reddening direction, suggesting dust attenuation contributes to plateau formation in non-barred systems. The broad range of color gradients among barred galaxies suggests bars influence plateaus through multiple pathways, including stellar population variations and dynamical stellar-mass redistribution. Environment may also contribute: both barred and non-barred galaxies tend to reside in denser environments than a comparison sample without plateaus. The low occurrence rate ($\sim$3.6\%) may indicate that plateau structures mark a relatively uncommon evolutionary stage. The Milky Way, with both strong stellar population dependence and a persistent stellar mass profile feature, may represent an intermediate case where both stellar population variations and dynamical processes associated with the bar shape its plateau.

astro-ph.GA↗

LGMT: A Tool for Testing the Logical Reasoning Reliability of LLMs

Large Language Models (LLMs) increasingly serve as reasoning components in modern software systems, yet a model that answers a logical query correctly can contradict itself when the same problem is restated in an equivalent form. Static benchmarks evaluate queries in isolation and therefore fail to expose such inconsistencies. To address this limitation, we present LGMT, an open-source tool that detects reasoning inconsistencies through metamorphic relations grounded in first-order logic. Given a source test case in premise-conclusion form, LGMT generates logically equivalent follow-up cases and checks whether the model's entailment predictions agree across the pair, without ground-truth labels. The tool provides 20 built-in metamorphic relations, supports custom ones verified by the Z3 theorem prover, and runs from a CLI or a web studio, including an offline mock mode requiring no API key. Across six widely used LLMs on a bundled benchmark of 3,091 metamorphic groups, LGMT reveals inconsistency rates ranging from 20.84% to 29.44%. LGMT is publicly available on GitHub at https://github.com/MaxwelsDonc/lgmt-tool, with a demonstration video at https://youtu.be/gou4opptu1U.

cs.AI↗

CC4Q Workbench: From Quantum Repositories to Analyzable Code Comments

Quantum software development kits (SDKs) expose high-level APIs whose use requires an understanding of underlying mathematical principles, circuit semantics, and hardware properties. Code comments can provide natural-language or structural explanations that are not explicit in API calls. However, studying comments in a new quantum SDK still requires researchers to coordinate separate steps for comment extraction, quantum-specific classification, and manual verification, resulting in repeated integration effort. To address this problem, we present CC4Q Workbench, an open-source workbench that integrates these steps into a reusable workflow. Given a Python repository at a specified revision, CC4Q Workbench automatically extracts code-comment pairs, segments comments into sentence-level units, and applies two trained classifiers to identify quantum-specific content and assign quantum-knowledge categories. Its web interface supports exploration of bundled datasets, inspection of code snippets, corpus construction from new repositories, manual annotation with model predictions hidden during binary labeling, and classifier fine-tuning using exported annotations. The release provides aggregate statistics for six SDK datasets comprising 39,593 sentence-level code comment units (SCCUs), of which 17,517 are browsable in the web interface. Applied to three additional application-layer Qiskit repositories outside the original CC4Q dataset, the pipeline ran without code changes and produced 11,517 SCCUs. Manual verification of 379 SCCUs showed 85.0% agreement between human annotations and the binary classifier's predictions.

cs.SE↗

DeepGroundRepair: From API-Grounded Generation to Shape-Aware Repair for Deep Learning Programs

Deep learning programs are fundamental to modern AI applications, and automatically generating them from natural language requirements can substantially reduce DL development effort. Large language models have demonstrated promising capabilities for this direction. However, generated DL programs often remain unreliable because they must satisfy domain specific API usage constraints and tensor shape dependencies, violations of which can cause API level syntactic issues and runtime failures. Existing retrieval augmented generation and feedback guided code repair methods do not adequately address these DL specific constraints. In this paper, we propose DeepGroundRepair, a three stage framework that establishes a generation localization repair workflow to improve the reliability of LLM-generated DL programs. Its key idea is to progressively narrow the generation and repair spaces using DL specific knowledge and runtime tensor information. Specifically, it grounds generation in task-relevant API knowledge, localizes the upstream causes of tensor shape mismatch failures, and uses runtime tensor shapes to guide parameter repair. We evaluate DeepGroundRepair on the 100 model-level DL programming tasks in DeepEval using six open-weight LLMs across TensorFlow, PyTorch, and PaddlePaddle. We compare it with four baselines: two generation-only methods and their counterparts incorporating traceback guided self debugging. The results show that, relative to these baselines, DeepGroundRepair reduces the combined number of API-level syntactic issues by an average of 5.4 per 10 program files and achieves an average relative improvement of 85.3% in code executability. Compared with the two self debugging baselines, it improves semantic consistency by an average of 18.1% and reduces token cost by an average of 28.4%.

cs.SE↗

The FAST HI 21-cm Absorption Blind Survey. III. OH Absorption Search in the 21-cm Absorber Sample and Continued HI Absorption Search

We present the first blind search for OH 18-cm absorption with the Five-hundred-meter Aperture Spherical Telescope (FAST), conducted alongside the HI 21-cm absorption search. Our previous FAST blind HI absorption search identified 34 systems. In this work, we extend the search using 2024 and part of the 2025 CRAFTS and FASHI data (394.4 hr and 1622.1 deg$^{2}$) together with FATHOMER observations, yielding four known and three new HI absorbers, for a total of 41 HI absorption systems. We search for OH absorption in 19 HI absorption systems whose OH redshifted frequencies fall within the FAST band. The known OH absorber towards PKS 1413+135 was re-detected, making our survey the first blind survey to detect OH absorption. No new OH absorbers were identified. We examine the relationship between $N_{\rm{OH}}$ and $N_{\rm{HI}}$, applying survival analysis to account for upper limits. The analysis does not provide statistically significant evidence for either an $N_{\rm{OH}}$-$N_{\rm{HI}}$ correlation or redshift evolution of $N_{\rm{OH}}$/$N_{\rm{HI}}$. Finally, spectral stacking sets 3$σ$ OH column density upper limits of 4.93, 1.64, and 1.72 $T_{\rm{ex}}$/$c_{\rm{f,OH}}\times$10$^{12}$cm$^{-2}$K$^{-1}$ for associated, intervening, and combined samples, corresponding to [\rm{OH}]/[\rm{HI}] ratios of $<$1.66$\times$10$^{-8}$, $<$1.42$\times$10$^{-8}$, and $<$0.90$\times$10$^{-8}$, assuming $T_{\rm{ex}}$=10K for OH and $T_{\rm{s}}$=100K for HI. These results place the strongest constraints to date on the OH content in radio-selected HI absorbers and establish a blind-survey benchmark for future studies of molecular gas in HI-selected systems. They also demonstrate that known HI 21-cm absorbers provide an effective parent sample for systematic OH absorption searches, paving the way for future larger surveys.

astro-ph.GA↗

The conditional colour-magnitude distribution: III. A study of galaxy colour- and luminosity-dependent counts-in-cells statistics

The conditional colour-magnitude distribution (CCMD) model connects the galaxy colour-luminosity distribution with dark matter halo mass, which has been constrained in Xu et al. by jointly modelling the two-point correlation functions of a large galaxy sample of the Sloan Digital Sky Survey (SDSS) in fine bins of galaxy colour and luminosity. We test the CCMD model of the galaxy-halo connection using counts-in-cells (CIC) statistics by comparing CCMD model predictions with SDSS measurements for 16 subsamples of galaxies in various luminosity and colour bins. In addition, we compare SDSS measurements with three analytic models of CIC distribution. The CCMD model provides a good description of the SDSS CIC measurements for most subsamples. The exceptions are the void probability functions and CIC distributions with cell radius 5 Mpc/h for a few subsamples in the luminous bins, which are not well described by the analytic models, either. For these subsamples, in general, removing the Sloan Great Wall from SDSS or introducing velocity bias to the CCMD model does not resolve the disagreement. Finally, with the help of the CCMD mocks, we investigate the cause of the variations of the galaxy counts in cells. For small cells or cells with a low mean galaxy count, the variation reflects effects from fluctuations in both the matter environment and the halo occupation distribution, while for large cells or cells with a high mean galaxy count, the environment effect dominates. We discuss the implications of our work for investigating galaxy assembly bias.

astro-ph.GA↗

Lower central dark matter densities in nearby galaxies than predicted by simulations

Baryonic feedback in hydrodynamical simulations is typically invoked to alleviate the core--cusp problem in dwarf galaxies. Yet baryonic processes also induce adiabatic contraction of dark matter, producing overly steep density profiles and excessively high dark matter fractions in the inner regions of massive galaxies. The dark matter distribution of galaxies across a wide stellar-mass range is therefore a critical test for such simulations, but a comprehensive benchmark has remained absent. Here, we consistently measure the dark matter distribution from galaxy centres out to radii of 20--50 kpc for 136 nearby galaxies that together span the local mass--size relation over the stellar mass interval $10^9$--$10^{11.5}\,M_{\odot}$. We identify central regions with lower dark matter densities relative to $Λ$CDM simulation expectations---whose extent grows from about 10 kpc to $>50$ kpc as stellar mass increases from $10^{10} M_{\odot}$ to $10^{11.5} M_{\odot}$. Although their physical origin remains unclear, these low--dark matter regions are clearly indicated by the data. Our results provide an important observational benchmark for future hydrodynamical simulations that explore alternative dark matter models and feedback processes.

astro-ph.GA↗

Galactic HII regions in LAMOST Medium-Resolution Spectroscopic Survey of Nebulae

Based on LAMOST Medium-Resolution Spectroscopic Survey of Nebulae (MRS-N) data and WISE Galactic HII region catalog, we construct a sample of 280 Galactic HII regions and candidates in the Outer Galaxy (80$^{\circ}$ $\lesssim$ l $\lesssim$ 220$^{\circ}$). Using MRS-N optical spectra, we measure four emission lines (H$α$, [NII]$λ$6584, [SII]$λλ$6717,6731) and use line-ratios to spectroscopically confirm 255 HII regions, including 90 previously "Known" HII regions and 165 newly classified ones. We measure their $T_{\rm e}$, $n_{\rm e}$ and oxygen abundance, and determine distances via associated OB stars and the kinematic method. The sample spans $R_{\rm gal}$ from 8.16 to 15.36 kpc, enabling investigation of radial gradients in physical properties. We find [NII]/H$α$ and [SII]/H$α$ decrease with increasing $R_{\rm gal}$, while [SII]/[NII] remains nearly flat; these trends are quite different from diffuse ionized gas (DIG). We derive the $T_{\rm e}$ gradient of 344.530 $\pm$ 78.083 K kpc$^{-1}$, and the $\log n_{\rm e}$ gradient of -0.143 $\pm$ 0.041 cm$^{-3}$ kpc$^{-1}$. Oxygen abundance shows a steep slope of -0.044 $\pm$ 0.010 dex kpc$^{-1}$ in the inner disk and a shallow slope of -0.016 $\pm$ 0.005 dex kpc$^{-1}$ in the outer disk, with a global slope of -0.014 $\pm$ 0.005 dex kpc$^{-1}$. We also examine the two-dimensional distributions of $T_{\rm e}$, $n_{\rm e}$, and oxygen abundance, and find the gradients vary with azimuth. There is no obvious difference between spiral arm and interarm regions, and no trend appears along individual arms. From [NII]/H$α$-[SII]$λ$6717/H$α$ diagram, HII regions have a S$^+$/S ratio (0.32), lower than DIG (0.43); however, heavy overlap prevents clear separation from this diagram alone.

astro-ph.GA↗

The disrupted chemical enrichment history of the Milky Way driven by gas accretion

As the only galaxy enabling temporally-resolved observations from an internal vantage point, the Milky Way as a galaxy offers unique insights into galactic chemical enrichment history, establishment of fundamental scaling relations, and the underlying astrophysical processes. However, this insider perspective also introduces strong selection effects, hindering direct measurement of the Milky Way's global properties and comparison with the broader galaxy population, for the vast majority of which only integrated properties can be measured. {Here we report our measurements of the Milky Way's temporally-resolved galaxy-scale average metallicity using data from the APOGEE survey after correction for the selection function. Our findings unveil a present-day metallicity of the Milky Way close to the Sun, an interrupted integrated age-metallicity relation, and a disturbed evolutionary trajectory in the mass-metallicity diagram, likely caused by dilution and inside-out growth associated with external gas accretion around 7~Gyr ago. Our results highlight the critical role of gas accretion in disrupting the galactic enrichment histories and introducing scatter in mass-metallicity relations.

astro-ph.GA↗

High-Fidelity Mural Restoration via a Unified Hybrid Mask-Aware Transformer

Ancient murals are valuable cultural artifacts, but many have suffered severe degradation due to environmental exposure, material aging, and human activity. Restoring these artworks is challenging because it requires both reconstructing large missing structures and preserving authentic, undamaged regions. We present the Hybrid Mask-Aware Transformer (HMAT), a unified framework for high-fidelity mural restoration that addresses both structural completion and authentic-region preservation. HMAT integrates Mask-Aware Dynamic Filtering for robust local texture modeling with a Transformer bottleneck for long-range structural inference, enabling recovery of continuous line patterns and coherent mural structures under irregular damage. To handle diverse degradation morphologies, we introduce a mask-conditional style fusion module that adapts the generative process according to the shape and extent of missing regions. We also propose a fidelity-oriented training objective that combines hole-normalized reconstruction, discriminator feature matching, and high-receptive-field perceptual supervision to improve damaged-region fidelity, texture consistency, and boundary quality. In addition, we analyze a Teacher-Forcing Decoder with hard-gated skip connections as a feature-space boundary-conditioning strategy. Experiments show that HMAT matches or outperforms representative convolutional, transformer-based, and edge-guided inpainting baselines, with especially strong gains in perceptual realism and severe-mask settings. Ablation studies further identify the proposed objective, MADF-based mask-aware encoding, and mask-conditioned synthesis as the main contributors to restoration quality. These results demonstrate that HMAT provides an effective and competitive solution for cultural heritage mural restoration.

cs.CV↗

Weak Evolution of Cosmic Atomic Hydrogen over the Past 4.5 Billion Years

The cosmic star formation rate density (CSFRD) has declined sharply toward the present day, but the roles of the atomic and molecular gas reservoirs remain uncertain. We measure the cosmic HI density, $Ω_{\mathrm{HI}}$, over $0<z<0.41$ by combining HI spectra from the Five-hundred-meter Aperture Spherical Telescope with optical spectroscopy from the Dark Energy Spectroscopic Instrument for $\sim2.5$ million galaxies across $\sim12,000\,{\rm deg}^2$. We measure a raw decrease in $Ω_{\mathrm{HI}}$ by a factor of $1.35\pm0.10$ over the past 4.5 Gyr. Even after applying the conservative systematic corrections from our forward model, the inferred decline is only $1.12\pm0.10$ -- still far weaker than the CSFRD decline (a factor of 2.46). The molecular gas density, in contrast, is known to evolve more closely with star formation. At fixed stellar mass, the average HI gas fraction evolves by less than 0.2 dex, showing that the weak evolution is present across the galaxy population. These quantitative differences rule out rapid depletion of galaxy HI as the primary driver of the late-time CSFRD decline, and provide a stringent benchmark for models of gas accretion, phase conversion and star-formation regulation.

astro-ph.GA↗

Analytical and fitting formulae for solutions to Lyman-alpha radiative transfer equations: the effects of geometry, recoil, and velocity gradients

Lyman-alpha (Ly$α$) radiative transfer (RT) is important in many astrophysical environments and governed by multiple physical processes. In this paper, we provide analytical formulae/procedures for the solutions to Ly$α$ RT equations under three simple geometrical symmetries and investigate the effects of atomic recoil and gas bulk motion. We first study Ly$α$ spectra by solving Ly$α$ RT equations for a static, uniform gas cloud under cylindrical geometry. The solution is verified through Ly$α$ Monte Carlo RT simulations, and compared to those under slab and spherical geometries in literature. Second, to characterise the recoil effect, we empirically modify recoil-free Ly$α$ spectra. The method is motivated by Ly$α$ RT equations with recoil and justified by simulations. Finally, we account for constant velocity gradients in Ly$α$ RT equations and obtain series solutions for Ly$α$ spectra. The solutions demonstrate good agreement to Ly$α$ spectra from simulations for small velocity gradients (i.e. edge velocity $v_{\rm E}$ of a cloud being comparable to the thermal velocity $b$) but become less accurate for large ones. To characterise Ly$α$ spectra under large velocity gradients, we empirically extend the functional form of solutions and constrain them from fitting simulated Ly$α$ spectra. The resulting fitting formulae show significant improvement for large velocity gradients ($v_{\rm E}/b \sim 100$) under large optical depths. The analytical study of Ly$α$ spectra in this work completes the set of solutions under simple geometries, provides physical insights for Ly$α$ RT under recoil and velocity gradient, and develops analytical tools for theoretical studies that require inputs from Ly$α$ RT.

astro-ph.GA↗

LGMT: Logic-Grounded Metamorphic Testing for Evaluating the Reasoning Reliability of LLMs

Large Language Models (LLMs) achieve strong performance on logical reasoning benchmarks, yet their reliability remains uncertain. Existing evaluations rely on static benchmarks, which fail to assess robustness under logically equivalent transformations and often overestimate reasoning capability. We propose LGMT (Logic-Grounded Metamorphic Testing), an oracle-free framework that leverages first-order logic (FOL) to evaluate LLM reasoning. By deriving metamorphic relations from formal logical equivalences, LGMT constructs semantically invariant test cases and detects reasoning defects through cross-case consistency checking. Experiments on six state-of-the-art LLMs show that LGMT exposes substantial hidden defects missed by traditional reference-based evaluations. We further find that models are particularly sensitive to symbol-level and conclusion-level variations, and that advanced prompting such as Few-shot CoT only partially mitigates these issues. These results suggest that LLM evaluation should move beyond isolated correctness toward robustness under logical invariance. LGMT provides a principled and scalable approach for diagnosing reasoning failures.

cs.AI↗

Failure-Based Testing for Deep Reinforcement Learning Agents

Deep Reinforcement Learning (DRL) agents have been widely adopted across diverse domains to address challenging decision-making problems, such as autonomous driving and robotic control. Given that many of these applications are safety- and security-critical, rigorous testing of DRL agents is indispensable. Existing testing methods are typically guided by reward signals to detect failures. However, for well-trained agents, whose performance approaches optimal levels in standard operating conditions, reward signals remain generally high, making current methods ineffective at uncovering critical failures. To address these challenges, we propose a novel failure-based method that leverages task-induced failure insights to enhance failure detection capability while reducing the number of tests required. Since DRL agents are inherently designed with human-defined tasks, they provide valuable cues about task difficulty. Intuitively, a DRL agent is more likely to fail when confronted with a more difficult task; therefore, PRT prioritizes these tasks. Building on this foundation, we propose Prior Random Testing, a black-box failure-based testing method that enables targeted prioritization while preserving the diversity of generated test cases. Guided by task-induced failure insights, PRT prioritizes failure-prone regions of the input domain, thereby facilitating efficient failure detection. PRT is evaluated on four widely used benchmarks and compared with different state-of-the-art methods including fuzzing, search-based and generative-based methods. PRT ranks among the top performers in terms of both the cost of finding the first failure and the diversity of test cases. Notably, compared to random testing, PRT achieves better diversity and reduces the testing cost by over 50%.

cs.SE↗

Measurements of quasar proximity zones with the Ly$α$ forest of DESI Y1 quasars

The intergalactic medium (IGM) around quasars is shaped by their dense environments and by their excess ionizing radiation, forming a "quasar proximity zone" whose size and anisotropy depend on the quasar's halo mass, luminosity, age, and radiation geometry. Using over 10,000 quasar pairs from the Dark Energy Spectroscopic Instrument (DESI) Year 1 data, with projected comoving separations $r_{\perp} < 2\,h^{-1}{\rm Mpc}$, we investigate how the proximity zone of foreground quasars at $z\sim2{\rm-}3.5$ affects Lyman-alpha absorption in their background quasars. The large DESI sample enables unprecedented precision in measuring this "transverse proximity" effect, allowing a detailed investigation of the signal's dependence on the projected separation of quasar pairs and the luminosity of the foreground quasar. We find that enhanced gas clustering near quasars dominates over their ionizing effect, leading to stronger absorption on neighboring sightlines. Under the assumption that quasar ionizing luminosity is isotropic and steady, we infer the IGM overdensity profile in the vicinity of quasars, finding overdensities as high as $Δ\sim 10$ at comoving distance $\sim 1\,h^{-1}{\rm Mpc}$ from the most luminous systems. Surprisingly, however, we find no significant dependence of the proximity profile on the luminosity of the foreground quasar. This lack of luminosity dependence could reflect a cancellation between higher ionizing flux and higher gas overdensity, or it could indicate that quasar emission is highly time variable or anisotropic, so that the observed luminosity does not trace the ionizing flux on nearby sightlines.

astro-ph.GA↗

A Spatially Resolved HI Survey of Seyfert Galaxies: the Role of AGN Feedback in Shaping Atomic Gas Reservoirs

Active galactic nucleus (AGN) feedback is a key ingredient in galaxy evolution, yet its impact on the cold atomic gas reservoir -- the neutral hydrogen (HI) phase -- remains poorly constrained. We present the most extensive spatially resolved HI 21-cm survey of Seyfert AGN hosts to date, based on observations with the Giant Metrewave Radio Telescope (GMRT). Our high-resolution HI maps of eight Seyfert galaxies reveal detailed kinematics and surface density distributions of their atomic gas disks. We find that AGN-host galaxies exhibit a slightly shallower HI mass-size relation than the canonical relation or the SIMBA simulation predictions; however, the measured slope remains consistent with the canonical value within $2σ$ uncertainties. This result suggests that AGN feedback does not significantly disrupt the global extent or large-scale structure of atomic gas reservoirs. To investigate the internal HI kinematics in greater detail, we perform a 3D kinematic forward modeling of the HI disk in UGC 4503. Our analysis reveals an elevated intrinsic velocity dispersion of $σ= 14.9^{+6.1}_{-3.8}$ km/s and a reduced level of rotational support, with $V/σ= 14.28_{-4.17}^{+4.97}$, compared to large-sample star-forming spirals. These kinematic signatures, together with localized residuals in the velocity field, indicate that AGN-driven outflows or jets may inject or indirectly affect the turbulence in the atomic gas disk, potentially regulating the cold gas reservoir. Future GMRT observations, combined with optical integral-field spectroscopy from MaNGA, will enable quantitative constraints on the role of AGN feedback in regulating star formation efficiency across a larger and more representative galaxy sample.

astro-ph.GA↗

Bidirectional Empowerment of Metamorphic Testing and Large Language Models: A Systematic Survey

Large language models (LLMs) have introduced substantial challenges to software quality assurance due to their generative, probabilistic, and open-ended nature, which intensifies the oracle problem and limits the applicability of traditional testing methods. Metamorphic testing (MT), which checks necessary relations among multiple related executions rather than relying on exact expected outputs, has emerged as a promising approach for testing LLMs and other oracle-deficient systems. At the same time, the strong semantic understanding, reasoning, and code generation capabilities of LLMs create new opportunities to automate the traditionally labor-intensive phases of MT. This survey systematically reviews 93 primary studies and characterizes this reciprocal relationship as the bidirectional empowerment of MT and LLMs. We propose a taxonomy spanning two complementary directions: MT for LLMs, which uses MT to verify, validate, assess, and understand LLMs and LLM-based systems across issues such as hallucination, fairness, robustness, code reliability, retrieval-augmented generation, dialogue, and autonomous agents; and LLMs for MT, which leverages LLMs to support metamorphic relation discovery, input transformation and synthesis, executable test implementation, and agentic closed-loop testing. By synthesizing these developments, this survey provides a structured foundation for understanding the evolving synergy between MT and LLMs and highlights future directions for building more rigorous, scalable, and trustworthy AI quality assurance methodologies.

cs.SE↗

PCREQ: Automated Inference of Compatible Requirements for Python Third-party Library Upgrades

Python third-party libraries (TPLs) are essential in modern software development, but upgrades often cause compatibility issues, leading to system failures. These issues fall into two categories: version compatibility issues (VCIs) and code compatibility issues (CCIs). Existing tools mainly detect dependency conflicts but overlook code-level incompatibilities, with no solution fully automating the inference of compatible versions for both VCIs and CCIs. To fill this gap, we propose PCREQ, the first approach to automatically infer compatible requirements by combining version and code compatibility analysis. PCREQ integrates six modules: knowledge acquisition, version compatibility assessment, invoked APIs and modules extraction, code compatibility assessment, version change, and missing TPL completion. PCREQ collects candidate versions, checks for conflicts, identifies API usage, evaluates code compatibility, and iteratively adjusts versions to generate a compatible requirements.txt with a detailed repair report. To evaluate PCREQ, we construct REQBench, a real-world benchmark with 2,095 upgrade scenarios derived from 34 real-world scientific/ML Python projects. Results show PCREQ achieves a 94.03% inference success rate, outperforming PyEGo (37.02%), ReadPyE (37.16%), and LLM-based approaches (GPT-4o, DeepSeek V3/R1) by 18--22%. PCREQ processes each scenario from REQBench in 60.79 s on average, demonstrating practical efficiency. PCREQ reduces manual effort in troubleshooting upgrades, advancing Python dependency maintenance automation.

cs.SE↗