Comments (3)
Are you expecting them to be exactly same? I see you are using a temperature of 0.8 in your experiment. At higher temperatures I think you will see differences between the Speculative decoding output and the output generated if you were to use the target model directly. This is the acceptance logic for draft tokens https://sourcegraph.com/github.com/vllm-project/vllm/-/blob/vllm/model_executor/layers/rejection_sampler.py?L160 and it does not guarantee that the outputs will be the same specially for higher temperatures.
You can expect the 2 outputs to match only for temperature 0.
cc: @cadedaniel for his input.
from vllm.
@sroy745 is right but also looks like it's generating gibberish which is unexpected unless the target model produces gibberish.
Prompt: 'What is Machine Learning?', Generated text: '10 Milano12 212主要专业 [apps国家 这管理 我如何an'
@YuCheng-Qi can you share a reproducible example, e.g. a model I can reproduce it with?
from vllm.
@cadedaniel @sroy745 Thank you for your very insightful and enthusiastic answers. Below I will describe the process of this error in detail for your reference.
when I use :
sampling_params = SamplingParams(temperature=0,
top_p=0.95,
logprobs=1,
stop_token_ids=stop_token_ids)
1 The result generated by using the target model(/mnt/nas/faibei/faibing-10B-Chat) alone is:
Processed prompts: 100%|███████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 3.20it/s]
tokens/s: 50.583147408917135
outputs: [RequestOutput(request_id=0, prompt='What is Machine Learning', prompt_token_ids=[50002, 26888, 2476, 59109, 60303, 50007], prompt_logprobs=None, outputs=[CompletionOutput(index=0, text='Machine learning is a field of artificial intelligence (AI) that involves training algorithms', token_ids=[50006, 59109, 51081, 2476, 778, 50162, 885, 55501, 53336, 35, 6272, 43396, 5246, 52843, 50599, 55832], cumulative_logprob=-2.7939926966739677, logprobs=[{50006: Logprob(logprob=0.0, rank=1, decoded_token='')}, {59109: Logprob(logprob=-0.011991554871201515, rank=1, decoded_token='Machine')}, {51081: Logprob(logprob=-0.4860461354255676, rank=1, decoded_token=' learning')}, {2476: Logprob(logprob=-0.011147127486765385, rank=1, decoded_token=' is')}, {778: Logprob(logprob=-0.014388969168066978, rank=1, decoded_token=' a')}, {50162: Logprob(logprob=-0.5061734318733215, rank=1, decoded_token=' field')}, {885: Logprob(logprob=-0.0033579650335013866, rank=1, decoded_token=' of')}, {55501: Logprob(logprob=-0.5290303826332092, rank=1, decoded_token=' artificial')}, {53336: Logprob(logprob=-3.099436753473128e-06, rank=1, decoded_token=' intelligence')}, {35: Logprob(logprob=-0.445012629032135, rank=1, decoded_token=' (')}, {6272: Logprob(logprob=-1.3589766240329482e-05, rank=1, decoded_token='AI')}, {43396: Logprob(logprob=-6.9141146923357155e-06, rank=1, decoded_token=')')}, {5246: Logprob(logprob=-0.021114686504006386, rank=1, decoded_token=' that')}, {52843: Logprob(logprob=-0.1500907987356186, rank=1, decoded_token=' involves')}, {50599: Logprob(logprob=-0.2279604822397232, rank=1, decoded_token=' training')}, {55832: Logprob(logprob=-0.3876549303531647, rank=1, decoded_token=' algorithms')}], finish_reason=length, stop_reason=None)], finished=True, metrics=RequestMetrics(arrival_time=1717727044.651589, first_scheduled_time=+4.50ms, first_token_time=+31.69ms, last_token_time=+0.00ms, time_in_queue=4.50ms, finished_time=1717727044.9674897), lora_request=None)]
Prompt: 'What is Machine Learning', Generated text: 'Machine learning is a field of artificial intelligence (AI) that involves training algorithms'
2 The result generated by using the spec model (small model,/mnt/nas/faibei/faibing-1B-Chat) used in Speculative decoding alone is:
$python sp_runner_example_api.py
ldd: ./libnccl.so.2: No such file or directory
Processed prompts: 100%|███████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 5.29it/s]
tokens/s: 83.13196912507416
outputs: [RequestOutput(request_id=0, prompt='What is Machine Learning', prompt_token_ids=[50002, 26888, 2476, 59109, 60303, 50007], prompt_logprobs=None, outputs=[CompletionOutput(index=0, text='Machine learning is a subset of artificial intelligence (AI) that involves training algorithms', token_ids=[50006, 59109, 51081, 2476, 778, 55977, 885, 55501, 53336, 35, 6272, 43396, 5246, 52843, 50599, 55832], cumulative_logprob=-2.963461573823224, logprobs=[{50006: Logprob(logprob=0.0, rank=1, decoded_token='')}, {59109: Logprob(logprob=-0.019566968083381653, rank=1, decoded_token='Machine')}, {51081: Logprob(logprob=-0.5231714248657227, rank=1, decoded_token=' learning')}, {2476: Logprob(logprob=-0.06658891588449478, rank=1, decoded_token=' is')}, {778: Logprob(logprob=-0.011581214144825935, rank=1, decoded_token=' a')}, {55977: Logprob(logprob=-0.5235638618469238, rank=1, decoded_token=' subset')}, {885: Logprob(logprob=-0.00020358874462544918, rank=1, decoded_token=' of')}, {55501: Logprob(logprob=-0.1554061472415924, rank=1, decoded_token=' artificial')}, {53336: Logprob(logprob=-1.9192511899746023e-05, rank=1, decoded_token=' intelligence')}, {35: Logprob(logprob=-0.6489261984825134, rank=1, decoded_token=' (')}, {6272: Logprob(logprob=-9.572047565598041e-05, rank=1, decoded_token='AI')}, {43396: Logprob(logprob=-0.008335325866937637, rank=1, decoded_token=')')}, {5246: Logprob(logprob=-0.01461420301347971, rank=1, decoded_token=' that')}, {52843: Logprob(logprob=-0.3702547252178192, rank=1, decoded_token=' involves')}, {50599: Logprob(logprob=-0.4765051603317261, rank=1, decoded_token=' training')}, {55832: Logprob(logprob=-0.14462892711162567, rank=1, decoded_token=' algorithms')}], finish_reason=length, stop_reason=None)], finished=True, metrics=RequestMetrics(arrival_time=1717727261.8583694, first_scheduled_time=+3.60ms, first_token_time=+97.93ms, last_token_time=+0.00ms, time_in_queue=3.60ms, finished_time=1717727262.050356), lora_request=None)]
Prompt: 'What is Machine Learning', Generated text: 'Machine learning is a subset of artificial intelligence (AI) that involves training algorithms'
3 However, when I use the target model (/mnt/nas/faibei/faibing-10B-Chat) as the model and the small model (/mnt/nas/faibei/faibing-1B-Chat) as the speculative_model, garbled characters appear in the generated content. The results are as follows:
$python sp_runner_example_api.py
ldd: ./libnccl.so.2: No such file or directory
Processed prompts: 100%|███████████████████████████████████████████████████████████████████████████████████████████████| 1/1 [00:00<00:00, 1.62it/s]
tokens/s: 25.66761954520385
outputs: [RequestOutput(request_id=0, prompt='What is Machine Learning', prompt_token_ids=[50002, 26888, 2476, 59109, 60303, 50007], prompt_logprobs=None, outputs=[CompletionOutput(index=0, text='——),ilha生活 2比较),还有没有公司olina很多我的一下的一', token_ids=[50006, 44, 65, 102517, 76, 50, 93, 65, 95, 10, 26, 95078, 63, 69, 94, 97], cumulative_logprob=0.0, logprobs=[{50006: Logprob(logprob=0.0, rank=None, decoded_token='')}, {44: Logprob(logprob=0.0, rank=None, decoded_token='——')}, {65: Logprob(logprob=0.0, rank=None, decoded_token='),')}, {102517: Logprob(logprob=0.0, rank=None, decoded_token='ilha')}, {76: Logprob(logprob=0.0, rank=None, decoded_token='生活')}, {50: Logprob(logprob=0.0, rank=None, decoded_token=' 2')}, {93: Logprob(logprob=0.0, rank=None, decoded_token='比较')}, {65: Logprob(logprob=0.0, rank=None, decoded_token='),')}, {95: Logprob(logprob=0.0, rank=None, decoded_token='还有')}, {10: Logprob(logprob=0.0, rank=None, decoded_token='没有')}, {26: Logprob(logprob=0.0, rank=None, decoded_token='公司')}, {95078: Logprob(logprob=0.0, rank=None, decoded_token='olina')}, {63: Logprob(logprob=0.0, rank=None, decoded_token='很多')}, {69: Logprob(logprob=0.0, rank=None, decoded_token='我的')}, {94: Logprob(logprob=0.0, rank=None, decoded_token='一下')}, {97: Logprob(logprob=0.0, rank=None, decoded_token='的一')}], finish_reason=length, stop_reason=None)], finished=True, metrics=RequestMetrics(arrival_time=1717727600.3066957, first_scheduled_time=+4.82ms, first_token_time=+112.33ms, last_token_time=+0.00ms, time_in_queue=4.82ms, finished_time=1717727600.929564), lora_request=None)]
Prompt: 'What is Machine Learning', Generated text: '——),ilha生活 2比较),还有没有公司olina很多我的一下的一'
@cadedaniel Sorry, you may not be able to get my model file (it is not open source yet, so you can't download it)
I guess it may be that token_ids are not obtained correctly during speculative sampling, or logprob is not calculated correctly, resulting in garbled sampling, or some other reason? Please help analyze the solution.
from vllm.
Related Issues (20)
- [Bug]: Error when running multimodal large models with --enable-prefix-caching HOT 1
- [Bug]: Missing code checking when using Encoder/Decoder models on CPU backend
- [Bug]: Mistral Large Instruct 2407 tool calling leakage HOT 7
- [Feature]: Add ray cluster start logic to vllm container for multi host inference with leaderworkerset
- [Bug]: 3090 P@P HOT 2
- [RFC]: Reimplement and separate beam search on top of vLLM core HOT 6
- [BUG]: Outline performance regression from v0.5.2 to 0.5.3
- [Feature]: Support Tools Calling For Qwen2
- [Performance]: guided generation is very slow in offline mode HOT 14
- [Usage]: Correct way to load lora model HOT 1
- [Performance]: Image preprocessing is executed twice for same image during VLLM(Qwen2-vl) inference HOT 11
- [Bug]: vLLM crashes with larger context sizes on TPUs HOT 4
- [Bug]: 段错误 (核心已转储) HOT 8
- Do vLLM support `input_embeds` as input while using LLama? HOT 15
- [Bug]: TimeoutError During Benchmark Profiling with Torch Profiler on vLLM v0.6.0 HOT 5
- [Bug]: vLLM v0.6.0 (CPU) server failed to start on setting VLLM_CPU_OMP_THREADS_BIND HOT 2
- [Usage]: example/offline_inference_chat.py run error. HOT 1
- [Usage]: How to stop VLLM during generation ? HOT 2
- [RFC]: Pinned Caching with Automatic Prefix Caching (Related to Anthropic Prompt Caching API) HOT 12
- [Feature]: Official ROCm Binary to Speed Up vLLM Installation
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vllm.