90 research outputs found

    When Neural Code Completion Models Size up the Situation: Attaining Cheaper and Faster Completion through Dynamic Model Inference

    Full text link
    Leveraging recent advancements in large language models, modern neural code completion models have demonstrated the capability to generate highly accurate code suggestions. However, their massive size poses challenges in terms of computational costs and environmental impact, hindering their widespread adoption in practical scenarios. Dynamic inference emerges as a promising solution, as it allocates minimal computation during inference while maintaining the model's performance. In this research, we explore dynamic inference within the context of code completion. Initially, we conducted an empirical investigation on GPT-2, focusing on the inference capabilities of intermediate layers for code completion. We found that 54.4% of tokens can be accurately generated using just the first layer, signifying significant computational savings potential. Moreover, despite using all layers, the model still fails to predict 14.5% of tokens correctly, and the subsequent completions continued from them are rarely considered helpful, with only a 4.2% Acceptance Rate. These findings motivate our exploration of dynamic inference in code completion and inspire us to enhance it with a decision-making mechanism that stops the generation of incorrect code. We thus propose a novel dynamic inference method specifically tailored for code completion models. This method aims not only to produce correct predictions with largely reduced computation but also to prevent incorrect predictions proactively. Our extensive evaluation shows that it can averagely skip 1.7 layers out of 16 layers in the models, leading to an 11.2% speedup with only a marginal 1.1% reduction in ROUGE-L.Comment: Accepted to ICSE2

    Predicting adsorbed gas capacity of deep shales under high temperature and pressure: Experiments and modeling

    Get PDF
    Temperature and pressure conditions of deep shale are beyond experiment range, and the amount of adsorbed gas is difficult to determine. To predict the adsorbed gas content of deep shales under formation conditions, isothermal adsorption experiments and model building were conducted on shale samples from Longmaxi Formation in China. A temperature-dependent adsorption model based on the Langmuir equation is proposed, which can be well-fitted by observed isotherms with a high correlation coefficient. Based on the fitted parameters at 303.15 K, the isothermal adsorption curves at 333.15 K, 363.15 K, and 393.15 K are predicted, showing a good agreement with experimental curves available. Compared with previous prediction methods, the biggest advantage of the proposed method is that it can be carried out only based on one-time isothermal adsorption experiment. Based on the predictions, the downward trend of the excess adsorption curves will slow down under high temperature and pressure conditions, and when the pressure reaches a certain level (> 80 MPa), the temperature has little effect on the excess adsorption capacity. While for absolute adsorption, the gas adsorption reaches saturation much slowly at high temperature, it can also reach saturation under formation pressure. Under the burial depth of marine shale, temperature plays a major role in controlling the adsorbed gas, resulting in the decrease of adsorbed gas content in deep shale, and its ratio will further decrease as the depth increases.Cited as: Zhou, S., Wang, H., Li, B., Li, S., Sepehrnoori, K., Cai, J. Predicting adsorbed gas capacity of deep shales under high temperature and pressure: Experiments and modeling. Advances in Geo-Energy Research, 2022, 6(6): 482-491. https://doi.org/10.46690/ager.2022.06.0

    Large Language Models are Few-Shot Summarizers: Multi-Intent Comment Generation via In-Context Learning

    Full text link
    Code comment generation aims at generating natural language descriptions for a code snippet to facilitate developers' program comprehension activities. Despite being studied for a long time, a bottleneck for existing approaches is that given a code snippet, they can only generate one comment while developers usually need to know information from diverse perspectives such as what is the functionality of this code snippet and how to use it. To tackle this limitation, this study empirically investigates the feasibility of utilizing large language models (LLMs) to generate comments that can fulfill developers' diverse intents. Our intuition is based on the facts that (1) the code and its pairwise comment are used during the pre-training process of LLMs to build the semantic connection between the natural language and programming language, and (2) comments in the real-world projects, which are collected for the pre-training, usually contain different developers' intents. We thus postulate that the LLMs can already understand the code from different perspectives after the pre-training. Indeed, experiments on two large-scale datasets demonstrate the rationale of our insights: by adopting the in-context learning paradigm and giving adequate prompts to the LLM (e.g., providing it with ten or more examples), the LLM can significantly outperform a state-of-the-art supervised learning approach on generating comments with multiple intents. Results also show that customized strategies for constructing the prompts and post-processing strategies for reranking the results can both boost the LLM's performances, which shed light on future research directions for using LLMs to achieve comment generation.Comment: Accepted by the 46th International Conference on Software Engineering (ICSE 2024

    Investigation of methane adsorption mechanism on Longmaxi shale by combining the micropore filling and monolayer coverage theories

    Get PDF
    Understanding the methane adsorption mechanism is critical for studying shale gas storage and transport in shale nanopores. In this work, we conducted low-pressure nitrogen adsorption (LPNA), scanning electron microscopy (SEM), and high-pressure methane adsorption experiments on seven shale samples from the Longmaxi formation in Sichuan basin. LPNA and SEM results show that pores in the shale samples are mainly nanometer-sized and have a broad size distribution. We have also shown that methane should be not only adsorbed in micropores (< 2 nm) but also in mesopores (2-50 nm) by two hypotheses. Therefore, we established a novel DA-LF model by combining the micropore filling and monolayer coverage theories to describe the methane adsorption process in shale. This new model can fit the high-pressure isotherms quite well, and the fitting error of this new model is slightly smaller than the commonly used D-A and L-F models. The absolute adsorption isotherms and the capacities for micropores and mesopores can be calculated using this new model separately, showing that 77% to 97% of methane molecules are adsorbed in micropores. In addition, we conclude that the methane adsorption mechanism in shale is: the majority of methane molecules are filled in micropores, and the remainder are monolayer-adsorbed in mesopores. It is anticipated that our results provide a more accurate explanation of the shale gas adsorption mechanism in shale formations.Cited as: Zhou, S., Ning, Y., Wang, H., Liu, H., Xue, H. Investigation of methane adsorption mechanism on Longmaxi shale by combining the micropore filling and monolayer coverage theories. Advances in Geo-Energy Research, 2018, 2(3): 269-281, doi: 10.26804/ager.2018.03.0

    Bis(diethyl­enetriamine)­cobalt(III) hexa­chloridoindate(III)

    Get PDF
    The title compound, [Co(C4H13N3)2][InCl6], was synthesized under hydro­thermal conditions. In the cation, the Co—N bond lengths lie in the range 1.967 (2)–1.9684 (15) Å. In the anion, the InIII atom is coordinated by six Cl atoms resulting in a slightly distorted octa­hedral geometry. Both metal atoms are located on special positions of site symmetry 2/m. Furthermore, one Cl atom and one N atom are located on a mirror plane. N—H⋯Cl hydrogen bonds between cations and anions consolidate the crystal packing

    Keyframe image processing of semantic 3D point clouds based on deep learning

    Get PDF
    With the rapid development of web technologies and the popularity of smartphones, users are uploading and sharing a large number of images every day. Therefore, it is a very important issue nowadays to enable users to discover exactly the information they need in the vast amount of data and to make it possible to integrate their large amount of image material efficiently. However, traditional content-based image retrieval techniques are based on images, and there is a “semantic gap” between this and people's understanding of images. To address this “semantic gap,” a keyframe image processing method for 3D point clouds is proposed, and based on this, a U-Net-based binary data stream semantic segmentation network is established for keyframe image processing of 3D point clouds in combination with deep learning techniques
    corecore