<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Corneliu Cofaru</title>
    <description>The latest articles on DEV Community by Corneliu Cofaru (@zgornel).</description>
    <link>https://dev.to/zgornel</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3909596%2F97c5a110-5bc7-4ba6-b9c3-467333e92bf2.jpeg</url>
      <title>DEV Community: Corneliu Cofaru</title>
      <link>https://dev.to/zgornel</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/zgornel"/>
    <language>en</language>
    <item>
      <title>Linting and Improving Data Science Workflows</title>
      <dc:creator>Corneliu Cofaru</dc:creator>
      <pubDate>Wed, 04 Nov 2026 15:28:15 +0000</pubDate>
      <link>https://dev.to/zgornel/linting-and-improving-data-science-workflows-493a</link>
      <guid>https://dev.to/zgornel/linting-and-improving-data-science-workflows-493a</guid>
      <description>&lt;p&gt;by &lt;strong&gt;Corneliu Cofaru&lt;/strong&gt;, &lt;strong&gt;Adrian Iurov&lt;/strong&gt; at 0x0α Research.  &lt;/p&gt;

&lt;p&gt;In this article we explore&lt;sup id="fnref1"&gt;1&lt;/sup&gt; how LLM-generated code can be reliably&lt;br&gt;
  used in data science experiments and workflows. The aim is to&lt;br&gt;
  illustrate the potential of combining language models with code and&lt;br&gt;
  data quality tools. We devise a simple regression experiment in which&lt;br&gt;
  a LLM generates code in R, starting from anonymized tabular data based&lt;br&gt;
  on the ’Ames housing’ dataset. The generated code is then executed and&lt;br&gt;
  interactively analyzed with a linter capable of running checks on both&lt;br&gt;
  data results and code simultaneously. Results from the linter are then&lt;br&gt;
  fed back into the LLM and new code is generated which in its turn&lt;br&gt;
  produces an improved model with a lower error than the original one.&lt;/p&gt;

&lt;h2&gt;
  
  
  The theory
&lt;/h2&gt;

&lt;p&gt;LLMs are starting to be used in generating analysis code in data science&lt;br&gt;
workflows with seemingly good results [1, 2]. The general approach to obtain&lt;br&gt;
the code relies on building first a prompt that describes in more or&lt;br&gt;
less objective terms the dataset, its properties, column names and&lt;br&gt;
meanings, etc. Such an LLM-based data analysis workflow is depicted in&lt;br&gt;
the image below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmk76f1qtm5uw994somfl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmk76f1qtm5uw994somfl.png" alt="LLM-based code generation for R" width="642" height="189"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The workflow can be summarized as follows:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;construct a code-generation LLM prompt from dataset properties&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;run the LLM using the prompt to obtain R code&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;execute the R code and obtain original RMSE&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The results of this approach seem to be encouraging and indicate that&lt;br&gt;
there is definitely a pathway forward for the use of LLMs in data&lt;br&gt;
science. However, LLMs have the limitation that they cannot perform&lt;br&gt;
reliably simple numerical operations - counting, averaging, that are&lt;br&gt;
crucial in data analysis and trivial for general purpose programs to&lt;br&gt;
perform. This becomes a problem in code generation where the code&lt;br&gt;
correctness is dependent on exact data properties that are extracted&lt;br&gt;
using such operations. Moreover, the code may contain operations that&lt;br&gt;
modify the data in ways that make it irrelevant with respect to the&lt;br&gt;
initial prompt used to generate the code itself. Lastly, data sizes and&lt;br&gt;
complexity matter - one cannot simply feed whole datasets to the LLM and&lt;br&gt;
expect reliable results. Even though this could be possible due to some&lt;br&gt;
learnt structures that associate data properties to modelling code&lt;br&gt;
within the language model it is definitely the exception and not the&lt;br&gt;
rule. These considerations lead to a more nuanced approach in using&lt;br&gt;
LLMs, one in which code analysis, data analysis and corrective feedback&lt;br&gt;
on code and/or data using specialized programs becomes a necessary&lt;br&gt;
requirement.&lt;/p&gt;

&lt;p&gt;In data science, the experimental design challenge is complicated by the&lt;br&gt;
fact that more often than not, model correctness and performance depend&lt;br&gt;
on both data and code. This is an additional argument for the necessity&lt;br&gt;
of a feedback loop with information related to data and the&lt;br&gt;
LLM-generated code that models it. Here we use DataLinter [3], a tool we&lt;br&gt;
developed that can find issues by analyzing simultaneously data and&lt;br&gt;
code. If we add the linter-based LLM feedback loop to the original data&lt;br&gt;
analysis workflow, we obtain a new one, represented in the figure below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fee6sp9du8mp3sjccvbg3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fee6sp9du8mp3sjccvbg3.png" alt="LLM-based code generation for R with feedback" width="642" height="557"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The new workflow, that integrates data and code corrections, becomes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;construct a code-generation LLM prompt from dataset properties&lt;br&gt;
&lt;strong&gt;(same as before)&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;run the LLM using the prompt to obtain R code &lt;strong&gt;(same as before)&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;execute the R code and obtain original RMSE &lt;strong&gt;(same as before)&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;run DataLinter on both data and modelling code&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;construct a code-improvement LLM prompt using linter output&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;run LLM using the new prompt and obtain new R code&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;execute the R code and obtain new RMSE&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;compare the two RMSEs&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  In practice
&lt;/h2&gt;

&lt;p&gt;To implement the LLM data analysis flow and feedback loops, we start by&lt;br&gt;
writing a simple Python script that extracts simple data statistics:&lt;br&gt;
column names, element types, number of &lt;code&gt;NA&lt;/code&gt;s/&lt;code&gt;Null&lt;/code&gt;s for each column as&lt;br&gt;
well as maximum, minimum, median and mean values (for numerical columns)&lt;br&gt;
and minimum and maximum element length (for string columns). The dataset&lt;br&gt;
column statistics are interpolated into a fixed-format string yielding&lt;br&gt;
the initial code-generation LLM prompt. An example can be viewed in this&lt;br&gt;
&lt;a href="https://github.com/OxoaResearch/LLM_DL_in_R_v001/blob/main/notebooks/first_experiment.ipynb" rel="noopener noreferrer"&gt;notebook&lt;/a&gt;.&lt;br&gt;
The prompt can be pasted into any LLM. We use Claude Opus 4.6 as R code&lt;br&gt;
generator&lt;sup id="fnref2"&gt;2&lt;/sup&gt;. After running the code in VSCode, we obtain a RMSE of&lt;br&gt;
27895.36.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fwtkdju9larbbmzi4555f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fwtkdju9larbbmzi4555f.png" alt="RMSE of initial generated R code." width="387" height="110"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To lint the modelling code and data, we use the DataLinter and its&lt;br&gt;
VSCode plugin for R. The linter is designed to work with data, code or&lt;br&gt;
both. Under the hood, the VSCode plugin sends to a linting server a&lt;br&gt;
snippet of code and any data variable identified. This is done simply by&lt;br&gt;
selecting code with the mouse and a right-click to the DataLinter menu&lt;br&gt;
option. Data extraction works by parsing the selected code and looking&lt;br&gt;
for &lt;code&gt;data = ...&lt;/code&gt; patterns present inside function calls. In this case,&lt;br&gt;
the contents of variable &lt;code&gt;train&lt;/code&gt; are sent along with the code&lt;br&gt;
&lt;code&gt;model &amp;lt;- lm(x81 &amp;nbsp; ., data = train)&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F7pgs1c5fajiez7jfngpf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F7pgs1c5fajiez7jfngpf.png" alt="Linting code snippets with DataLinter in VSCode" width="559" height="505"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftlinqgbe713vzzu7lyhx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftlinqgbe713vzzu7lyhx.png" alt="Linter results from DataLinter in VSCode" width="795" height="644"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The result is six problematic issues, shown in the figure above. The linter output is then used to&lt;br&gt;
construct the code-improvement LLM prompt and a new version of the R&lt;br&gt;
code&lt;sup id="fnref3"&gt;3&lt;/sup&gt;. The newly obtained code is ran and, after addressing issues&lt;br&gt;
such as numeric scale imbalance and target skew via standardization and&lt;br&gt;
a log transform, the RMSE improved!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F9ch4lon3p2lyq9b88jc2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F9ch4lon3p2lyq9b88jc2.png" alt="RMSE of the improved model obtained by&lt;br&gt;
integrating linter feedback" width="344" height="83"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Closing remarks
&lt;/h2&gt;

&lt;p&gt;To wrap things up, we are happy to have confirmed our initial assumption&lt;br&gt;
that code and data quality tools fit well and can improve LLM-based data&lt;br&gt;
science workflows. In this case, with very little effort we were able to&lt;br&gt;
improve model performance in our regression experiment. The only&lt;br&gt;
necessary condition to ensure correctness and performance of the code is&lt;br&gt;
for the linter to have a good coverage over the space of potential&lt;br&gt;
problems that may appear. This is in itself a big challenge and&lt;br&gt;
interesting area of research, especially for complex problematic&lt;br&gt;
patterns such as data leakage. We hope to address and tackle&lt;br&gt;
successfully these issues in future articles.&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Reuben Sarwal et al. &lt;a href="https://doi.org/10.1016/j.xcrm.2026.102594" rel="noopener noreferrer"&gt;Benchmarking large language models for predictive modeling in biomedical research with a focus on reproductive health&lt;/a&gt;. &lt;em&gt;Cell Reports Medicine&lt;/em&gt;, vol. 7, no. 2, pages 102594, 2026.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Robert Vacareanu, Vlad Andrei Negru, Vasile Suciu and Mihai Surdeanu. &lt;a href="https://arxiv.org/abs/2404.07544" rel="noopener noreferrer"&gt;From Words to Numbers: Your Large Language Model Is Secretly A Capable Regressor When Given In-Context Examples&lt;/a&gt;. First Conference on Language Modeling, 2024.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Corneliu Cofaru. &lt;a href="https://github.com/zgornel/DataLinter" rel="noopener noreferrer"&gt;DataLinter on GitHub&lt;/a&gt;, 2026.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Ivan Zalesskiy. &lt;a href="https://overchat.ai/ai-hub/best-local-llm-for-coding" rel="noopener noreferrer"&gt;Best Local LLM for Coding in 2026: Developer's Guide&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;




&lt;ol&gt;

&lt;li id="fn1"&gt;
&lt;p&gt;Code repository at: &lt;a href="https://github.com/OxoaResearch/LLM_DL_in_R_v001" rel="noopener noreferrer"&gt;https://github.com/OxoaResearch/LLM_DL_in_R_v001&lt;/a&gt;&amp;nbsp;↩&lt;/p&gt;
&lt;/li&gt;

&lt;li id="fn2"&gt;
&lt;p&gt;&lt;a href="https://github.com/OxoaResearch/LLM_DL_in_R_v001/blob/main/R_ai_generated/ames_claude.r" rel="noopener noreferrer"&gt;https://github.com/OxoaResearch/LLM_DL_in_R_v001/blob/main/R_ai_generated/ames_claude.r&lt;/a&gt;&amp;nbsp;↩&lt;/p&gt;
&lt;/li&gt;

&lt;li id="fn3"&gt;
&lt;p&gt;&lt;a href="https://github.com/OxoaResearch/LLM_DataLinter_pipeline/blob/main/R_ai_generated/ames_claude_fix.r" rel="noopener noreferrer"&gt;https://github.com/OxoaResearch/LLM_DataLinter_pipeline/blob/main/R_ai_generated/ames_claude_fix.r&lt;/a&gt;&amp;nbsp;↩&lt;/p&gt;
&lt;/li&gt;

&lt;/ol&gt;

</description>
      <category>datascience</category>
      <category>vscode</category>
      <category>ai</category>
      <category>machinelearning</category>
    </item>
  </channel>
</rss>
