惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Forbes - Security
Forbes - Security
A
Arctic Wolf
M
MIT News - Artificial intelligence
T
Threat Research - Cisco Blogs
T
The Exploit Database - CXSecurity.com
C
CERT Recently Published Vulnerability Notes
NISL@THU
NISL@THU
L
Lohrmann on Cybersecurity
Martin Fowler
Martin Fowler
A
About on SuperTechFans
P
Palo Alto Networks Blog
Project Zero
Project Zero
The GitHub Blog
The GitHub Blog
WordPress大学
WordPress大学
Blog — PlanetScale
Blog — PlanetScale
博客园_首页
大猫的无限游戏
大猫的无限游戏
Cisco Talos Blog
Cisco Talos Blog
P
Proofpoint News Feed
D
DataBreaches.Net
Cyberwarzone
Cyberwarzone
T
Tor Project blog
IT之家
IT之家
P
Proofpoint News Feed
Help Net Security
Help Net Security
S
Securelist
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
C
CXSECURITY Database RSS Feed - CXSecurity.com
Microsoft Azure Blog
Microsoft Azure Blog
V2EX - 技术
V2EX - 技术
K
Kaspersky official blog
Hugging Face - Blog
Hugging Face - Blog
MongoDB | Blog
MongoDB | Blog
B
Blog
N
News and Events Feed by Topic
The Cloudflare Blog
S
Schneier on Security
P
Privacy & Cybersecurity Law Blog
T
The Blog of Author Tim Ferriss
Recorded Future
Recorded Future
Last Week in AI
Last Week in AI
The Last Watchdog
The Last Watchdog
Hacker News - Newest:
Hacker News - Newest: "LLM"
L
LangChain Blog
I
InfoQ
F
Full Disclosure
The Register - Security
The Register - Security
阮一峰的网络日志
阮一峰的网络日志
H
Hacker News: Front Page
V
V2EX

Analytics Vidhya

Handling Imbalanced Classification: What Works Better Than SMOTE GPT-5.6 Is Here: Sol, Terra, and Luna Loop Engineering for AI Agents: How /loop is Changing AI Workflows DeepSeek DSpark: The Speculative Decoding Trick Behind 400% Faster LLM OKF: Redefining Knowledge Bases for AI Agents Modern VLMs Explained: How GPT-4o, Gemini, Claude Vision, and Qwen-VL Work YOLO26 Tutorial: Object Detection, Pose Estimation & More Large Action Models (LAMs) vs Agentic LLMs: What's the Real Difference? Claude Sonnet 5: The Fable 5 at Home The Best $20 AI Plan: ChatGPT Plus vs Claude Pro vs Gemini Pro GraphRAG vs Vector RAG: Which Retrieval Method is Best? Using AI When You Don’t Trust AI The Self-Improving Loop in AI Agents: Architecture, Benefits, and How it Outperforms Traditional Agent Workflows Harness-1: The 20B Retrieval Subagent That Beats GPT-5.4 at Search Sakana Fugu: Multi-Agent System as a Model Claude's Hidden Art Skill: Making Illustrations With Code System Design for ML Interviews: 10 Real Problems Walked Through Most People Use ChatGPT Wrong: 10 Features and Tips That Changed How I Work OpenAI Just Launched 3 Free AI Courses with Certificates Autoregressive Models: Predicting the Future Using the Past Gemini Omni: AI Video Generation Inside Gemini DiffusionGemma: Google’s Diffusion-Based Open Model for Faster Text Generation Top 10 AI Engineering Tools Everyone is Using in 2026 I Tested Claude Fable 5: Can Anthropic’s Newest AI Deliver on the Hype? Prophet vs NeuralProphet vs TimeGPT vs Chronos: A Practical Comparison Build an Emergency Helpline Voice Agent with LangChain Choosing the Right Vector Database for RAG and AI Applications Google Gemma 4 12B: Architecture, Benchmarks, Access, and Hands-on Guide for Developers How to Choose the Right AI Model for Your Needs Agent Observability with LangSmith, Langfuse, and Arize: A Hands-On Comparison How to Use Claude Managed Agents? Google AI Studio vs Gemini App: What’s the Difference? AI Workflows for Sales Teams: Prospect Research, Lead Qualification, and CRM Updates on Autopilot Using LangGraph 25 Most Influential AI Pioneers to Meet at DataHack Summit 2026 Claude Opus 4.8: A Smarter Model in the Right Direction PySpark Optimization: 12 Proven Techniques to Speed Up Your Spark Jobs 10 Everyday Tasks You Can Automate with AI Today (With n8n Templates) Google Antigravity 2.0: The Full Developer Guide (I/O 2026) Build a Claude Cowork-Like Browser Agent Using Playwright MCP and Claude Desktop Pandas vs Polars vs DuckDB: Which Library Should You Choose? Qwen3.7-Max: Alibaba’s New Agent-First LLM for Coding, Reasoning, and Long-Horizon AI Workflows The Biggest Announcements from Google I/O 2026 Top 9 AI Events and Conferences in 2026 that you Must Attend Gemini 3.5 Flash: Frontier Intelligence with Speed Kimi WebBridge: Hands-on Guide to Kimi’s Browser Extension for AI Agents 40 Advanced SQL Window Functions Every Data Scientist Must Know(with examples) Top 10 AI Research Papers of 2025 6 Steps to Crack GenAI Case Study Interviews (With Real Examples) OpenAI Omni Moderation: How to Filter Text & Images for Free DataHack Summit 2026: You Just Cannot Skip This AI Event of the Year OpenAI’s New API Voice Models Will Change the Way You Use AI Hermes Agent Guide: What is it and How to Use it? Top 10 LLM Research Papers of 2026 Agent Memory Patterns in Cognitive Science and AI Systems 10 AI Agents Every AI Engineer Must Build (with GitHub Samples) 23 Tips for Smart Claude Code Token Saving and Workflow Optimization ChatGPT is Now Inside Excel and Google Sheets: Here is How to Use it Gemini API File Search: The Easy Way to Build RAG Top 10 Open-Source Libraries to Fine-Tune LLMs Locally ML Intern in Practice: From Prompt to a Shipped Hugging Face Model 15+ Solved Agentic AI Projects with Github Links How People are Figuring Out Life With Claude MemPalace Explained: Building Long-Term Memory for AI Agents Beyond RAG Grok Voice Think Fast 1.0: Build Voice AI Agents That Actually Think Compressing LSTM Models for Retail Edge Deployment: A Practical Comparison MCP vs Agent Skills: Different Altogether GPT 5.5 vs Opus 4.7: Which is the Best AI Model Today? What is Agentic AI? Claude Code vs Codex: A Detailed Terminal Agent Comparison Google Deep Research Max: Build Autonomous AI Research Agents in Minutes Meta Muse Spark Review: Is It Worth the Hype? ChatGPT Images 2.0 vs Nano Banana 2: Which is Better? Cursor V3 Explained: The AI Coding Agent That’s Replacing Traditional IDEs in 2026 DeepSeek-V4: The Most Powerful Open-Source Model Ever Is GPT Image 2 the Best Image Generation Model? Token Economics: Why AI is Getting “Cheaper” From Idea to Output: Claude Does the Design Work Opus 4.7 vs Opus 4.6: Should You Switch? Build Human-Like AI Voice App with Gemini 3.1 Flash TTS How to Structure a Claude Code Project that Thinks Like an Engineer Gemma 4 Tool Calling Explained: Build AI Agents with Function Calling (Step-by-Step Guide) Anthropic Launches Claude Opus 4.7 For “Most Difficult Tasks” Top 28 Claude Shortcuts that will 10X your Speed GPT-5.4-Cyber: Why OpenAI is Keeping its Most Powerful Model Under Lock and Key Google AI Studio Guide: Every Feature Explained Mastering Deep Agents: Context Engineering that Actually Works 21 Computer Vision Projects from Beginner to Advanced (2026 Guide) Excel 101: Excel Agent Mode Explained MiniMax M2.7 Goes Open-Weight to Let You Run Agents Locally Top 10 Gemma 4 Projects That Will Blow Your Mind GLM-5.1: Architecture, Benchmarks, Capabilities & How to Use It Understanding BERTopic: From Raw Text to Interpretable Topics From Karpathy’s LLM Wiki to Graphify: AI Memory Layers are Here 10 Most Important AI Concepts Explained Simply Project Glasswing is World’s Most Powerful AI in Action How to Run Gemma 4 on Your Phone Without Internet: A Hands-On Guide Running Claude Code for Free with Gemma 4 and Ollama LLM Wiki Revolution: How Andrej Karpathy’s Idea is Changing AI Rethinking Enterprise Search: How Cortex Search Turns Data into Business Impact Google’s Gemma 4: Is it the Best Open-Source Model of 2026?
Feature Engineering with LLMs: Techniques & Python Examples
Vipin Vashisth · 2026-05-07 · via Analytics Vidhya

Feature engineering is the foundation of strong machine learning systems, but the traditional process is often manual, time-consuming, and dependent on domain expertise. While effective, it can miss deeper signals hidden in unstructured data such as text, logs, and user interactions.

Large Language Models change this by helping machines understand language, extract meaning, and generate richer features automatically. This shift opens new ways to build smarter ML pipelines. This article offers a practical guide to feature engineering using LLMs.

Table of contents

  • What is Feature Engineering with LLMs?
  • The Shift: From Manual Features to Semantic Features
  • Core Techniques in Feature Engineering with LLMs
    • Embeddings as Features
    • Prompt-Based Feature Extraction
    • Schema-guided extraction
    • Semantic Feature Generation
    • Context-Aware Feature Creation
  • Hybrid Feature Spaces (Multi-Modal Pipelines)
    • Combining Tabular, Text, and Embeddings
    • Multi-Modal Feature Pipelines
  • End-to-End Flow (Data → LLM → Features → Model)
  • Real-World Applications
  • Limitations and Challenges
  • Conclusion
  • Frequently Asked Questions

What is Feature Engineering with LLMs?

What is Feature Engineering

The process of feature engineering with LLMs uses large language models to develop and modify input features that machine learning systems require. Your system extracts semantic meaning and structured signals from raw data through the application of LLMs instead of using only manual transformations. 

The new approach to feature engineering enables engineers to develop machine learning models through different methods that include both numeric transformations and context-based representations. 

Feature engineering with LLMs uses pretrained language models to transform raw inputs into structured high-dimensional representations which help models achieve better performance. The models use context to determine relationships between elements while creating features that express meaning beyond statistical patterns. 

How it Differs from Traditional Feature Engineering 

Traditional feature engineering creates rules and uses aggregation and transformation methods to build features. LLM-based feature engineering extracts meaning and user intentions and relationship data which manual encoding fails to capture. 

The Shift: From Manual Features to Semantic Features

Machine learning develops models through its use of handmade features which include one-hot vectors and TF-IDF and standardized numerical values. Manual features come with restrictions because they do not consider context and require specialized knowledge and they do not handle subtle differences. The TF-IDF method handles words as separate entities which leads to the loss of word relationships and emotional meaning. 

  • Limitations of traditional methods: Manual feature creation requires permanent system connections and specific domain expertise. The system fails to include both general knowledge and intricate connections. A bag-of-words model requires more knowledge than “cold food” to recognize negative feelings. Human resources need to spend a lot of time to identify all exceptional situations.  
  • Role of LLMs in context: LLMs function in their respective contexts through LLMs which employ their training from extensive text databases to acquire knowledge and recognize patterns. The system understands language context through their presence of world knowledge and ability to comprehend hidden messages. The system extracts semantic features from data through LLMs which create automatic features that identify data elements like sentiment and topic and risk categories. 
  • Why this shift matters: The importance of this transition comes from its ability to show that semantic features deliver better results than human-created features when dealing with complicated tasks. The system needs fewer feature heuristics for its operations which results in faster testing processes. 

Core Techniques in Feature Engineering with LLMs

This section will illustrate the key methods with code examples. We generate small sample data and show how features are derived. 

Embeddings as Features

LLMs produce dense semantic vectors from text. The extracted embeddings function as numeric features which enable the model to understand meaning that exceeds basic word frequencies. We can use a transformer model to create 384-dimensional sentence embeddings through sentence encoding. 

from sentence_transformers import SentenceTransformer 


model = SentenceTransformer('all-MiniLM-L6-v2') 
sentences = ["I love machine learning", "The movie was fantastic"] 
embeddings = model.encode(sentences) 

print("Embeddings shape:", embeddings.shape)

Output: 

Embeddings shape: (2, 384) 

The output shape (2, 384) shows two sentences mapped into 384-dimensional dense vectors (one per sentence). The vectors represent semantic properties of the text which include related meanings and emotional expressions. 

When to use embeddings vs traditional features: 

from sklearn.feature_extraction.text import TfidfVectorizer


docs = [
    "The cat sat on the mat",
    "The dog ate the cat",
]

# Traditional TF-IDF: sparse bag-of-words
tfidf = TfidfVectorizer()
X_tfidf = tfidf.fit_transform(docs)

# LLM embeddings: dense semantic features
X_emb = model.encode(docs)

print("TF-IDF feature shape:", X_tfidf.shape)
print("LLM embedding feature shape:", X_emb.shape)

Output: 

TF-IDF feature shape: (2, 6) 

LLM embedding feature shape: (2, 384)

The TF-IDF features create a (2×6) sparse matrix which contains six unique terms, while the LLM embeddings exist as (2×384) dense vectors. The embeddings present meaning of words in their context because they show how synonyms relate to each other with the example of “cat” and “dog”. Use semantic features from embeddings while traditional features work for simple numeric data and high-frequency categorical data that requires sparse encoding. 

We can prompt the LLM to extract specific structured information from text. The model outputs can be parsed into features. 

from transformers import pipeline


reviews = [
    "The phone battery lasts all day and performance is smooth",
    "The laptop overheats and is very slow",
]

extractor = pipeline("text2text-generation", model="google/flan-t5-base")

prompt = """
Extract features: sentiment, product_issue, performance

Text: The laptop overheats and is very slow
"""

result = extractor(prompt, max_length=50)

print(result[0]["generated_text"])

Output:  

sentiment: negative, product_issue: overheating, performance: slow 

We use the LLM prompt which states “Extract sentiment (positive/negative), subject, and urgency (low/medium/high) from this review.” The model returns structured features as a JSON-like dictionary. The features of sentiment, subject, and urgency now exist as separate columns which we can input into our classifier system  

A JSON schema can be enforced in an invocation so that consistent outputs are ensured. For example: 

prompt = """
Extract in JSON format:

{
    "sentiment": "",
    "issue": "",
    "performance": ""
}

Text: The phone battery lasts all day and performance is smooth
"""

result = extractor(prompt, max_length=100)

print(result[0]["generated_text"])

Output: 


"sentiment": "positive", 
"issue": "none", 
"performance": "smooth" 
}

Semantic Feature Generation

LLMs generate fresh descriptive attributes which can be applied to both single rows and individual data values.  

data = [
    {"review": "Great camera quality but battery drains fast"},
    {"review": "Affordable and durable, good for daily use"},
]

prompt = """
Generate a new feature called 'user_intent' from this review:

Review: Great camera quality but battery drains fast
"""

result = extractor(prompt, max_length=50)
print(result[0]["generated_text"])

Output: 

user_intent: photography-focused but concerned about battery 

The LLM extracts user intent from the review through its analysis of the text. The system transforms unprocessed text into structured features which show user preference for cameras and their concern about battery life. The system enables users to add new columns which improve model understanding of user activity patterns. 

Context-Aware Feature Creation

LLMs can generate text features when they use their knowledge to analyze a feature’s value within specific situations. The LLM uses postal code information to explain the corresponding geographic area.  

prompt = """ 

Infer customer type: 
Review: Affordable and durable, good for daily use 

""" 

result = extractor(prompt, max_length=50) 
print(result[0]['generated_text'])

Output: 

customer_type: budget-conscious practical user 

The LLM uses customer review information to determine which customer group the reviewer belongs to. The system transforms input text into a standardized label which displays the user’s two main preferences of affordable and durable products. The system allows users to implement a new feature which enables models to categorize users according to their behavioural patterns and specific preferences. 

Hybrid Feature Spaces (Multi-Modal Pipelines)

Combining Tabular, Text, and Embeddings

We start with numeric features and semantic features which we combine into a hybrid vector.  

import pandas as pd
import numpy as np


df = pd.DataFrame({
    "price": [1000, 500],
    "rating": [4.5, 3.0],
    "review": [
        "Excellent performance and battery life",
        "Slow and heats up quickly",
    ],
})

embeddings = model.encode(df["review"].tolist())

final_features = np.hstack([
    df[["price", "rating"]].values,
    embeddings,
])

print("Final feature shape:", final_features.shape)

Output: 

Final feature shape: (2, 386) 

The complete dataset now contains 2 rows which contain 386 features. The original tabular data (price and rating) is combined with text embeddings from the reviews. The system develops advanced features through its combination of structured data and semantic text information which results in better model performance. 

Multi-Modal Feature Pipelines

We start with numeric features and semantic features which we combine into a hybrid vector.  

def feature_pipeline(row): 

   embedding = model.encode([row['review']])[0] 
   return list(row[['price', 'rating']]) + list(embedding) 

features = df.apply(feature_pipeline, axis=1) 
print(features.iloc[0][:5])

Output:  

[1000, 4.5, 0.023, -0.045, 0.067] 

The complete dataset now contains 2 rows which contain 386 features. The original tabular data (price and rating) is combined with text embeddings from the reviews. The system develops advanced features through its combination of structured data and semantic text information which results in better model performance. 

End-to-End Flow (Data → LLM → Features → Model)

In this section we’ll go through the workflow demonstration which uses Transformers to extract features for use with a basic classifier. For example, consider a sentiment classification task. For that at first we’ll take a sample dataset. 

import pandas as pd


df = pd.DataFrame({
    "review": [
        "Amazing product, delivery was super fast and packaging was perfect",
        "Terrible quality, broke after one use and support was unhelpful",
        "Good value for money, does what it promises",
        "The product is okay, not great but not bad either",
        "Excellent performance, exceeded my expectations completely",
        "Very slow delivery and the product quality is disappointing",
        "I love the design and build quality, highly recommended",
        "Waste of money, stopped working within two days",
        "Decent product for the price, but could be improved",
        "Customer service was helpful but the product is average",
        "Fantastic experience, will definitely buy again",
        "The item arrived late and was damaged",
        "Pretty good overall, satisfied with the purchase",
        "Not worth the price, quality feels cheap",
        "Absolutely शानदार product, very happy with it",
        "Works fine but nothing exceptional",
        "Horrible experience, I want a refund",
        "The features are useful and performance is smooth",
        "Mediocre quality, expected better at this price",
        "Superb build quality and fast performance",
        "Product is fine, delivery took too long",
        "Loved it, exactly what I needed",
        "It’s okay, does the job but has some issues",
        "Worst purchase ever, completely useless",
        "Very good quality and quick delivery",
        "Average product, nothing special",
        "Highly durable and reliable, great buy",
        "Poor packaging and damaged item received",
        "Satisfied with the purchase, decent performance",
        "Not happy with the product, quality is subpar",
    ],
    "label": [
        1, 0, 1, 1, 1,
        0, 1, 0, 1, 1,
        1, 0, 1, 0, 1,
        1, 0, 1, 0, 1,
        0, 1, 1, 0, 1,
        1, 1, 0, 1, 0,
    ],
})

Now, we’ll move forward to make an agentic pipeline that will help in feature engineering for a particular task. Like in this case it’ll perform the sentiment analysis. 

from transformers import pipeline
from sentence_transformers import SentenceTransformer

from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import train_test_split

import numpy as np


# Step 1: Initialize models
llm = pipeline("text2text-generation", model="google/flan-t5-base")
embedder = SentenceTransformer("all-MiniLM-L6-v2")


# Step 2: Feature Extraction Agent
def extract_features(text):
    prompt = f"Extract sentiment (positive/negative): {text}"
    result = llm(prompt, max_length=20)[0]["generated_text"]

    return 1 if "positive" in result.lower() else 0


# Step 3: Build Feature Set
df["sentiment_feature"] = df["review"].apply(extract_features)

embeddings = embedder.encode(df["review"].tolist())

X = np.hstack([
    df[["sentiment_feature"]].values,
    embeddings
])

y = df["label"]


# Step 4: Train Model
X_train, X_test, y_train, y_test = train_test_split(
    X,
    y,
    test_size=0.2
)

model = LogisticRegression()
model.fit(X_train, y_train)


# Step 5: Evaluate
accuracy = model.score(X_test, y_test)

print("Model Accuracy:", accuracy)

Output: 

Model Accuracy: 0.95 

This shows the complete system operation which functions from beginning to end. The LLM extracts a sentiment feature from each review, which is combined with embeddings to create richer inputs. The agentic feature engineering process of this system enables the model to better understand text, which results in increased accuracy for sentiment prediction. 

Real-World Applications

The application of LLMs in feature engineering creates changes that impact various industries. The solution shows ability to perform tasks in different operational areas.  

  • Classification and NLP Systems: LLMs deliver advanced textual elements which support sentiment analysis, chatbot development, and document classification tasks in classification and NLP systems.  
  • Tabular Machine Learning: LLMs enable all types of tasks to gain advantages from their capabilities. The LLM technology converts unstructured data from side sources into usable features which a tabular model can understand. 
  • Domain-Specific Use Cases: LLM features have found innovative applications in various domains which include finance and healthcare and insurance and additional industries. The LLM system in insurance pricing enables actuaries to create automatic features which previously required human specialists. The LLM system uses car model descriptions to determine risk ratings which identify vehicles as “boy racer” models. 

Limitations and Challenges

Feature engineering with LLMs provides benefits to users, but it creates multiple obstacles which need to be solved. The implementation process requires all team members to understand the existing constraints. These include: 

  • Reliability and Reproducibility: The outputs of LLM systems demonstrate inconsistent behavior because model changes and minor prompt alterations require new model evaluation. The system needs prompt logging and zero temperature settings to achieve consistent performance. Organizations face challenges in LLM deployment because they must handle two aspects which include API accessibility and version control. 
  • Bias and Interpretability: LLM systems make their features difficult to understand because their dense embeddings function as LLM core components. The system might create training data-based bias through its operational procedures. An LLM generates a feature which connects the word “doctor” to a particular gender in an implicit manner. The auditing process must examine features to determine their fairness. 
  • Over-Reliance on LLM Features: LLMs offer complete automation which leads to dangerous outcomes through their facade of reliability. LLMs generate irrelevant features when users provide incorrect prompts. The LLM features should function as supplementary tools which users should apply together with main domain features. 

Conclusion

The field of machine learning development experiences a major transformation through the use of feature engineering with LLMs. The process now shifts its emphasis from manual data transformation work toward creating automated features through semantic comprehension. This method enables researchers to develop new methods for analyzing intricate and disorganized datasets. 

The process requires precise implementation and thorough evaluation and validation procedures to achieve success. LLM capabilities combined with human expertise enable practitioners to develop AI systems that operate with greater strength and scalability and effectiveness. 

Frequently Asked Questions

Q1. What is feature engineering with LLMs?

A. It uses LLMs to turn raw data into semantic, structured features for machine learning models. 

Q2. How do LLM embeddings help?

A. They convert text into dense vectors that capture meaning, context, and relationships beyond simple word frequency. 

Q3. What are the main challenges?

A. LLM-based features can be inconsistent, biased, hard to interpret, and risky when used without validation. 

Hello! I'm Vipin, a passionate data science and machine learning enthusiast with a strong foundation in data analysis, machine learning algorithms, and programming. I have hands-on experience in building models, managing messy data, and solving real-world problems. My goal is to apply data-driven insights to create practical solutions that drive results. I'm eager to contribute my skills in a collaborative environment while continuing to learn and grow in the fields of Data Science, Machine Learning, and NLP.