Prompt提示工程上手指南:基础原理及实践(一)

AI摘要

本文探讨了Prompt工程,即如何通过精细调整AI输入来定制化输出,以满足特定需求。文章介绍了Prompt的不同类型,如问题式、陈述式、指令式和情感传入Prompt,以及它们在实际场景中的应用。文中还提到大模型如ChatGPT在Prompt工程中的运用,并强调了Prompt工程师在优化模型输出质量和应对注入攻击的重要性。,

想象一下,你在装饰房间。你可以选择一套标准的家具,这是快捷且方便的方式,但可能无法完全符合你的个人风格或需求。另一方面,你也可以选择定制家具,选择特定的颜色、材料和设计,以确保每件家具都符合你的喜好和空间要求。

比如,选择一个特制的沙发,你可以决定其尺寸、布料类型、甚至是扶手的样式。你还可以根据房间的主题选择颜色,甚至添加一些独特的装饰,比如刺绣或特别的缝线。

这就是Prompt工程的概念。就像你通过选择不同的设计元素来定制家具一样,Prompt工程涉及对AI的输入进行精细调整,以获得更加贴合需求的结果。通过改变、添加或精确化输入的提示,你可以引导AI产生更符合特定要求或风格的输出,就像为房间挑选和定制合适的家具一样。

很多人对语言大模型的认知和理解局限于智能回答层面,将它定位为取代搜索平台的智能应答机器人。但是随着更多大模型在各个领域应用的逐渐渗入,更多企业业务落地场景也在不断挖掘,人们会逐渐意识到大模型的能力远不止仅仅的问答作用。如果我们想要开始正式深入学习大模型的应用,迈开的第一步就会了解到Prompt提示工程,本系列文章将Prompt提示工程从简入深全面讲解以及实际落地运用,赋能不限于直媒体运营、AIGC文案生成,以及语音视频合成方面的运用。

在这里插入图片描述

1.什么是Prompt工程?

在AI语境中,"Prompt"通常指的是向模型提出的一个请求或问题,这个请求或问题的形式和内容会影响模型的输出。例如:在一个文本生成模型中,提

深入解析AI中的Prompt工程:从理论到实践 本文全面探讨了Prompt在人工智能中的核心地位及其应用技巧。Prompt作为引导大规模语言模型(LLM)输出的关键工具,直接影响模型生成内容的质量与相关性。文章首先介绍了Prompt的基础理论,包括其定义、ICIO框架及其在AI交互中的重要性。随后,详细阐述了Prompt工程实践,包括其范围、具体内容、工作流程及设计原则。文章还指出了Prompt工程中的常见误区,并深入解析了GPT模型如何理解Prompt,包括其基本结构、自注意力机制及多头注意力机制。最后,提供了Prompt工程实战指南,涵盖代码生成、优 阅读详情

相关推荐

AI大模型 | Prompt提示工程基础原理及实践

AI大模型入门基础教程学习指南,带你从入门到进阶2024最新版全套大模型学习路线图(完整版)AI大模型时代下,初学者该怎么才能快速入门?如有侵权,请联系删除。

2401_86137667的博客 1449

理论五、大模型-Prompt

当使用大型语言模型(如GPT-3)时,"prompt" 是指您向模型提供的输入文本或指令,用于引导模型生成相应的输出。

xiaoqi270620903的专栏 2万+

Prompt提示工程上手指南:基础原理及实践(二)-Prompt主流策略

在上篇文章中我们了解到Prompt基本种类有以下几种:如果大家经常用语言大模型的一些原生应用或者是去看过一些Prompt模板,开头的第一句往往都是说:我想让你担任xxx或者是你是一名xxx诸如此类定义人设的话:诸如此类的Prompt模板,为方便其中指定人设这段话我称之为System message,System message包含着Prompt开头,用于为模型提供上下文、指令或与使用案例相关的其他信息。

master_hunter的博客 2425

Prompt提示工程上手指南:基础原理及实践(三)-Prompt个性知识库引导

Prompt系列的第二期文章已经将所有的Prompt工程主流策略讲解完毕,共涉及到六种Prompt类别模型以及具体生产内容详解。再结合系列第一篇文章具体对Prompt工程的详细介绍,也就可以达到Prompt工程师的初步入门,现在如果掌握了这些基础技能那么就可以去学习一些更高阶的Prompt技能,伴随GPT-4 Turbo达到可生成自定义的GPTs,能够搭建属于业务目标的知识。

master_hunter的博客 2748

Prompt提示工程上手指南:基础原理及实践(四)-检索增强生成(RAG)策略下的Prompt

想象一下,当你在写一篇文章或解决一个问题时,如果遇到了难题,你会怎么做?可能会去搜索引擎查找信息,然后基于找到的信息来构建你的答案。这个过程,其实很像是RAG框架在做的事情。化繁为简,我们先来了解RAG到底是什么。先从字母意思开始理解,RAG——Retrieval Augmented Generation,正如其名,是一种将检索(Retrieval)和生成(Generation)结合起来的技术。它首先从一个巨大的知识库中检索出与提出的问题最相关的信息,然后基于这些信息来生成回答。

master_hunter的博客 4975

超详细neo4j安装教程

一、neo4j简介 最近开始学习知识图谱,所以首先想先学习一下neo4j的使用。 Neo4j是一个高性能的,NOSQL图形数据库,它将结构化数据存储在网络上而不是表中。由于知识图谱中存在大量的关系型信息(实体—关系—实体), 使用结构化数据库进行存储将产生大量的冗余存储信息, 因此将图数据库作为知识图谱的存储容器成为流行的选择。当前较为常用的图数据库主要有 Neo4j 等。 二、neo4j的安装 功能快捷键 撤销:Ctrl/Command + Z 重做:Ctrl/Command + Y 加粗:Ctrl/Co

qq_38335648的博客 9万+

拼多多/Temu反爬参数逆向踩坑记:从浏览器调试到补环境完整复盘

本文详细解析了拼多多/Temu反爬参数`anti_content`的逆向工程实战,从浏览器调试到补环境完整复盘。通过JavaScript逆向技术,拆解关键函数定位、反混淆算法还原及补环境技术应用,帮助开发者突破电商平台复杂反爬系统,提升数据采集效率。

weixin_33978722的博客 920

python 中心线提取_二值分析 | OpenCV + skimage如何提取中心线

点击上方蓝字关注我们微信公众号:OpenCV学堂关注获取更多计算机视觉与深度学习知识问题前几天有个人问了我一个问题,问题是这样的,他有如下的一张二值图像:怎么得到白色Blob中心线,他希望的效果如下:显然OpenCV中常见的轮廓分析无法获得上面的中心红色线段,本质上这个问题是如何提取二值对象的骨架,提取骨架的方法在OpenCV的扩展模块中,另外skimage包也支持图像的骨架提取。这里就...

weixin_42204453的博客 4291

Hcaptcha验证码破解深度解析:从环境检测到n值算法的攻防实战

本文深入解析Hcaptcha验证码的攻防技术,从环境检测到n值算法的全面突破策略。详细介绍了浏览器指纹模拟、图像识别工程化解决方案及协议层逆向分析,为安全研究人员提供高效破解Hcaptcha的实战指南。

weixin_42563415的博客 387

DeepSeek与YOLO融合技术的微信小程序实现方案

本文介绍了一个基于微信小程序和Flask后端的智能图像检测系统。系统采用DeepSeek-7B进行自然语言理解,YOLOv8执行目标检测,并通过融合验证模块确保结果准确性。核心流程包括:用户通过小程序上传图片和文本需求,后端解析意图后执行目标检测,最后验证并返回结果。关键技术包括DeepSeek的指令理解、动态阈值调整和模型优化(ONNX、TensorRT)。系统适用于工业质检等场景,如"检测表面划痕",能自动识别目标并验证结果。部署需GPU服务器,并包含安全机制保障系统稳定运行。

老郑的博客 275

STC单片机使用FatFs文件系统读取SD卡指定文件内容

STC单片机使用FatFs文件系统读取SD卡指定文件内容

perseverance51博客 2748

【智能车Code review】——拐点的寻找

CROSSROAD:十字拐点 ROUNDISLAND:环岛拐点 rightfindflag[i]:表示第i行的右线是否被找到,1为找到,0为没有找到 flag_find_huan_rightdown_point :找到环岛右下拐点标志 flag_find_huan_rightmiddle_point:找到环岛右中拐点标志 找拐点的思路:观察一段数据中数据点的走向趋势,并且保证这段数据是准确的。在摄像头畸变比较严重的情况下这种方法不再适用 关于函数的调用请见:https://blog.csdn.net/qq.

hanhan的博客 1万+

20、认知负荷理论在教育技术中的应用

本文深入探讨了认知负荷理论(Cognitive Load Theory, CLT)在教育技术中的应用,重点分析了如何通过优化教学设计减少学习者的认知负荷,提高学习效率。文章介绍了认知负荷的三种类型:内在认知负荷、外在认知负荷和germane认知负荷,并结合多媒体学习原则(如模态效应、空间连续性原则、时间连续性原则等)提出了减少外在认知负荷的具体策略。此外,文章通过实证研究和教学案例,展示了认知负荷理论在不同学科和个性化教学中的广泛应用和有效性。最终,文章总结了应用认知负荷理论进行教学设计的具体流程,强调其在

solidity8miner的博客 925

全球国家地区城市数据

MySQL全球国家地区城市数据报。。。。。。。。。。。。

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

怀旧版电脑GBC模拟器

再现原版GBC掌机的界面,电脑运行连游戏界面都一样大小,很怀旧,很真实,(英文版)强烈推荐,很小的文件,很难才找到的。

WINCC7.3破解文件

WINCC7.3硬件够破解文件,有需要的下载!WINCC7.3硬件够破解文件,有需要的下载!

上一篇: 详解静态网页数据获取以及浏览器数据和网络数据交互流程-Python
下一篇: 详解动态网页数据获取以及浏览器数据和网络数据交互流程-Python
fanstuck
fanstuck 优质创作者: 人工智能技术领域 优质创作者: 人工智能技术领域 领域专家: 数据科学与机器学习技术领域 领域专家: 数据科学与机器学习技术领域
博客等级 码龄8年 13万+粉丝 423原创
评论 68
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

fanstuck

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值